Browse code

Improve TestMultipleAttachRestart to avoid unnecessary warning

Guillaume J. Charmes authored on 2013/04/24 03:22:30
Showing 1 changed files
... ...
@@ -116,8 +116,8 @@ func TestMultipleAttachRestart(t *testing.T) {
116 116
 	if err := container.Start(); err != nil {
117 117
 		t.Fatal(err)
118 118
 	}
119
-	timeout := make(chan bool)
120
-	go func() {
119
+
120
+	setTimeout(t, "Timeout reading from the process", 3*time.Second, func() {
121 121
 		l1, err = bufio.NewReader(stdout1).ReadString('\n')
122 122
 		if err != nil {
123 123
 			t.Fatal(err)
... ...
@@ -139,15 +139,8 @@ func TestMultipleAttachRestart(t *testing.T) {
139 139
 		if strings.Trim(l3, " \r\n") != "hello" {
140 140
 			t.Fatalf("Unexpected output. Expected [%s], received [%s]", "hello", l3)
141 141
 		}
142
-		timeout <- false
143
-	}()
144
-	go func() {
145
-		time.Sleep(3 * time.Second)
146
-		timeout <- true
147
-	}()
148
-	if <-timeout {
149
-		t.Fatalf("Timeout reading from the process")
150
-	}
142
+	})
143
+	container.Wait()
151 144
 }
152 145
 
153 146
 func TestDiff(t *testing.T) {