From cda9cf1539b4e3ce24ce77892b1e68ddb454f566 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 4 Apr 2013 20:30:24 -0700 Subject: [PATCH 1/4] Avoid unwanted warnings from destroy() in TestStart() --- container_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/container_test.go b/container_test.go index 571a09376..00c2aa6c8 100644 --- a/container_test.go +++ b/container_test.go @@ -267,6 +267,8 @@ func TestStart(t *testing.T) { // Try to avoid the timeoout in destroy. Best effort, don't check error cStdin, _ := container.StdinPipe() cStdin.Close() + container.WaitTimeout(500 * time.Millisecond) + container.State.setStopped(0) } func TestRun(t *testing.T) { From bae6f9583060187116aa8a069d0e63abfede5de0 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 4 Apr 2013 20:32:44 -0700 Subject: [PATCH 2/4] Increase the timeout of TestRestore() to avoid unwanted timeout error --- runtime_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime_test.go b/runtime_test.go index 3cdcbe3b3..f76df953b 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -314,7 +314,7 @@ func TestRestore(t *testing.T) { // Simulate a crash/manual quit of dockerd: process dies, states stays 'Running' cStdin, _ := container2.StdinPipe() cStdin.Close() - if err := container2.WaitTimeout(time.Second); err != nil { + if err := container2.WaitTimeout(2 * time.Second); err != nil { t.Fatal(err) } container2.State.Running = true From b76b329ef05748e75224e8fd09c1c697ddfd2a50 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 4 Apr 2013 20:40:42 -0700 Subject: [PATCH 3/4] Prevent destroy() to stop twice container in TestRestore() --- runtime_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime_test.go b/runtime_test.go index f76df953b..355d222e0 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -358,4 +358,5 @@ func TestRestore(t *testing.T) { if err := container3.Run(); err != nil { t.Fatal(err) } + container2.State.Running = false } From 20085794f023e2e5cf7d772a67f9c3b2e3afc93f Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 5 Apr 2013 02:01:38 -0700 Subject: [PATCH 4/4] Increase the timeout in TestStart() to make sure the container has the time to die within the function --- container_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/container_test.go b/container_test.go index 00c2aa6c8..ac47f84bf 100644 --- a/container_test.go +++ b/container_test.go @@ -267,8 +267,7 @@ func TestStart(t *testing.T) { // Try to avoid the timeoout in destroy. Best effort, don't check error cStdin, _ := container.StdinPipe() cStdin.Close() - container.WaitTimeout(500 * time.Millisecond) - container.State.setStopped(0) + container.WaitTimeout(2 * time.Second) } func TestRun(t *testing.T) {