Browse code

Fix and re-enable TestGetContainersTop

Johannes 'fish' Ziemke authored on 2013/12/16 21:29:06
Showing 1 changed files
... ...
@@ -432,7 +432,6 @@ func TestGetContainersChanges(t *testing.T) {
432 432
 }
433 433
 
434 434
 func TestGetContainersTop(t *testing.T) {
435
-	t.Skip("Fixme. Skipping test for now. Reported error when testing using dind: 'api_test.go:527: Expected 2 processes, found 0.'")
436 435
 	eng := NewTestEngine(t)
437 436
 	defer mkRuntimeFromEngine(eng, t).Nuke()
438 437
 	srv := mkServerFromEngine(eng, t)
... ...
@@ -475,7 +474,7 @@ func TestGetContainersTop(t *testing.T) {
475 475
 	})
476 476
 
477 477
 	r := httptest.NewRecorder()
478
-	req, err := http.NewRequest("GET", "/"+containerID+"/top?ps_args=u", bytes.NewReader([]byte{}))
478
+	req, err := http.NewRequest("GET", "/containers/"+containerID+"/top?ps_args=aux", nil)
479 479
 	if err != nil {
480 480
 		t.Fatal(err)
481 481
 	}
... ...
@@ -498,11 +497,11 @@ func TestGetContainersTop(t *testing.T) {
498 498
 	if len(procs.Processes) != 2 {
499 499
 		t.Fatalf("Expected 2 processes, found %d.", len(procs.Processes))
500 500
 	}
501
-	if procs.Processes[0][10] != "/bin/sh" && procs.Processes[0][10] != "cat" {
502
-		t.Fatalf("Expected `cat` or `/bin/sh`, found %s.", procs.Processes[0][10])
501
+	if procs.Processes[0][10] != "/bin/sh -c cat" {
502
+		t.Fatalf("Expected `/bin/sh -c cat`, found %s.", procs.Processes[0][10])
503 503
 	}
504
-	if procs.Processes[1][10] != "/bin/sh" && procs.Processes[1][10] != "cat" {
505
-		t.Fatalf("Expected `cat` or `/bin/sh`, found %s.", procs.Processes[1][10])
504
+	if procs.Processes[1][10] != "/bin/sh -c cat" {
505
+		t.Fatalf("Expected `/bin/sh -c cat`, found %s.", procs.Processes[1][10])
506 506
 	}
507 507
 }
508 508