diff --git a/pkg/kubelet/sysctl/allowlist_test.go b/pkg/kubelet/sysctl/allowlist_test.go index cc1a1558317..bbdc30209b0 100644 --- a/pkg/kubelet/sysctl/allowlist_test.go +++ b/pkg/kubelet/sysctl/allowlist_test.go @@ -81,9 +81,7 @@ func TestAllowlist(t *testing.T) { if err := w.validateSysctl(test.sysctl, test.hostNet, test.hostIPC); err != nil { t.Errorf("expected to be allowlisted: %+v, got: %v", test, err) } - pod.Spec.HostNetwork = test.hostNet - pod.Spec.HostIPC = test.hostIPC - pod.Spec.SecurityContext.Sysctls = []v1.Sysctl{v1.Sysctl{test.sysctl, test.sysctl}} + pod.Spec.SecurityContext.Sysctls = []v1.Sysctl{{test.sysctl, test.sysctl}} status := w.Admit(attrs) if !status.Admit { t.Errorf("expected to be allowlisted: %+v, got: %+v", test, status) @@ -96,7 +94,7 @@ func TestAllowlist(t *testing.T) { } pod.Spec.HostNetwork = test.hostNet pod.Spec.HostIPC = test.hostIPC - pod.Spec.SecurityContext.Sysctls = []v1.Sysctl{v1.Sysctl{test.sysctl, test.sysctl}} + pod.Spec.SecurityContext.Sysctls = []v1.Sysctl{{test.sysctl, test.sysctl}} status := w.Admit(attrs) if status.Admit { t.Errorf("expected to be rejected: %+v", test) @@ -104,7 +102,7 @@ func TestAllowlist(t *testing.T) { } // test for: len(pod.Spec.SecurityContext.Sysctls) == 0 - pod.Spec.SecurityContext.Sysctls = nil + pod.Spec.SecurityContext.Sysctls = []v1.Sysctl{} status := w.Admit(attrs) if !status.Admit { t.Errorf("expected to be allowlisted,got %+v", status)