diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index 7dc1819fe3..3a390ef2c3 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -10,29 +10,37 @@ import ( func TestRestartStoppedContainer(t *testing.T) { runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "echo", "foobar") out, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) runCmd = exec.Command(dockerBinary, "wait", cleanedContainerID) - out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if out, _, err = runCommandWithOutput(runCmd); err != nil { + t.Fatal(out, err) + } runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out != "foobar\n" { t.Errorf("container should've printed 'foobar'") } runCmd = exec.Command(dockerBinary, "restart", cleanedContainerID) - out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if out, _, err = runCommandWithOutput(runCmd); err != nil { + t.Fatal(out, err) + } runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out != "foobar\nfoobar\n" { t.Errorf("container should've printed 'foobar' twice") @@ -46,7 +54,9 @@ func TestRestartStoppedContainer(t *testing.T) { func TestRestartRunningContainer(t *testing.T) { runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'") out, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) @@ -54,19 +64,24 @@ func TestRestartRunningContainer(t *testing.T) { runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out != "foobar\n" { t.Errorf("container should've printed 'foobar'") } runCmd = exec.Command(dockerBinary, "restart", "-t", "1", cleanedContainerID) - out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if out, _, err = runCommandWithOutput(runCmd); err != nil { + t.Fatal(out, err) + } runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } time.Sleep(1 * time.Second) @@ -83,13 +98,17 @@ func TestRestartRunningContainer(t *testing.T) { func TestRestartWithVolumes(t *testing.T) { runCmd := exec.Command(dockerBinary, "run", "-d", "-v", "/test", "busybox", "top") out, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) runCmd = exec.Command(dockerBinary, "inspect", "--format", "{{ len .Volumes }}", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out = strings.Trim(out, " \n\r"); out != "1" { t.Errorf("expect 1 volume received %s", out) @@ -97,15 +116,20 @@ func TestRestartWithVolumes(t *testing.T) { runCmd = exec.Command(dockerBinary, "inspect", "--format", "{{ .Volumes }}", cleanedContainerID) volumes, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, volumes) + if err != nil { + t.Fatal(volumes, err) + } runCmd = exec.Command(dockerBinary, "restart", cleanedContainerID) - out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if out, _, err = runCommandWithOutput(runCmd); err != nil { + t.Fatal(out, err) + } runCmd = exec.Command(dockerBinary, "inspect", "--format", "{{ len .Volumes }}", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, out) + if err != nil { + t.Fatal(out, err) + } if out = strings.Trim(out, " \n\r"); out != "1" { t.Errorf("expect 1 volume after restart received %s", out) @@ -113,7 +137,9 @@ func TestRestartWithVolumes(t *testing.T) { runCmd = exec.Command(dockerBinary, "inspect", "--format", "{{ .Volumes }}", cleanedContainerID) volumesAfterRestart, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, volumesAfterRestart) + if err != nil { + t.Fatal(volumesAfterRestart, err) + } if volumes != volumesAfterRestart { volumes = strings.Trim(volumes, " \n\r")