Browse code

Cleanup errorOut resp in push tests

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

Jessica Frazelle authored on 2014/10/15 06:02:15
Showing 1 changed files
... ...
@@ -15,22 +15,17 @@ func TestPushBusyboxImage(t *testing.T) {
15 15
 	// tag the image to upload it tot he private registry
16 16
 	repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
17 17
 	tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
18
-	out, exitCode, err := runCommandWithOutput(tagCmd)
19
-	errorOut(err, t, fmt.Sprintf("%v %v", out, err))
20
-
21
-	if err != nil || exitCode != 0 {
22
-		t.Fatal("image tagging failed")
18
+	if out, _, err := runCommandWithOutput(tagCmd); err != nil {
19
+		t.Fatal("image tagging failed: %s, %v", out, err)
23 20
 	}
24 21
 
25 22
 	pushCmd := exec.Command(dockerBinary, "push", repoName)
26
-	out, exitCode, err = runCommandWithOutput(pushCmd)
27
-	errorOut(err, t, fmt.Sprintf("%v %v", out, err))
23
+	if out, _, err := runCommandWithOutput(pushCmd); err != nil {
24
+		t.Fatal("pushing the image to the private registry has failed: %s, %v", out, err)
25
+	}
28 26
 
29 27
 	deleteImages(repoName)
30 28
 
31
-	if err != nil || exitCode != 0 {
32
-		t.Fatal("pushing the image to the private registry has failed")
33
-	}
34 29
 	logDone("push - push busybox to private registry")
35 30
 }
36 31
 
... ...
@@ -39,10 +34,8 @@ func TestPushUnprefixedRepo(t *testing.T) {
39 39
 	// skip this test until we're able to use a registry
40 40
 	t.Skip()
41 41
 	pushCmd := exec.Command(dockerBinary, "push", "busybox")
42
-	_, exitCode, err := runCommandWithOutput(pushCmd)
43
-
44
-	if err == nil || exitCode == 0 {
45
-		t.Fatal("pushing an unprefixed repo didn't result in a non-zero exit status")
42
+	if out, _, err := runCommandWithOutput(pushCmd); err == nil {
43
+		t.Fatal("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
46 44
 	}
47 45
 	logDone("push - push unprefixed busybox repo --> must fail")
48 46
 }