@@ -16,7 +16,6 @@ import (
16
16
17
17
var hostname1 = "indomitable"
18
18
var hostname2 = "indefatigable"
19
- var hostname3 = "invincible"
20
19
21
20
func Test_HAproxy (t * testing.T ) {
22
21
Convey ("End-to-end testing HAproxy functionality" , t , func () {
@@ -30,9 +29,17 @@ func Test_HAproxy(t *testing.T) {
30
29
ip := "127.0.0.1"
31
30
ip3 := "127.0.0.3"
32
31
33
- ports1 := []service.Port {{"tcp" , 10450 , 8080 , ip }, {"tcp" , 10020 , 9000 , ip }}
34
- ports2 := []service.Port {{"tcp" , 9999 , 8090 , ip3 }}
35
- ports3 := []service.Port {{"tcp" , 32763 , 8080 , ip3 }, {"tcp" , 10020 , 9000 , ip3 }}
32
+ ports1 := []service.Port {
33
+ {Type : "tcp" , Port : 10450 , ServicePort : 8080 , IP : ip },
34
+ {Type : "tcp" , Port : 10020 , ServicePort : 9000 , IP : ip },
35
+ }
36
+ ports2 := []service.Port {
37
+ {Type : "tcp" , Port : 9999 , ServicePort : 8090 , IP : ip3 },
38
+ }
39
+ ports3 := []service.Port {
40
+ {Type : "tcp" , Port : 32763 , ServicePort : 8080 , IP : ip3 },
41
+ {Type : "tcp" , Port : 10020 , ServicePort : 9000 , IP : ip3 },
42
+ }
36
43
37
44
services := []service.Service {
38
45
{
@@ -130,7 +137,9 @@ func Test_HAproxy(t *testing.T) {
130
137
Image : "some-svc" ,
131
138
Hostname : "titanic" ,
132
139
Updated : baseTime .Add (5 * time .Second ),
133
- Ports : []service.Port {{"tcp" , 666 , 6666 , "127.0.0.1" }},
140
+ Ports : []service.Port {
141
+ {Type : "tcp" , Port : 666 , ServicePort : 6666 , IP : "127.0.0.1" },
142
+ },
134
143
}
135
144
136
145
// It had 1 before
@@ -178,7 +187,9 @@ func Test_HAproxy(t *testing.T) {
178
187
Hostname : "titanic" ,
179
188
Status : service .UNHEALTHY ,
180
189
Updated : baseTime .Add (5 * time .Second ),
181
- Ports : []service.Port {{"tcp" , 666 , 6666 , "127.0.0.1" }},
190
+ Ports : []service.Port {
191
+ {Type : "tcp" , Port : 666 , ServicePort : 6666 , IP : "127.0.0.1" },
192
+ },
182
193
}
183
194
badSvc2 := service.Service {
184
195
ID : "0000bad00001" ,
@@ -187,13 +198,16 @@ func Test_HAproxy(t *testing.T) {
187
198
Hostname : "titanic" ,
188
199
Status : service .UNKNOWN ,
189
200
Updated : baseTime .Add (5 * time .Second ),
190
- Ports : []service.Port {{"tcp" , 666 , 6666 , "127.0.0.1" }},
201
+ Ports : []service.Port {
202
+ {Type : "tcp" , Port : 666 , ServicePort : 6666 , IP : "127.0.0.1" },
203
+ },
191
204
}
192
205
state .AddServiceEntry (badSvc )
193
206
state .AddServiceEntry (badSvc2 )
194
207
195
208
buf := bytes .NewBuffer (make ([]byte , 0 , 2048 ))
196
- proxy .WriteConfig (state , buf )
209
+ err := proxy .WriteConfig (state , buf )
210
+ So (err , ShouldBeNil )
197
211
198
212
output := buf .Bytes ()
199
213
// Look for a few things we should NOT see
@@ -249,7 +263,9 @@ func Test_HAproxy(t *testing.T) {
249
263
Image : "some-svc" ,
250
264
Hostname : hostname2 ,
251
265
Updated : newTime ,
252
- Ports : []service.Port {{"tcp" , 1337 , 8090 , "127.0.0.1" }},
266
+ Ports : []service.Port {
267
+ {Type : "tcp" , Port : 1337 , ServicePort : 8090 , IP : "127.0.0.1" },
268
+ },
253
269
}
254
270
OUTER:
255
271
for {
0 commit comments