Browse code

TestCgroupNamespacesRunOlderClient: support cgroup v2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

Akihiro Suda authored on 2021/01/22 16:17:05
Showing 1 changed files
... ...
@@ -130,7 +130,7 @@ func TestCgroupNamespacesRunInvalidMode(t *testing.T) {
130 130
 }
131 131
 
132 132
 // Clients before 1.40 expect containers to be created in the host cgroup namespace,
133
-// regardless of the default setting of the daemon
133
+// regardless of the default setting of the daemon, unless running with cgroup v2
134 134
 func TestCgroupNamespacesRunOlderClient(t *testing.T) {
135 135
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
136 136
 	skip.If(t, testEnv.IsRemoteDaemon())
... ...
@@ -148,5 +148,9 @@ func TestCgroupNamespacesRunOlderClient(t *testing.T) {
148 148
 
149 149
 	daemonCgroup := d.CgroupNamespace(t)
150 150
 	containerCgroup := containerCgroupNamespace(ctx, t, client, cID)
151
-	assert.Assert(t, daemonCgroup == containerCgroup)
151
+	if testEnv.DaemonInfo.CgroupVersion != "2" {
152
+		assert.Assert(t, daemonCgroup == containerCgroup)
153
+	} else {
154
+		assert.Assert(t, daemonCgroup != containerCgroup)
155
+	}
152 156
 }