kublet/userns: Test new functionality with feature gate disabled

We just added some more functionality, let's make sure it works fine
with the feature gate disabled.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos 2024-02-16 13:38:36 -03:00 committed by Giuseppe Scrivano
parent 1fb1218f57
commit 658b45cd03
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772

View File

@ -49,6 +49,10 @@ func TestReleaseDisabled(t *testing.T) {
func TestGetOrCreateUserNamespaceMappingsDisabled(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.UserNamespacesSupport, false)()
trueVal := true
falseVal := false
tests := []struct {
name string
pod *v1.Pod
@ -59,6 +63,31 @@ func TestGetOrCreateUserNamespaceMappingsDisabled(t *testing.T) {
pod: nil,
success: true,
},
{
name: "hostUsers is nil",
pod: &v1.Pod{
Spec: v1.PodSpec{
HostUsers: nil,
},
},
success: true,
},
{
name: "hostUsers is true",
pod: &v1.Pod{
Spec: v1.PodSpec{
HostUsers: &trueVal,
},
},
},
{
name: "hostUsers is false",
pod: &v1.Pod{
Spec: v1.PodSpec{
HostUsers: &falseVal,
},
},
},
}
for _, test := range tests {