diff --git a/integration-cli/docker_cli_nat_test.go b/integration-cli/docker_cli_nat_test.go index 3f0fa2b272..01ebb73c74 100644 --- a/integration-cli/docker_cli_nat_test.go +++ b/integration-cli/docker_cli_nat_test.go @@ -26,17 +26,24 @@ func TestNetworkNat(t *testing.T) { runCmd := exec.Command(dockerBinary, "run", "-dt", "-p", "8080:8080", "busybox", "nc", "-lp", "8080") out, _, err := runCommandWithOutput(runCmd) - errorOut(err, t, fmt.Sprintf("run1 failed with errors: %v (%s)", err, out)) + if err != nil { + t.Fatal(out, err) + } cleanedContainerID := stripTrailingCharacters(out) runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIP)) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, fmt.Sprintf("run2 failed with errors: %v (%s)", err, out)) + if err != nil { + t.Fatal(out, err) + } runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) out, _, err = runCommandWithOutput(runCmd) - errorOut(err, t, fmt.Sprintf("failed to retrieve logs for container: %v %v", cleanedContainerID, err)) + if err != nil { + t.Fatalf("failed to retrieve logs for container: %s, %v", out, err) + } + out = strings.Trim(out, "\r\n") if expected := "hello world"; out != expected { @@ -44,8 +51,9 @@ func TestNetworkNat(t *testing.T) { } killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID) - out, _, err = runCommandWithOutput(killCmd) - errorOut(err, t, fmt.Sprintf("failed to kill container: %v %v", out, err)) + if out, _, err = runCommandWithOutput(killCmd); err != nil { + t.Fatalf("failed to kill container: %s, %v", out, err) + } deleteAllContainers() logDone("network - make sure nat works through the host")