1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/docker_cli_start_test.go
Michael Crosby 51d9a04f17 Make sure to set error reguardless of attach or stdin
Fixes #3364
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-31 18:33:14 +00:00

34 lines
938 B
Go

package main
import (
"os/exec"
"testing"
)
// Regression test for #3364
func TestDockerStartWithPortCollision(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "--name", "fail", "-p", "25:25", "busybox", "true")
out, stderr, exitCode, err := runCommandWithStdoutStderr(runCmd)
if err != nil && exitCode != 0 {
t.Fatal(out, stderr, err)
}
runCmd = exec.Command(dockerBinary, "run", "--name", "conflict", "-dti", "-p", "25:25", "busybox", "sh")
out, stderr, exitCode, err = runCommandWithStdoutStderr(runCmd)
if err != nil && exitCode != 0 {
t.Fatal(out, stderr, err)
}
startCmd := exec.Command(dockerBinary, "start", "-a", "fail")
out, stderr, exitCode, err = runCommandWithStdoutStderr(startCmd)
if err != nil && exitCode != 1 {
t.Fatal(out, err)
}
killCmd := exec.Command(dockerBinary, "kill", "conflict")
runCommand(killCmd)
deleteAllContainers()
logDone("start - -a=true error on port use")
}