@@ -17,6 +17,8 @@ limitations under the License.
17
17
package rest
18
18
19
19
import (
20
+ "context"
21
+ "errors"
20
22
"io"
21
23
"net"
22
24
"net/http"
@@ -25,8 +27,6 @@ import (
25
27
"strings"
26
28
"testing"
27
29
28
- fuzz "github.com/google/gofuzz"
29
-
30
30
"k8s.io/api/core/v1"
31
31
"k8s.io/apimachinery/pkg/runtime"
32
32
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -35,8 +35,7 @@ import (
35
35
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
36
36
"k8s.io/client-go/util/flowcontrol"
37
37
38
- "errors"
39
-
38
+ fuzz "github.com/google/gofuzz"
40
39
"github.com/stretchr/testify/assert"
41
40
)
42
41
@@ -208,7 +207,7 @@ func (n *fakeNegotiatedSerializer) DecoderToVersion(serializer runtime.Decoder,
208
207
return & fakeCodec {}
209
208
}
210
209
211
- var fakeDialFunc = func (network , addr string ) (net.Conn , error ) {
210
+ var fakeDialFunc = func (ctx context. Context , network , addr string ) (net.Conn , error ) {
212
211
return nil , fakeDialerError
213
212
}
214
213
var fakeDialerError = errors .New ("fakedialer" )
@@ -253,7 +252,7 @@ func TestAnonymousConfig(t *testing.T) {
253
252
r .Config = map [string ]string {}
254
253
},
255
254
// Dial does not require fuzzer
256
- func (r * func (network , addr string ) (net.Conn , error ), f fuzz.Continue ) {},
255
+ func (r * func (ctx context. Context , network , addr string ) (net.Conn , error ), f fuzz.Continue ) {},
257
256
)
258
257
for i := 0 ; i < 20 ; i ++ {
259
258
original := & Config {}
@@ -284,10 +283,10 @@ func TestAnonymousConfig(t *testing.T) {
284
283
expected .WrapTransport = nil
285
284
}
286
285
if actual .Dial != nil {
287
- _ , actualError := actual .Dial ("" , "" )
288
- _ , expectedError := actual .Dial ("" , "" )
286
+ _ , actualError := actual .Dial (context . Background (), "" , "" )
287
+ _ , expectedError := expected .Dial (context . Background (), "" , "" )
289
288
if ! reflect .DeepEqual (expectedError , actualError ) {
290
- t .Fatalf ("CopyConfig dropped the Dial field" )
289
+ t .Fatalf ("CopyConfig dropped the Dial field" )
291
290
}
292
291
} else {
293
292
actual .Dial = nil
@@ -329,7 +328,7 @@ func TestCopyConfig(t *testing.T) {
329
328
func (r * AuthProviderConfigPersister , f fuzz.Continue ) {
330
329
* r = fakeAuthProviderConfigPersister {}
331
330
},
332
- func (r * func (network , addr string ) (net.Conn , error ), f fuzz.Continue ) {
331
+ func (r * func (ctx context. Context , network , addr string ) (net.Conn , error ), f fuzz.Continue ) {
333
332
* r = fakeDialFunc
334
333
},
335
334
)
@@ -351,8 +350,8 @@ func TestCopyConfig(t *testing.T) {
351
350
expected .WrapTransport = nil
352
351
}
353
352
if actual .Dial != nil {
354
- _ , actualError := actual .Dial ("" , "" )
355
- _ , expectedError := actual .Dial ("" , "" )
353
+ _ , actualError := actual .Dial (context . Background (), "" , "" )
354
+ _ , expectedError := expected .Dial (context . Background (), "" , "" )
356
355
if ! reflect .DeepEqual (expectedError , actualError ) {
357
356
t .Fatalf ("CopyConfig dropped the Dial field" )
358
357
}
@@ -361,7 +360,7 @@ func TestCopyConfig(t *testing.T) {
361
360
expected .Dial = nil
362
361
if actual .AuthConfigPersister != nil {
363
362
actualError := actual .AuthConfigPersister .Persist (nil )
364
- expectedError := actual .AuthConfigPersister .Persist (nil )
363
+ expectedError := expected .AuthConfigPersister .Persist (nil )
365
364
if ! reflect .DeepEqual (expectedError , actualError ) {
366
365
t .Fatalf ("CopyConfig dropped the Dial field" )
367
366
}
0 commit comments