mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Cleanup errorOut resp in nat test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
parent
6b858b59ed
commit
17842840ec
1 changed files with 13 additions and 5 deletions
|
@ -26,17 +26,24 @@ func TestNetworkNat(t *testing.T) {
|
||||||
|
|
||||||
runCmd := exec.Command(dockerBinary, "run", "-dt", "-p", "8080:8080", "busybox", "nc", "-lp", "8080")
|
runCmd := exec.Command(dockerBinary, "run", "-dt", "-p", "8080:8080", "busybox", "nc", "-lp", "8080")
|
||||||
out, _, err := runCommandWithOutput(runCmd)
|
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)
|
cleanedContainerID := stripTrailingCharacters(out)
|
||||||
|
|
||||||
runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIP))
|
runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIP))
|
||||||
out, _, err = runCommandWithOutput(runCmd)
|
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)
|
runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID)
|
||||||
out, _, err = runCommandWithOutput(runCmd)
|
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")
|
out = strings.Trim(out, "\r\n")
|
||||||
|
|
||||||
if expected := "hello world"; out != expected {
|
if expected := "hello world"; out != expected {
|
||||||
|
@ -44,8 +51,9 @@ func TestNetworkNat(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID)
|
killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID)
|
||||||
out, _, err = runCommandWithOutput(killCmd)
|
if out, _, err = runCommandWithOutput(killCmd); err != nil {
|
||||||
errorOut(err, t, fmt.Sprintf("failed to kill container: %v %v", out, err))
|
t.Fatalf("failed to kill container: %s, %v", out, err)
|
||||||
|
}
|
||||||
deleteAllContainers()
|
deleteAllContainers()
|
||||||
|
|
||||||
logDone("network - make sure nat works through the host")
|
logDone("network - make sure nat works through the host")
|
||||||
|
|
Loading…
Add table
Reference in a new issue