Skip to content

Commit 5a8579a

Browse files
committed
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 <[email protected]>
1 parent 3516bc6 commit 5a8579a

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

pkg/kubelet/userns/userns_manager_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,3 @@ func TestMakeUserNsManagerFailsListPod(t *testing.T) {
378378
assert.Error(t, err)
379379
assert.ErrorContains(t, err, "read pods from disk")
380380
}
381-
382-
func TestMakeUserNsManagerFailsPodRecord(t *testing.T) {
383-
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.UserNamespacesSupport, true)()
384-
385-
testUserNsPodsManager := &testUserNsPodsManager{
386-
podList: []types.UID{"pod-1", "pod-2"},
387-
podDir: t.TempDir(),
388-
}
389-
390-
// Remove read/execute permissions from this directory.
391-
if err := os.Chmod(testUserNsPodsManager.podDir, 0222); err != nil {
392-
t.Fatal(err)
393-
}
394-
395-
_, err := MakeUserNsManager(testUserNsPodsManager)
396-
assert.Error(t, err)
397-
assert.ErrorContains(t, err, "record pod mappings")
398-
}

0 commit comments

Comments
 (0)