Fix TestAttachDetachTruncatedID (behavior + tty issue)

This commit is contained in:
Guillaume J. Charmes 2013-11-29 10:03:36 -08:00
parent 697be6aaa0
commit 2e6a958612
No known key found for this signature in database
GPG Key ID: B33E4642CB6E3FF3
1 changed files with 8 additions and 6 deletions

View File

@ -601,7 +601,10 @@ func TestAttachDetachTruncatedID(t *testing.T) {
} }
}) })
container := globalRuntime.List()[0] container := waitContainerStart(t, 10*time.Second)
state := setRaw(t, container)
defer unsetRaw(t, container, state)
stdin, stdinPipe = io.Pipe() stdin, stdinPipe = io.Pipe()
stdout, stdoutPipe = io.Pipe() stdout, stdoutPipe = io.Pipe()
@ -626,17 +629,16 @@ func TestAttachDetachTruncatedID(t *testing.T) {
}) })
setTimeout(t, "Escape sequence timeout", 5*time.Second, func() { setTimeout(t, "Escape sequence timeout", 5*time.Second, func() {
stdinPipe.Write([]byte{16, 17}) stdinPipe.Write([]byte{16})
if err := stdinPipe.Close(); err != nil { time.Sleep(100 * time.Millisecond)
t.Fatal(err) stdinPipe.Write([]byte{17})
}
}) })
closeWrap(stdin, stdinPipe, stdout, stdoutPipe)
// wait for CmdRun to return // wait for CmdRun to return
setTimeout(t, "Waiting for CmdAttach timed out", 15*time.Second, func() { setTimeout(t, "Waiting for CmdAttach timed out", 15*time.Second, func() {
<-ch <-ch
}) })
closeWrap(stdin, stdinPipe, stdout, stdoutPipe)
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
if !container.State.IsRunning() { if !container.State.IsRunning() {