mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
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 <rodrigoca@microsoft.com>
This commit is contained in:
parent
3516bc6f49
commit
5a8579a3e4
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user