@@ -134,7 +134,9 @@ func TestRunCgroupV2(t *testing.T) {
134134 base .Cmd ("exec" , testutil .Identifier (t )+ "-testUpdate2" ,
135135 "cat" , "cpu.max" , "memory.max" , "memory.swap.max" , "memory.low" ,
136136 "pids.max" , "cpu.weight" , "cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected2 )
137-
137+ base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=true" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertOK ()
138+ base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=false" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertFail ()
139+ base .Cmd ("run" , "--rm" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertFail ()
138140}
139141
140142func TestRunCgroupV1 (t * testing.T ) {
@@ -176,6 +178,9 @@ func TestRunCgroupV1(t *testing.T) {
176178 const expected = "42000\n 100000\n 0\n 44040192\n 6291456\n 104857600\n 0\n 42\n 2000\n 0-1\n "
177179 base .Cmd ("run" , "--rm" , "--cpus" , "0.42" , "--cpuset-mems" , "0" , "--memory" , "42m" , "--memory-reservation" , "6m" , "--memory-swap" , "100m" , "--memory-swappiness" , "0" , "--pids-limit" , "42" , "--cpu-shares" , "2000" , "--cpuset-cpus" , "0-1" , testutil .AlpineImage , "cat" , quota , period , cpusetMems , memoryLimit , memoryReservation , memorySwap , memorySwappiness , pidsLimit , cpuShare , cpusetCpus ).AssertOutExactly (expected )
178180 base .Cmd ("run" , "--rm" , "--cpu-quota" , "42000" , "--cpu-period" , "100000" , "--cpuset-mems" , "0" , "--memory" , "42m" , "--memory-reservation" , "6m" , "--memory-swap" , "100m" , "--memory-swappiness" , "0" , "--pids-limit" , "42" , "--cpu-shares" , "2000" , "--cpuset-cpus" , "0-1" , testutil .AlpineImage , "cat" , quota , period , cpusetMems , memoryLimit , memoryReservation , memorySwap , memorySwappiness , pidsLimit , cpuShare , cpusetCpus ).AssertOutExactly (expected )
181+ base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=true" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/pids/foo" ).AssertOK ()
182+ base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=false" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/pids/foo" ).AssertFail ()
183+ base .Cmd ("run" , "--rm" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/pids/foo" ).AssertFail ()
179184}
180185
181186// TestIssue3781 tests https://github.com/containerd/nerdctl/issues/3781
0 commit comments