From 5597e432afcd433db2365acf66d2ef9e29a82bfa Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 2 Apr 2013 11:07:49 -0700 Subject: [PATCH] 'docker run' in attached mode no longer waits for the process to exit. Take this into account in the tests. Upstream-commit: 2db358146f8bc0f63d840c8e0227bcbe7a8e3063 Component: engine --- components/engine/commands_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/engine/commands_test.go b/components/engine/commands_test.go index 27b6605abb..734cefa278 100644 --- a/components/engine/commands_test.go +++ b/components/engine/commands_test.go @@ -94,11 +94,15 @@ func TestRunDisconnect(t *testing.T) { <-c1 }) - // Check the status of the container - container := runtime.containers.Back().Value.(*Container) - if container.State.Running { - t.Fatalf("/bin/cat is still running after closing stdin") - } + // Client disconnect after run -i should cause stdin to be closed, which should + // cause /bin/cat to exit. + setTimeout(t, "Waiting for /bin/cat to exit timed out", 2*time.Second, func() { + container := runtime.List()[0] + container.Wait() + if container.State.Running { + t.Fatalf("/bin/cat is still running after closing stdin") + } + }) } // Expected behaviour, the process stays alive when the client disconnects