Improve TestMultipleAttachRestart to avoid unnecessary warning

This commit is contained in:
Guillaume J. Charmes 2013-04-23 11:22:30 -07:00
parent a22c78523f
commit c45beabcd5

View file

@ -116,8 +116,8 @@ func TestMultipleAttachRestart(t *testing.T) {
if err := container.Start(); err != nil { if err := container.Start(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
timeout := make(chan bool)
go func() { setTimeout(t, "Timeout reading from the process", 3*time.Second, func() {
l1, err = bufio.NewReader(stdout1).ReadString('\n') l1, err = bufio.NewReader(stdout1).ReadString('\n')
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -139,15 +139,8 @@ func TestMultipleAttachRestart(t *testing.T) {
if strings.Trim(l3, " \r\n") != "hello" { if strings.Trim(l3, " \r\n") != "hello" {
t.Fatalf("Unexpected output. Expected [%s], received [%s]", "hello", l3) t.Fatalf("Unexpected output. Expected [%s], received [%s]", "hello", l3)
} }
timeout <- false })
}() container.Wait()
go func() {
time.Sleep(3 * time.Second)
timeout <- true
}()
if <-timeout {
t.Fatalf("Timeout reading from the process")
}
} }
func TestDiff(t *testing.T) { func TestDiff(t *testing.T) {