@@ -161,7 +161,7 @@ func TestServer(t *testing.T) {
161161 t .Errorf ("expected port :9376 to be open\n %#v" , listener .openPorts )
162162 }
163163 // test the handler
164- testHandler (hcs , nsn , http .StatusServiceUnavailable , 0 , t )
164+ testHandler (t , hcs , nsn , http .StatusServiceUnavailable , 0 )
165165
166166 // sync an endpoint
167167 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {nsn : 18 })
@@ -175,7 +175,7 @@ func TestServer(t *testing.T) {
175175 t .Errorf ("expected 18 endpoints, got %d" , hcs .services [nsn ].endpoints )
176176 }
177177 // test the handler
178- testHandler (hcs , nsn , http .StatusOK , 18 , t )
178+ testHandler (t , hcs , nsn , http .StatusOK , 18 )
179179
180180 // sync zero endpoints
181181 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {nsn : 0 })
@@ -189,7 +189,7 @@ func TestServer(t *testing.T) {
189189 t .Errorf ("expected 0 endpoints, got %d" , hcs .services [nsn ].endpoints )
190190 }
191191 // test the handler
192- testHandler (hcs , nsn , http .StatusServiceUnavailable , 0 , t )
192+ testHandler (t , hcs , nsn , http .StatusServiceUnavailable , 0 )
193193
194194 // put the endpoint back
195195 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {nsn : 11 })
@@ -214,7 +214,7 @@ func TestServer(t *testing.T) {
214214 t .Errorf ("expected 0 endpoints, got %d" , hcs .services [nsn ].endpoints )
215215 }
216216 // test the handler
217- testHandler (hcs , nsn , http .StatusServiceUnavailable , 0 , t )
217+ testHandler (t , hcs , nsn , http .StatusServiceUnavailable , 0 )
218218
219219 // put the endpoint back
220220 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {nsn : 18 })
@@ -265,9 +265,9 @@ func TestServer(t *testing.T) {
265265 t .Errorf ("expected 3 open ports, got %d\n %#v" , len (listener .openPorts ), listener .openPorts )
266266 }
267267 // test the handlers
268- testHandler (hcs , nsn1 , http .StatusServiceUnavailable , 0 , t )
269- testHandler (hcs , nsn2 , http .StatusServiceUnavailable , 0 , t )
270- testHandler (hcs , nsn3 , http .StatusServiceUnavailable , 0 , t )
268+ testHandler (t , hcs , nsn1 , http .StatusServiceUnavailable , 0 )
269+ testHandler (t , hcs , nsn2 , http .StatusServiceUnavailable , 0 )
270+ testHandler (t , hcs , nsn3 , http .StatusServiceUnavailable , 0 )
271271
272272 // sync endpoints
273273 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {
@@ -291,9 +291,9 @@ func TestServer(t *testing.T) {
291291 t .Errorf ("expected 7 endpoints, got %d" , hcs .services [nsn3 ].endpoints )
292292 }
293293 // test the handlers
294- testHandler (hcs , nsn1 , http .StatusOK , 9 , t )
295- testHandler (hcs , nsn2 , http .StatusOK , 3 , t )
296- testHandler (hcs , nsn3 , http .StatusOK , 7 , t )
294+ testHandler (t , hcs , nsn1 , http .StatusOK , 9 )
295+ testHandler (t , hcs , nsn2 , http .StatusOK , 3 )
296+ testHandler (t , hcs , nsn3 , http .StatusOK , 7 )
297297
298298 // sync new services
299299 err = hcs .SyncServices (map [types.NamespacedName ]uint16 {
@@ -318,9 +318,9 @@ func TestServer(t *testing.T) {
318318 t .Errorf ("expected 0 endpoints, got %d" , hcs .services [nsn4 ].endpoints )
319319 }
320320 // test the handlers
321- testHandler (hcs , nsn2 , http .StatusOK , 3 , t )
322- testHandler (hcs , nsn3 , http .StatusServiceUnavailable , 0 , t )
323- testHandler (hcs , nsn4 , http .StatusServiceUnavailable , 0 , t )
321+ testHandler (t , hcs , nsn2 , http .StatusOK , 3 )
322+ testHandler (t , hcs , nsn3 , http .StatusServiceUnavailable , 0 )
323+ testHandler (t , hcs , nsn4 , http .StatusServiceUnavailable , 0 )
324324
325325 // sync endpoints
326326 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {
@@ -345,9 +345,9 @@ func TestServer(t *testing.T) {
345345 t .Errorf ("expected 6 endpoints, got %d" , hcs .services [nsn4 ].endpoints )
346346 }
347347 // test the handlers
348- testHandler (hcs , nsn2 , http .StatusOK , 3 , t )
349- testHandler (hcs , nsn3 , http .StatusOK , 7 , t )
350- testHandler (hcs , nsn4 , http .StatusOK , 6 , t )
348+ testHandler (t , hcs , nsn2 , http .StatusOK , 3 )
349+ testHandler (t , hcs , nsn3 , http .StatusOK , 7 )
350+ testHandler (t , hcs , nsn4 , http .StatusOK , 6 )
351351
352352 // sync endpoints, missing nsn2
353353 err = hcs .SyncEndpoints (map [types.NamespacedName ]int {
@@ -370,12 +370,13 @@ func TestServer(t *testing.T) {
370370 t .Errorf ("expected 6 endpoints, got %d" , hcs .services [nsn4 ].endpoints )
371371 }
372372 // test the handlers
373- testHandler (hcs , nsn2 , http .StatusServiceUnavailable , 0 , t )
374- testHandler (hcs , nsn3 , http .StatusOK , 7 , t )
375- testHandler (hcs , nsn4 , http .StatusOK , 6 , t )
373+ testHandler (t , hcs , nsn2 , http .StatusServiceUnavailable , 0 )
374+ testHandler (t , hcs , nsn3 , http .StatusOK , 7 )
375+ testHandler (t , hcs , nsn4 , http .StatusOK , 6 )
376376}
377377
378- func testHandler (hcs * server , nsn types.NamespacedName , status int , endpoints int , t * testing.T ) {
378+ func testHandler (t * testing.T , hcs * server , nsn types.NamespacedName , status int , endpoints int ) {
379+ t .Helper ()
379380 handler := hcs .services [nsn ].server .(* fakeHTTPServer ).handler
380381 req , err := http .NewRequest ("GET" , "/healthz" , nil )
381382 if err != nil {
0 commit comments