Browse code

Make race condition more obvious by performing more asserts

Guillaume J. Charmes authored on 2013/11/29 09:12:45
Showing 4 changed files
... ...
@@ -454,7 +454,7 @@ func TestGetContainersTop(t *testing.T) {
454 454
 	// Make sure sh spawn up cat
455 455
 	setTimeout(t, "read/write assertion timed out", 2*time.Second, func() {
456 456
 		in, out := containerAttach(eng, containerID, t)
457
-		if err := assertPipe("hello\n", "hello", out, in, 15); err != nil {
457
+		if err := assertPipe("hello\n", "hello", out, in, 150); err != nil {
458 458
 			t.Fatal(err)
459 459
 		}
460 460
 	})
... ...
@@ -877,7 +877,7 @@ func TestPostContainersAttach(t *testing.T) {
877 877
 	})
878 878
 
879 879
 	setTimeout(t, "read/write assertion timed out", 2*time.Second, func() {
880
-		if err := assertPipe("hello\n", string([]byte{1, 0, 0, 0, 0, 0, 0, 6})+"hello", stdout, stdinPipe, 15); err != nil {
880
+		if err := assertPipe("hello\n", string([]byte{1, 0, 0, 0, 0, 0, 0, 6})+"hello", stdout, stdinPipe, 150); err != nil {
881 881
 			t.Fatal(err)
882 882
 		}
883 883
 	})
... ...
@@ -956,7 +956,7 @@ func TestPostContainersAttachStderr(t *testing.T) {
956 956
 	})
957 957
 
958 958
 	setTimeout(t, "read/write assertion timed out", 2*time.Second, func() {
959
-		if err := assertPipe("hello\n", string([]byte{2, 0, 0, 0, 0, 0, 0, 6})+"hello", stdout, stdinPipe, 15); err != nil {
959
+		if err := assertPipe("hello\n", string([]byte{2, 0, 0, 0, 0, 0, 0, 6})+"hello", stdout, stdinPipe, 150); err != nil {
960 960
 			t.Fatal(err)
961 961
 		}
962 962
 	})
... ...
@@ -213,7 +213,7 @@ func TestRunExit(t *testing.T) {
213 213
 	}()
214 214
 
215 215
 	setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
216
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
216
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
217 217
 			t.Fatal(err)
218 218
 		}
219 219
 	})
... ...
@@ -268,7 +268,7 @@ func TestRunDisconnect(t *testing.T) {
268 268
 	}()
269 269
 
270 270
 	setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
271
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
271
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
272 272
 			t.Fatal(err)
273 273
 		}
274 274
 	})
... ...
@@ -330,7 +330,7 @@ func TestRunDisconnectTty(t *testing.T) {
330 330
 	container := globalRuntime.List()[0]
331 331
 
332 332
 	setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
333
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
333
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
334 334
 			t.Fatal(err)
335 335
 		}
336 336
 	})
... ...
@@ -432,7 +432,7 @@ func TestRunDetach(t *testing.T) {
432 432
 	}()
433 433
 
434 434
 	setTimeout(t, "First read/write assertion timed out", 2*time.Second, func() {
435
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
435
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
436 436
 			t.Fatal(err)
437 437
 		}
438 438
 	})
... ...
@@ -513,7 +513,7 @@ func TestAttachDetach(t *testing.T) {
513 513
 	}()
514 514
 
515 515
 	setTimeout(t, "First read/write assertion timed out", 2*time.Second, func() {
516
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
516
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
517 517
 			if err != io.ErrClosedPipe {
518 518
 				t.Fatal(err)
519 519
 			}
... ...
@@ -575,7 +575,7 @@ func TestAttachDetachTruncatedID(t *testing.T) {
575 575
 	}()
576 576
 
577 577
 	setTimeout(t, "First read/write assertion timed out", 2*time.Second, func() {
578
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
578
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
579 579
 			if err != io.ErrClosedPipe {
580 580
 				t.Fatal(err)
581 581
 			}
... ...
@@ -648,7 +648,7 @@ func TestAttachDisconnect(t *testing.T) {
648 648
 	}()
649 649
 
650 650
 	setTimeout(t, "First read/write assertion timed out", 2*time.Second, func() {
651
-		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
651
+		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 150); err != nil {
652 652
 			t.Fatal(err)
653 653
 		}
654 654
 	})
... ...
@@ -462,7 +462,7 @@ func TestKillDifferentUser(t *testing.T) {
462 462
 	setTimeout(t, "read/write assertion timed out", 2*time.Second, func() {
463 463
 		out, _ := container.StdoutPipe()
464 464
 		in, _ := container.StdinPipe()
465
-		if err := assertPipe("hello\n", "hello", out, in, 15); err != nil {
465
+		if err := assertPipe("hello\n", "hello", out, in, 150); err != nil {
466 466
 			t.Fatal(err)
467 467
 		}
468 468
 	})
... ...
@@ -183,11 +183,11 @@ func TestCreateStartRestartStopStartKillRm(t *testing.T) {
183 183
 		t.Fatal(err)
184 184
 	}
185 185
 
186
-	if err := srv.ContainerRestart(id, 15); err != nil {
186
+	if err := srv.ContainerRestart(id, 150); err != nil {
187 187
 		t.Fatal(err)
188 188
 	}
189 189
 
190
-	if err := srv.ContainerStop(id, 15); err != nil {
190
+	if err := srv.ContainerStop(id, 150); err != nil {
191 191
 		t.Fatal(err)
192 192
 	}
193 193