From 123ebf905367f1da0d9480153d08912d58b721fc Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 14 Mar 2014 18:16:14 +0000 Subject: [PATCH] update TestCreateRmRunning Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- integration/server_test.go | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/integration/server_test.go b/integration/server_test.go index 54ee9a77a9..d5abff264e 100644 --- a/integration/server_test.go +++ b/integration/server_test.go @@ -210,8 +210,15 @@ func TestCreateRmRunning(t *testing.T) { id := createTestContainer(eng, config, t) - job := eng.Job("containers") - job.SetenvBool("all", true) + job := eng.Job("start", id) + if err := job.ImportEnv(hostConfig); err != nil { + t.Fatal(err) + } + if err := job.Run(); err != nil { + t.Fatal(err) + } + + job = eng.Job("containers") outs, err := job.Stdout.AddListTable() if err != nil { t.Fatal(err) @@ -224,19 +231,24 @@ func TestCreateRmRunning(t *testing.T) { t.Errorf("Expected 1 container, %v found", len(outs.Data)) } - job = eng.Job("start", id) - if err := job.ImportEnv(hostConfig); err != nil { + // Test cannot remove running container + job = eng.Job("container_delete", id) + job.SetenvBool("forceRemove", false) + if err := job.Run(); err == nil { + t.Fatal("Expected container delete to fail") + } + + job = eng.Job("containers") + outs, err = job.Stdout.AddListTable() + if err != nil { t.Fatal(err) } if err := job.Run(); err != nil { t.Fatal(err) } - // Test cannot remove running container - job = eng.Job("container_delete", id) - job.SetenvBool("forceRemove", false) - if err := job.Run(); err == nil { - t.Fatal("Expected container delete to fail") + if len(outs.Data) != 1 { + t.Errorf("Expected 1 container, %v found", len(outs.Data)) } // Test can force removal of running container