From 5a8579a3e4066f262b6c77a3fa97a8ddd475dd96 Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Mon, 19 Feb 2024 14:44:34 -0300 Subject: [PATCH] kubelet/userns: Remove tests that fail as root For some reason the CI didn't fail when we open the PR. But when you run "go test" as root, with all the capabilities, tests that exercise permission errors will never work. As the capabilities makes them always bypass the permission checks. For some reason it seems that: * Not all our CI was run when the PR was open * The CI was changed to run as root now * _Some_ CI was added and it runs as root If it wasn't one of that, or a combination, I don't see how this could have happened. If any of that indeed happened, it can break more tests outside the userns package too. Signed-off-by: Rodrigo Campos --- pkg/kubelet/userns/userns_manager_test.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/pkg/kubelet/userns/userns_manager_test.go b/pkg/kubelet/userns/userns_manager_test.go index cf23967405d..6d2d9d6f1f6 100644 --- a/pkg/kubelet/userns/userns_manager_test.go +++ b/pkg/kubelet/userns/userns_manager_test.go @@ -378,21 +378,3 @@ func TestMakeUserNsManagerFailsListPod(t *testing.T) { assert.Error(t, err) assert.ErrorContains(t, err, "read pods from disk") } - -func TestMakeUserNsManagerFailsPodRecord(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.UserNamespacesSupport, true)() - - testUserNsPodsManager := &testUserNsPodsManager{ - podList: []types.UID{"pod-1", "pod-2"}, - podDir: t.TempDir(), - } - - // Remove read/execute permissions from this directory. - if err := os.Chmod(testUserNsPodsManager.podDir, 0222); err != nil { - t.Fatal(err) - } - - _, err := MakeUserNsManager(testUserNsPodsManager) - assert.Error(t, err) - assert.ErrorContains(t, err, "record pod mappings") -}