Cleanup errorOut resp pull tests

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
Jessica Frazelle 2014-10-14 14:09:40 -07:00
parent dd248dee3c
commit eeb0097294
1 changed files with 4 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"fmt"
"os/exec" "os/exec"
"testing" "testing"
) )
@ -11,11 +10,8 @@ import (
// pulling an image from the central registry should work // pulling an image from the central registry should work
func TestPullImageFromCentralRegistry(t *testing.T) { func TestPullImageFromCentralRegistry(t *testing.T) {
pullCmd := exec.Command(dockerBinary, "pull", "scratch") pullCmd := exec.Command(dockerBinary, "pull", "scratch")
out, exitCode, err := runCommandWithOutput(pullCmd) if out, _, err := runCommandWithOutput(pullCmd); err != nil {
errorOut(err, t, fmt.Sprintf("%s %s", out, err)) t.Fatal("pulling the scratch image from the registry has failed: %s, %v", out, err)
if err != nil || exitCode != 0 {
t.Fatal("pulling the scratch image from the registry has failed")
} }
logDone("pull - pull scratch") logDone("pull - pull scratch")
} }
@ -23,10 +19,8 @@ func TestPullImageFromCentralRegistry(t *testing.T) {
// pulling a non-existing image from the central registry should return a non-zero exit code // pulling a non-existing image from the central registry should return a non-zero exit code
func TestPullNonExistingImage(t *testing.T) { func TestPullNonExistingImage(t *testing.T) {
pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234") pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
_, exitCode, err := runCommandWithOutput(pullCmd) if out, _, err := runCommandWithOutput(pullCmd); err == nil {
t.Fatal("expected non-zero exit status when pulling non-existing image: %s", out)
if err == nil || exitCode == 0 {
t.Fatal("expected non-zero exit status when pulling non-existing image")
} }
logDone("pull - pull fooblahblah1234 (non-existing image)") logDone("pull - pull fooblahblah1234 (non-existing image)")
} }