Browse code

Cleanup errorOut resp in port test

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Jessica Frazelle authored on 2014/10/15 04:23:10
Showing 1 changed files
... ...
@@ -11,12 +11,16 @@ func TestPortList(t *testing.T) {
11 11
 	// one port
12 12
 	runCmd := exec.Command(dockerBinary, "run", "-d", "-p", "9876:80", "busybox", "top")
13 13
 	out, _, err := runCommandWithOutput(runCmd)
14
-	errorOut(err, t, out)
14
+	if err != nil {
15
+		t.Fatal(out, err)
16
+	}
15 17
 	firstID := stripTrailingCharacters(out)
16 18
 
17 19
 	runCmd = exec.Command(dockerBinary, "port", firstID, "80")
18 20
 	out, _, err = runCommandWithOutput(runCmd)
19
-	errorOut(err, t, out)
21
+	if err != nil {
22
+		t.Fatal(out, err)
23
+	}
20 24
 
21 25
 	if !assertPortList(t, out, []string{"0.0.0.0:9876"}) {
22 26
 		t.Error("Port list is not correct")
... ...
@@ -24,14 +28,17 @@ func TestPortList(t *testing.T) {
24 24
 
25 25
 	runCmd = exec.Command(dockerBinary, "port", firstID)
26 26
 	out, _, err = runCommandWithOutput(runCmd)
27
-	errorOut(err, t, out)
27
+	if err != nil {
28
+		t.Fatal(out, err)
29
+	}
28 30
 
29 31
 	if !assertPortList(t, out, []string{"80/tcp -> 0.0.0.0:9876"}) {
30 32
 		t.Error("Port list is not correct")
31 33
 	}
32 34
 	runCmd = exec.Command(dockerBinary, "rm", "-f", firstID)
33
-	out, _, err = runCommandWithOutput(runCmd)
34
-	errorOut(err, t, out)
35
+	if out, _, err = runCommandWithOutput(runCmd); err != nil {
36
+		t.Fatal(out, err)
37
+	}
35 38
 
36 39
 	// three port
37 40
 	runCmd = exec.Command(dockerBinary, "run", "-d",
... ...
@@ -40,12 +47,16 @@ func TestPortList(t *testing.T) {
40 40
 		"-p", "9878:82",
41 41
 		"busybox", "top")
42 42
 	out, _, err = runCommandWithOutput(runCmd)
43
-	errorOut(err, t, out)
43
+	if err != nil {
44
+		t.Fatal(out, err)
45
+	}
44 46
 	ID := stripTrailingCharacters(out)
45 47
 
46 48
 	runCmd = exec.Command(dockerBinary, "port", ID, "80")
47 49
 	out, _, err = runCommandWithOutput(runCmd)
48
-	errorOut(err, t, out)
50
+	if err != nil {
51
+		t.Fatal(out, err)
52
+	}
49 53
 
50 54
 	if !assertPortList(t, out, []string{"0.0.0.0:9876"}) {
51 55
 		t.Error("Port list is not correct")
... ...
@@ -53,7 +64,9 @@ func TestPortList(t *testing.T) {
53 53
 
54 54
 	runCmd = exec.Command(dockerBinary, "port", ID)
55 55
 	out, _, err = runCommandWithOutput(runCmd)
56
-	errorOut(err, t, out)
56
+	if err != nil {
57
+		t.Fatal(out, err)
58
+	}
57 59
 
58 60
 	if !assertPortList(t, out, []string{
59 61
 		"80/tcp -> 0.0.0.0:9876",
... ...
@@ -63,7 +76,9 @@ func TestPortList(t *testing.T) {
63 63
 	}
64 64
 	runCmd = exec.Command(dockerBinary, "rm", "-f", ID)
65 65
 	out, _, err = runCommandWithOutput(runCmd)
66
-	errorOut(err, t, out)
66
+	if err != nil {
67
+		t.Fatal(out, err)
68
+	}
67 69
 
68 70
 	// more and one port mapped to the same container port
69 71
 	runCmd = exec.Command(dockerBinary, "run", "-d",
... ...
@@ -73,12 +88,16 @@ func TestPortList(t *testing.T) {
73 73
 		"-p", "9878:82",
74 74
 		"busybox", "top")
75 75
 	out, _, err = runCommandWithOutput(runCmd)
76
-	errorOut(err, t, out)
76
+	if err != nil {
77
+		t.Fatal(out, err)
78
+	}
77 79
 	ID = stripTrailingCharacters(out)
78 80
 
79 81
 	runCmd = exec.Command(dockerBinary, "port", ID, "80")
80 82
 	out, _, err = runCommandWithOutput(runCmd)
81
-	errorOut(err, t, out)
83
+	if err != nil {
84
+		t.Fatal(out, err)
85
+	}
82 86
 
83 87
 	if !assertPortList(t, out, []string{"0.0.0.0:9876", "0.0.0.0:9999"}) {
84 88
 		t.Error("Port list is not correct")
... ...
@@ -86,7 +105,9 @@ func TestPortList(t *testing.T) {
86 86
 
87 87
 	runCmd = exec.Command(dockerBinary, "port", ID)
88 88
 	out, _, err = runCommandWithOutput(runCmd)
89
-	errorOut(err, t, out)
89
+	if err != nil {
90
+		t.Fatal(out, err)
91
+	}
90 92
 
91 93
 	if !assertPortList(t, out, []string{
92 94
 		"80/tcp -> 0.0.0.0:9876",
... ...
@@ -96,8 +117,9 @@ func TestPortList(t *testing.T) {
96 96
 		t.Error("Port list is not correct\n", out)
97 97
 	}
98 98
 	runCmd = exec.Command(dockerBinary, "rm", "-f", ID)
99
-	out, _, err = runCommandWithOutput(runCmd)
100
-	errorOut(err, t, out)
99
+	if out, _, err = runCommandWithOutput(runCmd); err != nil {
100
+		t.Fatal(out, err)
101
+	}
101 102
 
102 103
 	deleteAllContainers()
103 104