Skip to content

Commit d697725

Browse files
committed
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 <[email protected]>
1 parent 1aeefd9 commit d697725

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libcontainer/cgroups/devices/v1_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
1010
"github.com/opencontainers/runc/libcontainer/configs"
1111
"github.com/opencontainers/runc/libcontainer/devices"
12+
"github.com/opencontainers/runc/libcontainer/userns"
1213
)
1314

1415
func init() {
@@ -17,6 +18,9 @@ func init() {
1718
}
1819

1920
func TestSetV1Allow(t *testing.T) {
21+
if userns.RunningInUserNS() {
22+
t.Skip("userns detected; setV1 does nothing")
23+
}
2024
dir := t.TempDir()
2125

2226
for file, contents := range map[string]string{

0 commit comments

Comments
 (0)