Browse code

Cleanup errorOut resp pull tests

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

Jessica Frazelle authored on 2014/10/15 06:09:40
Showing 1 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 package main
2 2
 
3 3
 import (
4
-	"fmt"
5 4
 	"os/exec"
6 5
 	"testing"
7 6
 )
... ...
@@ -11,11 +10,8 @@ import (
11 11
 // pulling an image from the central registry should work
12 12
 func TestPullImageFromCentralRegistry(t *testing.T) {
13 13
 	pullCmd := exec.Command(dockerBinary, "pull", "scratch")
14
-	out, exitCode, err := runCommandWithOutput(pullCmd)
15
-	errorOut(err, t, fmt.Sprintf("%s %s", out, err))
16
-
17
-	if err != nil || exitCode != 0 {
18
-		t.Fatal("pulling the scratch image from the registry has failed")
14
+	if out, _, err := runCommandWithOutput(pullCmd); err != nil {
15
+		t.Fatal("pulling the scratch image from the registry has failed: %s, %v", out, err)
19 16
 	}
20 17
 	logDone("pull - pull scratch")
21 18
 }
... ...
@@ -23,10 +19,8 @@ func TestPullImageFromCentralRegistry(t *testing.T) {
23 23
 // pulling a non-existing image from the central registry should return a non-zero exit code
24 24
 func TestPullNonExistingImage(t *testing.T) {
25 25
 	pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
26
-	_, exitCode, err := runCommandWithOutput(pullCmd)
27
-
28
-	if err == nil || exitCode == 0 {
29
-		t.Fatal("expected non-zero exit status when pulling non-existing image")
26
+	if out, _, err := runCommandWithOutput(pullCmd); err == nil {
27
+		t.Fatal("expected non-zero exit status when pulling non-existing image: %s", out)
30 28
 	}
31 29
 	logDone("pull - pull fooblahblah1234 (non-existing image)")
32 30
 }