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:
Jessica Frazelle 2014-10-14 12:38:00 -07:00
Родитель 6b858b59ed
Коммит 17842840ec
1 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -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")