From d697725a4d36f43c487c25eb02b2f843a4c0d4cd Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 30 May 2024 10:18:54 -0700 Subject: [PATCH] libct/cg/dev: fix TestSetV1Allow panic This test panics if userns is detected (such as when run in a rootless docker container) because SetV1 does nothing in this case. We could fix the panic, but it doesn't make sense to run the test at all. Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/devices/v1_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcontainer/cgroups/devices/v1_test.go b/libcontainer/cgroups/devices/v1_test.go index 1d1c4c3770a..aed1024b2ef 100644 --- a/libcontainer/cgroups/devices/v1_test.go +++ b/libcontainer/cgroups/devices/v1_test.go @@ -9,6 +9,7 @@ import ( "github.com/opencontainers/runc/libcontainer/cgroups/fscommon" "github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/devices" + "github.com/opencontainers/runc/libcontainer/userns" ) func init() { @@ -17,6 +18,9 @@ func init() { } func TestSetV1Allow(t *testing.T) { + if userns.RunningInUserNS() { + t.Skip("userns detected; setV1 does nothing") + } dir := t.TempDir() for file, contents := range map[string]string{