ammend tests to ensure feat gate is off when expected (beta: gate is always on)

This commit is contained in:
Khaled (Kal) Henidak 2021-02-10 20:13:36 +00:00
parent 3e56ddae67
commit 32b9e31c23
2 changed files with 18 additions and 0 deletions

View File

@ -1897,6 +1897,11 @@ func TestSetDefaultIPFamilies(t *testing.T) {
}
})
// TODO: @khenidak
// with BETA feature is always on. This ensure we test for gate on/off scenarios
// as we move to stable this entire test will need to be folded into one test
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, false)()
// run without gate (families should not change)
t.Run(fmt.Sprintf("without-gate:%s", test.name), func(t *testing.T) {
obj2 := roundTrip(t, runtime.Object(&test.svc))
@ -2039,6 +2044,10 @@ func TestSetDefaultServiceIPFamilyPolicy(t *testing.T) {
// without gate. IPFamilyPolicy should never change
t.Run(test.name, func(t *testing.T) {
//TODO: @khenidak
// BETA feature. gate is on. when we go stable fold the test into one scenario
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, false)()
obj2 := roundTrip(t, runtime.Object(&test.svc))
svc2 := obj2.(*v1.Service)

View File

@ -183,6 +183,15 @@ func TestCNIPlugin(t *testing.T) {
},
}, cmd, args...)
},
func(cmd string, args ...string) exec.Cmd {
return fakeexec.InitFakeCmd(&fakeexec.FakeCmd{
CombinedOutputScript: []fakeexec.FakeAction{
func() ([]byte, []byte, error) {
return []byte(podIPOutput), nil, nil
},
},
}, cmd, args...)
},
}
fexec := &fakeexec.FakeExec{