@@ -61,7 +61,7 @@ func testIPTablesVersionCmds(t *testing.T, protocol Protocol) {
61
61
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
62
62
},
63
63
}
64
- _ = New (fexec , protocol )
64
+ _ = newInternal (fexec , protocol , "" , "" )
65
65
66
66
// Check that proper iptables version command was used during runner instantiation
67
67
if ! sets .New (fcmd .CombinedOutputLog [0 ]... ).HasAll (iptablesCmd , "--version" ) {
@@ -103,7 +103,7 @@ func testEnsureChain(t *testing.T, protocol Protocol) {
103
103
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
104
104
},
105
105
}
106
- runner := New (fexec , protocol )
106
+ runner := newInternal (fexec , protocol , "" , "" )
107
107
// Success.
108
108
exists , err := runner .EnsureChain (TableNAT , Chain ("FOOBAR" ))
109
109
if err != nil {
@@ -160,7 +160,7 @@ func TestFlushChain(t *testing.T) {
160
160
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
161
161
},
162
162
}
163
- runner := New (fexec , ProtocolIPv4 )
163
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
164
164
// Success.
165
165
err := runner .FlushChain (TableNAT , Chain ("FOOBAR" ))
166
166
if err != nil {
@@ -197,7 +197,7 @@ func TestDeleteChain(t *testing.T) {
197
197
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
198
198
},
199
199
}
200
- runner := New (fexec , ProtocolIPv4 )
200
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
201
201
// Success.
202
202
err := runner .DeleteChain (TableNAT , Chain ("FOOBAR" ))
203
203
if err != nil {
@@ -233,7 +233,7 @@ func TestEnsureRuleAlreadyExists(t *testing.T) {
233
233
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
234
234
},
235
235
}
236
- runner := New (fexec , ProtocolIPv4 )
236
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
237
237
exists , err := runner .EnsureRule (Append , TableNAT , ChainOutput , "abc" , "123" )
238
238
if err != nil {
239
239
t .Errorf ("expected success, got %v" , err )
@@ -269,7 +269,7 @@ func TestEnsureRuleNew(t *testing.T) {
269
269
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
270
270
},
271
271
}
272
- runner := New (fexec , ProtocolIPv4 )
272
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
273
273
exists , err := runner .EnsureRule (Append , TableNAT , ChainOutput , "abc" , "123" )
274
274
if err != nil {
275
275
t .Errorf ("expected success, got %v" , err )
@@ -302,7 +302,7 @@ func TestEnsureRuleErrorChecking(t *testing.T) {
302
302
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
303
303
},
304
304
}
305
- runner := New (fexec , ProtocolIPv4 )
305
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
306
306
_ , err := runner .EnsureRule (Append , TableNAT , ChainOutput , "abc" , "123" )
307
307
if err == nil {
308
308
t .Errorf ("expected failure" )
@@ -332,7 +332,7 @@ func TestEnsureRuleErrorCreating(t *testing.T) {
332
332
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
333
333
},
334
334
}
335
- runner := New (fexec , ProtocolIPv4 )
335
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
336
336
_ , err := runner .EnsureRule (Append , TableNAT , ChainOutput , "abc" , "123" )
337
337
if err == nil {
338
338
t .Errorf ("expected failure" )
@@ -359,7 +359,7 @@ func TestDeleteRuleDoesNotExist(t *testing.T) {
359
359
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
360
360
},
361
361
}
362
- runner := New (fexec , ProtocolIPv4 )
362
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
363
363
err := runner .DeleteRule (TableNAT , ChainOutput , "abc" , "123" )
364
364
if err != nil {
365
365
t .Errorf ("expected success, got %v" , err )
@@ -392,7 +392,7 @@ func TestDeleteRuleExists(t *testing.T) {
392
392
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
393
393
},
394
394
}
395
- runner := New (fexec , ProtocolIPv4 )
395
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
396
396
err := runner .DeleteRule (TableNAT , ChainOutput , "abc" , "123" )
397
397
if err != nil {
398
398
t .Errorf ("expected success, got %v" , err )
@@ -422,7 +422,7 @@ func TestDeleteRuleErrorChecking(t *testing.T) {
422
422
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
423
423
},
424
424
}
425
- runner := New (fexec , ProtocolIPv4 )
425
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
426
426
err := runner .DeleteRule (TableNAT , ChainOutput , "abc" , "123" )
427
427
if err == nil {
428
428
t .Errorf ("expected failure" )
@@ -452,7 +452,7 @@ func TestDeleteRuleErrorDeleting(t *testing.T) {
452
452
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
453
453
},
454
454
}
455
- runner := New (fexec , ProtocolIPv4 )
455
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
456
456
err := runner .DeleteRule (TableNAT , ChainOutput , "abc" , "123" )
457
457
if err == nil {
458
458
t .Errorf ("expected failure" )
@@ -487,7 +487,7 @@ func TestGetIPTablesHasCheckCommand(t *testing.T) {
487
487
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
488
488
},
489
489
}
490
- ipt := New (fexec , ProtocolIPv4 )
490
+ ipt := newInternal (fexec , ProtocolIPv4 , "" , "" )
491
491
runner := ipt .(* runner )
492
492
if testCase .Expected != runner .hasCheck {
493
493
t .Errorf ("Expected result: %v, Got result: %v" , testCase .Expected , runner .hasCheck )
@@ -648,7 +648,7 @@ func TestWaitFlagUnavailable(t *testing.T) {
648
648
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
649
649
},
650
650
}
651
- runner := New (fexec , ProtocolIPv4 )
651
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
652
652
err := runner .DeleteChain (TableNAT , Chain ("FOOBAR" ))
653
653
if err != nil {
654
654
t .Errorf ("expected success, got %v" , err )
@@ -679,7 +679,7 @@ func TestWaitFlagOld(t *testing.T) {
679
679
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
680
680
},
681
681
}
682
- runner := New (fexec , ProtocolIPv4 )
682
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
683
683
err := runner .DeleteChain (TableNAT , Chain ("FOOBAR" ))
684
684
if err != nil {
685
685
t .Errorf ("expected success, got %v" , err )
@@ -713,7 +713,7 @@ func TestWaitFlagNew(t *testing.T) {
713
713
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
714
714
},
715
715
}
716
- runner := New (fexec , ProtocolIPv4 )
716
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
717
717
err := runner .DeleteChain (TableNAT , Chain ("FOOBAR" ))
718
718
if err != nil {
719
719
t .Errorf ("expected success, got %v" , err )
@@ -744,7 +744,7 @@ func TestWaitIntervalFlagNew(t *testing.T) {
744
744
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
745
745
},
746
746
}
747
- runner := New (fexec , ProtocolIPv4 )
747
+ runner := newInternal (fexec , ProtocolIPv4 , "" , "" )
748
748
err := runner .DeleteChain (TableNAT , Chain ("FOOBAR" ))
749
749
if err != nil {
750
750
t .Errorf ("expected success, got %v" , err )
@@ -789,7 +789,7 @@ COMMIT
789
789
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
790
790
},
791
791
}
792
- runner := New (fexec , protocol )
792
+ runner := newInternal (fexec , protocol , "" , "" )
793
793
buffer := bytes .NewBuffer (nil )
794
794
795
795
// Success.
@@ -857,7 +857,7 @@ func testRestore(t *testing.T, protocol Protocol) {
857
857
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
858
858
},
859
859
}
860
- runner := New (fexec , protocol )
860
+ runner := newInternal (fexec , protocol , "" , "" )
861
861
862
862
// both flags true
863
863
err := runner .Restore (TableNAT , []byte {}, FlushTables , RestoreCounters )
0 commit comments