@@ -28,6 +28,10 @@ import (
28
28
fakeexec "k8s.io/utils/exec/testing"
29
29
)
30
30
31
+ func newInternal (fexec * fakeexec.FakeExec ) Interface {
32
+ return & runner {fexec }
33
+ }
34
+
31
35
func TestCheckIPSetVersion (t * testing.T ) {
32
36
testCases := []struct {
33
37
vstring string
@@ -83,7 +87,7 @@ func TestFlushSet(t *testing.T) {
83
87
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
84
88
},
85
89
}
86
- runner := New (fexec )
90
+ runner := newInternal (fexec )
87
91
// Success.
88
92
err := runner .FlushSet ("FOOBAR" )
89
93
if err != nil {
@@ -119,7 +123,7 @@ func TestDestroySet(t *testing.T) {
119
123
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
120
124
},
121
125
}
122
- runner := New (fexec )
126
+ runner := newInternal (fexec )
123
127
// Success
124
128
err := runner .DestroySet ("FOOBAR" )
125
129
if err != nil {
@@ -153,7 +157,7 @@ func TestDestroyAllSets(t *testing.T) {
153
157
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
154
158
},
155
159
}
156
- runner := New (fexec )
160
+ runner := newInternal (fexec )
157
161
// Success
158
162
err := runner .DestroyAllSets ()
159
163
if err != nil {
@@ -198,7 +202,7 @@ func TestCreateSet(t *testing.T) {
198
202
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
199
203
},
200
204
}
201
- runner := New (fexec )
205
+ runner := newInternal (fexec )
202
206
// Create with ignoreExistErr = false, expect success
203
207
err := runner .CreateSet (& testSet , false )
204
208
if err != nil {
@@ -388,7 +392,7 @@ func TestAddEntry(t *testing.T) {
388
392
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
389
393
},
390
394
}
391
- runner := New (fexec )
395
+ runner := newInternal (fexec )
392
396
// Create with ignoreExistErr = false, expect success
393
397
err := runner .AddEntry (testCases [i ].entry .String (), testCases [i ].set , false )
394
398
if err != nil {
@@ -437,7 +441,7 @@ func TestDelEntry(t *testing.T) {
437
441
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
438
442
},
439
443
}
440
- runner := New (fexec )
444
+ runner := newInternal (fexec )
441
445
442
446
err := runner .DelEntry (testCases [i ].entry .String (), testCases [i ].set .Name )
443
447
if err != nil {
@@ -482,7 +486,7 @@ func TestTestEntry(t *testing.T) {
482
486
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
483
487
},
484
488
}
485
- runner := New (fexec )
489
+ runner := newInternal (fexec )
486
490
// Success
487
491
ok , err := runner .TestEntry (testEntry .String (), setName )
488
492
if err != nil {
@@ -530,7 +534,7 @@ func TestTestEntryIPv6(t *testing.T) {
530
534
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
531
535
},
532
536
}
533
- runner := New (fexec )
537
+ runner := newInternal (fexec )
534
538
// Success
535
539
ok , err := runner .TestEntry (testEntry .String (), setName )
536
540
if err != nil {
@@ -604,7 +608,7 @@ Members:
604
608
},
605
609
},
606
610
}
607
- runner := New (fexec )
611
+ runner := newInternal (fexec )
608
612
// Success
609
613
entries , err := runner .ListEntries ("foobar" )
610
614
if err != nil {
643
647
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
644
648
},
645
649
}
646
- runner := New (fexec )
650
+ runner := newInternal (fexec )
647
651
// Success
648
652
list , err := runner .ListSets ()
649
653
if err != nil {
0 commit comments