@@ -61,9 +61,6 @@ func TestRunCgroupV2(t *testing.T) {
6161 if ! info .SwapLimit {
6262 t .Skip ("test requires SwapLimit" )
6363 }
64- if ! info .CPUShares {
65- t .Skip ("test requires CPUShares" )
66- }
6764 if ! info .CPUSet {
6865 t .Skip ("test requires CPUSet" )
6966 }
@@ -74,7 +71,6 @@ func TestRunCgroupV2(t *testing.T) {
747144040192
757244040192
767342
77- 77
78740-1
79750
8076`
@@ -83,34 +79,32 @@ func TestRunCgroupV2(t *testing.T) {
837960817408
84806291456
858142
86- 77
87820-1
88830
8984`
9085
91- // In CgroupV2 CPUWeight replace CPUShares => weight := 1 + ((shares-2)*9999)/262142
9286 base .Cmd ("run" , "--rm" ,
9387 "--cpus" , "0.42" , "--cpuset-mems" , "0" ,
9488 "--memory" , "42m" ,
9589 "--pids-limit" , "42" ,
96- "--cpu-shares" , "2000" , "-- cpuset-cpus" , "0-1" ,
90+ "--cpuset-cpus" , "0-1" ,
9791 "-w" , "/sys/fs/cgroup" , testutil .AlpineImage ,
9892 "cat" , "cpu.max" , "memory.max" , "memory.swap.max" ,
99- "pids.max" , "cpu.weight" , " cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected1 )
93+ "pids.max" , "cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected1 )
10094 base .Cmd ("run" , "--rm" ,
10195 "--cpu-quota" , "42000" , "--cpuset-mems" , "0" ,
10296 "--cpu-period" , "100000" , "--memory" , "42m" , "--memory-reservation" , "6m" , "--memory-swap" , "100m" ,
103- "--pids-limit" , "42" , "--cpu-shares" , "2000" , "-- cpuset-cpus" , "0-1" ,
97+ "--pids-limit" , "42" , "--cpuset-cpus" , "0-1" ,
10498 "-w" , "/sys/fs/cgroup" , testutil .AlpineImage ,
10599 "cat" , "cpu.max" , "memory.max" , "memory.swap.max" , "memory.low" , "pids.max" ,
106- "cpu.weight" , " cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected2 )
100+ "cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected2 )
107101
108102 base .Cmd ("run" , "--name" , testutil .Identifier (t )+ "-testUpdate1" , "-w" , "/sys/fs/cgroup" , "-d" ,
109103 testutil .AlpineImage , "sleep" , nerdtest .Infinity ).AssertOK ()
110104 defer base .Cmd ("rm" , "-f" , testutil .Identifier (t )+ "-testUpdate1" ).Run ()
111105 update := []string {"update" , "--cpu-quota" , "42000" , "--cpuset-mems" , "0" , "--cpu-period" , "100000" ,
112106 "--memory" , "42m" ,
113- "--pids-limit" , "42" , "--cpu-shares" , "2000" , "-- cpuset-cpus" , "0-1" }
107+ "--pids-limit" , "42" , "--cpuset-cpus" , "0-1" }
114108 if nerdtest .IsDocker () && info .CgroupVersion == "2" && info .SwapLimit {
115109 // Workaround for Docker with cgroup v2:
116110 // > Error response from daemon: Cannot update container 67c13276a13dd6a091cdfdebb355aa4e1ecb15fbf39c2b5c9abee89053e88fce:
@@ -121,7 +115,7 @@ func TestRunCgroupV2(t *testing.T) {
121115 base .Cmd (update ... ).AssertOK ()
122116 base .Cmd ("exec" , testutil .Identifier (t )+ "-testUpdate1" ,
123117 "cat" , "cpu.max" , "memory.max" , "memory.swap.max" ,
124- "pids.max" , "cpu.weight" , " cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected1 )
118+ "pids.max" , "cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected1 )
125119
126120 defer base .Cmd ("rm" , "-f" , testutil .Identifier (t )+ "-testUpdate2" ).Run ()
127121 base .Cmd ("run" , "--name" , testutil .Identifier (t )+ "-testUpdate2" , "-w" , "/sys/fs/cgroup" , "-d" ,
@@ -130,11 +124,11 @@ func TestRunCgroupV2(t *testing.T) {
130124
131125 base .Cmd ("update" , "--cpu-quota" , "42000" , "--cpuset-mems" , "0" , "--cpu-period" , "100000" ,
132126 "--memory" , "42m" , "--memory-reservation" , "6m" , "--memory-swap" , "100m" ,
133- "--pids-limit" , "42" , "--cpu-shares" , "2000" , "-- cpuset-cpus" , "0-1" ,
127+ "--pids-limit" , "42" , "--cpuset-cpus" , "0-1" ,
134128 testutil .Identifier (t )+ "-testUpdate2" ).AssertOK ()
135129 base .Cmd ("exec" , testutil .Identifier (t )+ "-testUpdate2" ,
136130 "cat" , "cpu.max" , "memory.max" , "memory.swap.max" , "memory.low" ,
137- "pids.max" , "cpu.weight" , " cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected2 )
131+ "pids.max" , "cpuset.cpus" , "cpuset.mems" ).AssertOutExactly (expected2 )
138132 base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=true" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertOK ()
139133 base .Cmd ("run" , "--rm" , "--security-opt" , "writable-cgroups=false" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertFail ()
140134 base .Cmd ("run" , "--rm" , testutil .AlpineImage , "mkdir" , "/sys/fs/cgroup/foo" ).AssertFail ()
0 commit comments