Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -26,17 +26,24 @@ func TestNetworkNat(t *testing.T) {
|
| 26 | 26 |
|
| 27 | 27 |
runCmd := exec.Command(dockerBinary, "run", "-dt", "-p", "8080:8080", "busybox", "nc", "-lp", "8080") |
| 28 | 28 |
out, _, err := runCommandWithOutput(runCmd) |
| 29 |
- errorOut(err, t, fmt.Sprintf("run1 failed with errors: %v (%s)", err, out))
|
|
| 29 |
+ if err != nil {
|
|
| 30 |
+ t.Fatal(out, err) |
|
| 31 |
+ } |
|
| 30 | 32 |
|
| 31 | 33 |
cleanedContainerID := stripTrailingCharacters(out) |
| 32 | 34 |
|
| 33 | 35 |
runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIP))
|
| 34 | 36 |
out, _, err = runCommandWithOutput(runCmd) |
| 35 |
- errorOut(err, t, fmt.Sprintf("run2 failed with errors: %v (%s)", err, out))
|
|
| 37 |
+ if err != nil {
|
|
| 38 |
+ t.Fatal(out, err) |
|
| 39 |
+ } |
|
| 36 | 40 |
|
| 37 | 41 |
runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) |
| 38 | 42 |
out, _, err = runCommandWithOutput(runCmd) |
| 39 |
- errorOut(err, t, fmt.Sprintf("failed to retrieve logs for container: %v %v", cleanedContainerID, err))
|
|
| 43 |
+ if err != nil {
|
|
| 44 |
+ t.Fatalf("failed to retrieve logs for container: %s, %v", out, err)
|
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 40 | 47 |
out = strings.Trim(out, "\r\n") |
| 41 | 48 |
|
| 42 | 49 |
if expected := "hello world"; out != expected {
|
| ... | ... |
@@ -44,8 +51,9 @@ func TestNetworkNat(t *testing.T) {
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID) |
| 47 |
- out, _, err = runCommandWithOutput(killCmd) |
|
| 48 |
- errorOut(err, t, fmt.Sprintf("failed to kill container: %v %v", out, err))
|
|
| 47 |
+ if out, _, err = runCommandWithOutput(killCmd); err != nil {
|
|
| 48 |
+ t.Fatalf("failed to kill container: %s, %v", out, err)
|
|
| 49 |
+ } |
|
| 49 | 50 |
deleteAllContainers() |
| 50 | 51 |
|
| 51 | 52 |
logDone("network - make sure nat works through the host")
|