diff --git a/integration-cli/docker_cli_create_test.go b/integration-cli/docker_cli_create_test.go index a3d20bdbf5..d85fde1930 100644 --- a/integration-cli/docker_cli_create_test.go +++ b/integration-cli/docker_cli_create_test.go @@ -2,7 +2,6 @@ package main import ( "encoding/json" - "fmt" "os/exec" "testing" "time" @@ -12,13 +11,17 @@ import ( func TestCreateArgs(t *testing.T) { runCmd := exec.Command(dockerBinary, "create", "busybox", "command", "arg1", "arg2", "arg with space") out, _, _, err := runCommandWithStdoutStderr(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID) - inspectOut, _, err := runCommandWithOutput(inspectCmd) - errorOut(err, t, fmt.Sprintf("out should've been a container id: %v %v", inspectOut, err)) + out, _, err = runCommandWithOutput(inspectCmd) + if err != nil { + t.Fatalf("out should've been a container id: %s, %v", out, err) + } containers := []struct { ID string @@ -27,7 +30,7 @@ func TestCreateArgs(t *testing.T) { Args []string Image string }{} - if err := json.Unmarshal([]byte(inspectOut), &containers); err != nil { + if err := json.Unmarshal([]byte(out), &containers); err != nil { t.Fatalf("Error inspecting the container: %s", err) } if len(containers) != 1 { @@ -60,20 +63,24 @@ func TestCreateArgs(t *testing.T) { func TestCreateHostConfig(t *testing.T) { runCmd := exec.Command(dockerBinary, "create", "-P", "busybox", "echo") out, _, _, err := runCommandWithStdoutStderr(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID) - inspectOut, _, err := runCommandWithOutput(inspectCmd) - errorOut(err, t, fmt.Sprintf("out should've been a container id: %v %v", inspectOut, err)) + out, _, err = runCommandWithOutput(inspectCmd) + if err != nil { + t.Fatalf("out should've been a container id: %s, %v", out, err) + } containers := []struct { HostConfig *struct { PublishAllPorts bool } }{} - if err := json.Unmarshal([]byte(inspectOut), &containers); err != nil { + if err := json.Unmarshal([]byte(out), &containers); err != nil { t.Fatalf("Error inspecting the container: %s", err) } if len(containers) != 1 { @@ -98,13 +105,17 @@ func TestCreateHostConfig(t *testing.T) { func TestCreateEchoStdout(t *testing.T) { runCmd := exec.Command(dockerBinary, "create", "busybox", "echo", "test123") out, _, _, err := runCommandWithStdoutStderr(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) runCmd = exec.Command(dockerBinary, "start", "-ai", cleanedContainerID) out, _, _, err = runCommandWithStdoutStderr(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out != "test123\n" { t.Errorf("container should've printed 'test123', got %q", out)