From d8fb828ed6e49e2deb235ae6519f9239312e56d0 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() Upstream-commit: cda9cf1539b4e3ce24ce77892b1e68ddb454f566 Component: engine --- components/engine/container_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/engine/container_test.go b/components/engine/container_test.go index 571a093767..00c2aa6c8f 100644 --- a/components/engine/container_test.go +++ b/components/engine/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 2bc3ef63289b3982a39f5699f32758ecac395f66 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 Upstream-commit: bae6f9583060187116aa8a069d0e63abfede5de0 Component: engine --- components/engine/runtime_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/runtime_test.go b/components/engine/runtime_test.go index 3cdcbe3b39..f76df953be 100644 --- a/components/engine/runtime_test.go +++ b/components/engine/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 51b0dca52ed3366d2ee770f8b3df404daaf6ff84 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() Upstream-commit: b76b329ef05748e75224e8fd09c1c697ddfd2a50 Component: engine --- components/engine/runtime_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/components/engine/runtime_test.go b/components/engine/runtime_test.go index f76df953be..355d222e06 100644 --- a/components/engine/runtime_test.go +++ b/components/engine/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 cba4b1444c00f60b78767dcc4e3310f6bec39929 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 Upstream-commit: 20085794f023e2e5cf7d772a67f9c3b2e3afc93f Component: engine --- components/engine/container_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/engine/container_test.go b/components/engine/container_test.go index 00c2aa6c8f..ac47f84bf0 100644 --- a/components/engine/container_test.go +++ b/components/engine/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) {