From 30ea0bebce340dfc257b5b45835234cb921f3a48 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. --- integration/server_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/server_test.go b/integration/server_test.go index 6c61bedaf..b19c2e1a9 100644 --- a/integration/server_test.go +++ b/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 baa687bed2f1f9ee6e44c70d95baad8757ac529c 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. --- integration/server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/server_test.go b/integration/server_test.go index b19c2e1a9..8cd3e30fd 100644 --- a/integration/server_test.go +++ b/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 72d02ecdde2ba6f39739a0a942f2c4a057b4d45f 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. --- integration/container_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/integration/container_test.go b/integration/container_test.go index 3658d9d4d..b60248800 100644 --- a/integration/container_test.go +++ b/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 fe302fbfd26fc7db5d751d4bec8a0bd4ce6030a4 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) --- integration/commands_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/commands_test.go b/integration/commands_test.go index ab186f4a2..440d8e546 100644 --- a/integration/commands_test.go +++ b/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 fef41ef7bf83ed04c7df8e0247e60c0d495eefdc 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 --- integration/server_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/integration/server_test.go b/integration/server_test.go index 8cd3e30fd..494e23fef 100644 --- a/integration/server_test.go +++ b/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 4b80ec9aae2f43e831de64f3746c7838252e9203 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. --- integration/container_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/container_test.go b/integration/container_test.go index b60248800..a8c21ef1e 100644 --- a/integration/container_test.go +++ b/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)