@@ -65,9 +65,9 @@ func TestTransportSelectionAnonymous(t *testing.T) {
65
65
basic := & authn.Basic {Username : "foo" , Password : "bar" }
66
66
reg := testReference .Context ().Registry
67
67
68
- tp , err := New ( reg , basic , recorder , []string {testReference .Scope (PullScope )})
68
+ tp , err := NewWithContext ( context . Background (), reg , basic , recorder , []string {testReference .Scope (PullScope )})
69
69
if err != nil {
70
- t .Errorf ("New () = %v" , err )
70
+ t .Errorf ("NewWithContext () = %v" , err )
71
71
}
72
72
73
73
req , err := http .NewRequest ("GET" , fmt .Sprintf ("http://%s/v2/anything" , reg ), nil )
@@ -102,14 +102,14 @@ func TestTransportSelectionBasic(t *testing.T) {
102
102
103
103
basic := & authn.Basic {Username : "foo" , Password : "bar" }
104
104
105
- tp , err := New ( testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
105
+ tp , err := NewWithContext ( context . Background (), testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
106
106
if err != nil {
107
- t .Errorf ("New () = %v" , err )
107
+ t .Errorf ("NewWithContext () = %v" , err )
108
108
}
109
109
if tpw , ok := tp .(* Wrapper ); ! ok {
110
- t .Errorf ("New (); got %T, want *Wrapper" , tp )
110
+ t .Errorf ("NewWithContext (); got %T, want *Wrapper" , tp )
111
111
} else if _ , ok := tpw .inner .(* basicTransport ); ! ok {
112
- t .Errorf ("New (); got %T, want *basicTransport" , tp )
112
+ t .Errorf ("NewWithContext (); got %T, want *basicTransport" , tp )
113
113
}
114
114
}
115
115
@@ -132,8 +132,8 @@ func TestTransportBadAuth(t *testing.T) {
132
132
},
133
133
}
134
134
135
- if _ , err := New ( testReference .Context ().Registry , & badAuth {}, tprt , []string {testReference .Scope (PullScope )}); err == nil {
136
- t .Errorf ("New () expected err, got nil" )
135
+ if _ , err := NewWithContext ( context . Background (), testReference .Context ().Registry , & badAuth {}, tprt , []string {testReference .Scope (PullScope )}); err == nil {
136
+ t .Errorf ("NewWithContext () expected err, got nil" )
137
137
}
138
138
}
139
139
@@ -173,14 +173,14 @@ func TestTransportSelectionBearer(t *testing.T) {
173
173
}
174
174
175
175
basic := & authn.Basic {Username : "foo" , Password : "bar" }
176
- tp , err := New ( testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
176
+ tp , err := NewWithContext ( context . Background (), testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
177
177
if err != nil {
178
- t .Errorf ("New () = %v" , err )
178
+ t .Errorf ("NewWithContext () = %v" , err )
179
179
}
180
180
if tpw , ok := tp .(* Wrapper ); ! ok {
181
- t .Errorf ("New (); got %T, want *Wrapper" , tp )
181
+ t .Errorf ("NewWithContext (); got %T, want *Wrapper" , tp )
182
182
} else if _ , ok := tpw .inner .(* bearerTransport ); ! ok {
183
- t .Errorf ("New (); got %T, want *bearerTransport" , tp )
183
+ t .Errorf ("NewWithContext (); got %T, want *bearerTransport" , tp )
184
184
}
185
185
}
186
186
@@ -198,9 +198,9 @@ func TestTransportSelectionBearerMissingRealm(t *testing.T) {
198
198
}
199
199
200
200
basic := & authn.Basic {Username : "foo" , Password : "bar" }
201
- tp , err := New ( testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
201
+ tp , err := NewWithContext ( context . Background (), testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
202
202
if err == nil || ! strings .Contains (err .Error (), "missing realm" ) {
203
- t .Errorf ("New () = %v, %v" , tp , err )
203
+ t .Errorf ("NewWithContext () = %v, %v" , tp , err )
204
204
}
205
205
}
206
206
@@ -225,9 +225,9 @@ func TestTransportSelectionBearerAuthError(t *testing.T) {
225
225
}
226
226
227
227
basic := & authn.Basic {Username : "foo" , Password : "bar" }
228
- tp , err := New ( testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
228
+ tp , err := NewWithContext ( context . Background (), testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
229
229
if err == nil {
230
- t .Errorf ("New () = %v" , tp )
230
+ t .Errorf ("NewWithContext () = %v" , tp )
231
231
}
232
232
}
233
233
@@ -245,9 +245,9 @@ func TestTransportSelectionUnrecognizedChallenge(t *testing.T) {
245
245
}
246
246
247
247
basic := & authn.Basic {Username : "foo" , Password : "bar" }
248
- tp , err := New ( testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
248
+ tp , err := NewWithContext ( context . Background (), testReference .Context ().Registry , basic , tprt , []string {testReference .Scope (PullScope )})
249
249
if err == nil || ! strings .Contains (err .Error (), "challenge" ) {
250
- t .Errorf ("New () = %v, %v" , tp , err )
250
+ t .Errorf ("NewWithContext () = %v, %v" , tp , err )
251
251
}
252
252
}
253
253
@@ -272,9 +272,9 @@ func TestTransportAlwaysTriesHttps(t *testing.T) {
272
272
}
273
273
274
274
basic := & authn.Basic {Username : "foo" , Password : "bar" }
275
- tp , err := New ( registry , basic , server .Client ().Transport , []string {testReference .Scope (PullScope )})
275
+ tp , err := NewWithContext ( context . Background (), registry , basic , server .Client ().Transport , []string {testReference .Scope (PullScope )})
276
276
if err != nil {
277
- t .Fatalf ("New () = %v, %v" , tp , err )
277
+ t .Fatalf ("NewWithContext () = %v, %v" , tp , err )
278
278
}
279
279
if count == 0 {
280
280
t .Errorf ("failed to call TLS localhost server" )
0 commit comments