Add a test for expose a invalid port

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang 2015-02-19 15:18:13 -08:00
Родитель 57abf4afe9
Коммит 34b7c10e3e
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -2718,6 +2718,20 @@ func TestRunAllowPortRangeThroughExpose(t *testing.T) {
logDone("run - allow port range through --expose flag")
}
// test docker run expose a invalid port
func TestRunExposePort(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "--expose", "80000", "busybox")
out, _, err := runCommandWithOutput(runCmd)
//expose a invalid port should with a error out
if err == nil || !strings.Contains(out, "Invalid range format for --expose") {
t.Fatalf("run --expose a invalid port should with error out")
}
deleteAllContainers()
logDone("run - can't expose a invalid port")
}
func TestRunUnknownCommand(t *testing.T) {
defer deleteAllContainers()
runCmd := exec.Command(dockerBinary, "create", "busybox", "/bin/nada")