@@ -43,12 +43,6 @@ func TestDefaultImagePinger(t *testing.T) {
43
43
44
44
type statusForPath map [string ]int
45
45
46
- rt := knet .SetTransportDefaults (& http.Transport {
47
- TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
48
- })
49
- insecureClient := http.Client {Transport : rt }
50
- secureClient := http.Client {}
51
-
52
46
for _ , tc := range []struct {
53
47
name string
54
48
schemePrefix string
@@ -81,7 +75,7 @@ func TestDefaultImagePinger(t *testing.T) {
81
75
securedRegistry : true ,
82
76
insecure : true ,
83
77
statusForPath : statusForPath {"/" : http .StatusOK },
84
- expectedErrorSubstring : "malformed HTTP response" ,
78
+ expectedErrorSubstring : "unexpected status: 400 Bad Request" , // https://github.com/golang/go/issues/23689
85
79
},
86
80
87
81
{
@@ -150,9 +144,15 @@ func TestDefaultImagePinger(t *testing.T) {
150
144
expectedRequests : []string {"/" , "/healthz" },
151
145
},
152
146
} {
153
- func () {
147
+ t . Run ( tc . name , func (t * testing. T ) {
154
148
defer rs .clear ()
155
149
150
+ rt := knet .SetTransportDefaults (& http.Transport {
151
+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
152
+ })
153
+ insecureClient := http.Client {Transport : rt }
154
+ secureClient := http.Client {}
155
+
156
156
handler := func (w http.ResponseWriter , r * http.Request ) {
157
157
rs .addRequest (r )
158
158
if s , ok := tc .statusForPath [r .URL .Path ]; ok {
@@ -212,6 +212,6 @@ func TestDefaultImagePinger(t *testing.T) {
212
212
if a := rs .getRequests (); ! reflect .DeepEqual (a , ers ) {
213
213
t .Errorf ("[%s] got unexpected requests: %s" , tc .name , diff .ObjectDiff (a , ers ))
214
214
}
215
- }( )
215
+ })
216
216
}
217
217
}
0 commit comments