From ed492661bbcf2e93e8d58148c3dae9913f6d81da Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Tue, 5 Nov 2013 19:29:55 -0600 Subject: [PATCH 1/6] test: put each arg in a separate string Each arg to docker run should be placed in a separate string. Otherwise, when starting the command via exec.Cmd, the command is interpreted as "echo test", which can't be found. Upstream-commit: 30ea0bebce340dfc257b5b45835234cb921f3a48 Component: engine --- components/engine/integration/server_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/integration/server_test.go b/components/engine/integration/server_test.go index 6c61bedafb..b19c2e1a91 100644 --- a/components/engine/integration/server_test.go +++ b/components/engine/integration/server_test.go @@ -109,7 +109,7 @@ func TestCreateRmVolumes(t *testing.T) { srv := mkServerFromEngine(eng, t) defer mkRuntimeFromEngine(eng, t).Nuke() - config, hostConfig, _, err := docker.ParseRun([]string{"-v", "/srv", unitTestImageID, "echo test"}, nil) + config, hostConfig, _, err := docker.ParseRun([]string{"-v", "/srv", unitTestImageID, "echo", "test"}, nil) if err != nil { t.Fatal(err) } @@ -240,7 +240,7 @@ func TestRmi(t *testing.T) { t.Fatal(err) } - config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "echo test"}, nil) + config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "echo", "test"}, nil) if err != nil { t.Fatal(err) } From 4527e7358654d6328968731b2590e8fc761bc4a0 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Mon, 11 Nov 2013 21:57:29 -0600 Subject: [PATCH 2/6] test: fix TestCreateStartRestartStopStartKillRm cat needs stdin opened, otherwise it dies immediately. Upstream-commit: baa687bed2f1f9ee6e44c70d95baad8757ac529c Component: engine --- components/engine/integration/server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/integration/server_test.go b/components/engine/integration/server_test.go index b19c2e1a91..8cd3e30fdf 100644 --- a/components/engine/integration/server_test.go +++ b/components/engine/integration/server_test.go @@ -164,7 +164,7 @@ func TestCreateStartRestartStopStartKillRm(t *testing.T) { srv := mkServerFromEngine(eng, t) defer mkRuntimeFromEngine(eng, t).Nuke() - config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "/bin/cat"}, nil) + config, hostConfig, _, err := docker.ParseRun([]string{"-i", unitTestImageID, "/bin/cat"}, nil) if err != nil { t.Fatal(err) } From b0f8db9d1bc9eb3c5ff3e21ac60cb390d0939d5d Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Wed, 6 Nov 2013 09:57:43 -0600 Subject: [PATCH 3/6] test: skip TestCreate on Fedora due to lxc utils bug In the dind environment running on a Fedora host, the lxc utils get confused by the /sys/fs/cgroup/cpuacct,cpu cgroup mount and lxc-start fails trying to access the wrong cgroup directory. Upstream-commit: 72d02ecdde2ba6f39739a0a942f2c4a057b4d45f Component: engine --- components/engine/integration/container_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/engine/integration/container_test.go b/components/engine/integration/container_test.go index 3658d9d4dc..b602488006 100644 --- a/components/engine/integration/container_test.go +++ b/components/engine/integration/container_test.go @@ -330,6 +330,11 @@ func TestCommitRun(t *testing.T) { } func TestStart(t *testing.T) { + _, err1 := os.Stat("/sys/fs/cgroup/cpuacct,cpu") + _, err2 := os.Stat("/sys/fs/cgroup/cpu,cpuacct") + if err1 == nil || err2 == nil { + t.Skip("Fixme. Setting cpu cgroup shares doesn't work in dind on a Fedora host. The lxc utils are confused by the cpu,cpuacct mount.") + } runtime := mkRuntime(t) defer nuke(runtime) container, _, _ := mkContainer(runtime, []string{"-m", "33554432", "-c", "1000", "-i", "_", "/bin/cat"}, t) From 0c60a3c3a04a043e19532746281bc35168c6d6d1 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Tue, 12 Nov 2013 14:16:51 -0600 Subject: [PATCH 4/6] test: 2 second timeout (not 2000) Upstream-commit: fe302fbfd26fc7db5d751d4bec8a0bd4ce6030a4 Component: engine --- components/engine/integration/commands_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/integration/commands_test.go b/components/engine/integration/commands_test.go index ab186f4a2c..440d8e5469 100644 --- a/components/engine/integration/commands_test.go +++ b/components/engine/integration/commands_test.go @@ -329,7 +329,7 @@ func TestRunDisconnectTty(t *testing.T) { // Client disconnect after run -i should keep stdin out in TTY mode container := globalRuntime.List()[0] - setTimeout(t, "Read/Write assertion timed out", 2000*time.Second, func() { + setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() { if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil { t.Fatal(err) } From ef3400502cdcaa9709392e38d42131a203a29564 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Tue, 12 Nov 2013 10:21:02 -0600 Subject: [PATCH 5/6] test: fix TestRmi race condition Upstream-commit: fef41ef7bf83ed04c7df8e0247e60c0d495eefdc Component: engine --- components/engine/integration/server_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/engine/integration/server_test.go b/components/engine/integration/server_test.go index 8cd3e30fdf..494e23fef3 100644 --- a/components/engine/integration/server_test.go +++ b/components/engine/integration/server_test.go @@ -256,6 +256,10 @@ func TestRmi(t *testing.T) { t.Fatal(err) } + if _, err := srv.ContainerWait(containerID); err != nil { + t.Fatal(err) + } + imageID, err := srv.ContainerCommit(containerID, "test", "", "", "", nil) if err != nil { t.Fatal(err) @@ -277,6 +281,10 @@ func TestRmi(t *testing.T) { t.Fatal(err) } + if _, err := srv.ContainerWait(containerID); err != nil { + t.Fatal(err) + } + _, err = srv.ContainerCommit(containerID, "test", "", "", "", nil) if err != nil { t.Fatal(err) From c4cad6571f72603b5b68a7326c3db0082301265c Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 8 Nov 2013 11:08:18 -0600 Subject: [PATCH 6/6] test: remove extra args in TestExitCode The extra blank argument isn't needed and confuses libvirt. Upstream-commit: 4b80ec9aae2f43e831de64f3746c7838252e9203 Component: engine --- components/engine/integration/container_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/integration/container_test.go b/components/engine/integration/container_test.go index b602488006..a8c21ef1ea 100644 --- a/components/engine/integration/container_test.go +++ b/components/engine/integration/container_test.go @@ -568,7 +568,7 @@ func TestExitCode(t *testing.T) { trueContainer, _, err := runtime.Create(&docker.Config{ Image: GetTestImage(runtime).ID, - Cmd: []string{"/bin/true", ""}, + Cmd: []string{"/bin/true"}, }, "") if err != nil { t.Fatal(err) @@ -583,7 +583,7 @@ func TestExitCode(t *testing.T) { falseContainer, _, err := runtime.Create(&docker.Config{ Image: GetTestImage(runtime).ID, - Cmd: []string{"/bin/false", ""}, + Cmd: []string{"/bin/false"}, }, "") if err != nil { t.Fatal(err)