Skip to content

Commit

Permalink
Merge pull request moby#4357 from creack/fix_TestCmdKill
Browse files Browse the repository at this point in the history
Fix TestCmdKill by closing the pipe before waiting on the container
  • Loading branch information
vieux committed Feb 26, 2014
2 parents bde192b + 4039fbb commit 5908aa3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions integration/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,11 +1046,12 @@ func TestContainerOrphaning(t *testing.T) {
}

func TestCmdKill(t *testing.T) {
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()

cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
cli2 := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
var (
stdin, stdinPipe = io.Pipe()
stdout, stdoutPipe = io.Pipe()
cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
cli2 = api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
)
defer cleanup(globalEngine, t)

ch := make(chan struct{})
Expand Down Expand Up @@ -1089,6 +1090,7 @@ func TestCmdKill(t *testing.T) {
}
})

stdout.Close()
time.Sleep(500 * time.Millisecond)
if !container.State.IsRunning() {
t.Fatal("The container should be still running")
Expand Down

0 comments on commit 5908aa3

Please sign in to comment.