@@ -43,12 +43,6 @@ func TestDefaultImagePinger(t *testing.T) {
4343
4444 type statusForPath map [string ]int
4545
46- rt := knet .SetTransportDefaults (& http.Transport {
47- TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
48- })
49- insecureClient := http.Client {Transport : rt }
50- secureClient := http.Client {}
51-
5246 for _ , tc := range []struct {
5347 name string
5448 schemePrefix string
@@ -81,7 +75,7 @@ func TestDefaultImagePinger(t *testing.T) {
8175 securedRegistry : true ,
8276 insecure : true ,
8377 statusForPath : statusForPath {"/" : http .StatusOK },
84- expectedErrorSubstring : "malformed HTTP response" ,
78+ expectedErrorSubstring : "unexpected status: 400 Bad Request" , // https://github.com/golang/go/issues/23689
8579 },
8680
8781 {
@@ -150,9 +144,15 @@ func TestDefaultImagePinger(t *testing.T) {
150144 expectedRequests : []string {"/" , "/healthz" },
151145 },
152146 } {
153- func () {
147+ t . Run ( tc . name , func (t * testing. T ) {
154148 defer rs .clear ()
155149
150+ rt := knet .SetTransportDefaults (& http.Transport {
151+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
152+ })
153+ insecureClient := http.Client {Transport : rt }
154+ secureClient := http.Client {}
155+
156156 handler := func (w http.ResponseWriter , r * http.Request ) {
157157 rs .addRequest (r )
158158 if s , ok := tc .statusForPath [r .URL .Path ]; ok {
@@ -212,6 +212,6 @@ func TestDefaultImagePinger(t *testing.T) {
212212 if a := rs .getRequests (); ! reflect .DeepEqual (a , ers ) {
213213 t .Errorf ("[%s] got unexpected requests: %s" , tc .name , diff .ObjectDiff (a , ers ))
214214 }
215- }( )
215+ })
216216 }
217217}
0 commit comments