1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix TestCmdKill by closing the pipe before waiting on the container

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
Guillaume J. Charmes 2014-02-25 20:16:17 -08:00
parent 22da8cdc7e
commit 4039fbb1b0
No known key found for this signature in database
GPG key ID: B33E4642CB6E3FF3

View file

@ -1043,11 +1043,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{})
@ -1086,6 +1087,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")