瀏覽代碼

TestCgroupNamespacesRunOlderClient: support cgroup v2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Akihiro Suda 4 年之前
父節點
當前提交
ec416c51b7
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      integration/container/run_cgroupns_linux_test.go

+ 6 - 2
integration/container/run_cgroupns_linux_test.go

@@ -130,7 +130,7 @@ func TestCgroupNamespacesRunInvalidMode(t *testing.T) {
 }
 }
 
 
 // Clients before 1.40 expect containers to be created in the host cgroup namespace,
 // Clients before 1.40 expect containers to be created in the host cgroup namespace,
-// regardless of the default setting of the daemon
+// regardless of the default setting of the daemon, unless running with cgroup v2
 func TestCgroupNamespacesRunOlderClient(t *testing.T) {
 func TestCgroupNamespacesRunOlderClient(t *testing.T) {
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
 	skip.If(t, testEnv.IsRemoteDaemon())
 	skip.If(t, testEnv.IsRemoteDaemon())
@@ -148,5 +148,9 @@ func TestCgroupNamespacesRunOlderClient(t *testing.T) {
 
 
 	daemonCgroup := d.CgroupNamespace(t)
 	daemonCgroup := d.CgroupNamespace(t)
 	containerCgroup := containerCgroupNamespace(ctx, t, client, cID)
 	containerCgroup := containerCgroupNamespace(ctx, t, client, cID)
-	assert.Assert(t, daemonCgroup == containerCgroup)
+	if testEnv.DaemonInfo.CgroupVersion != "2" {
+		assert.Assert(t, daemonCgroup == containerCgroup)
+	} else {
+		assert.Assert(t, daemonCgroup != containerCgroup)
+	}
 }
 }