1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: check that docker port command output is not empty

Or else we can violate array range boundaries in:
	out = strings.Split(out, ":")[1]
and get runtime error.

We got this runtime error when run TestRunPortFromDockerRangeInUse
Somehow docker goes silently if it cannot publish port because
of no bridge.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@parallels.com>
This commit is contained in:
Pavel Tikhomirov 2015-02-17 13:15:51 +03:00
parent 2243e32cbb
commit cad770f992

View file

@ -2921,6 +2921,10 @@ func TestRunPortFromDockerRangeInUse(t *testing.T) {
t.Fatal(out, err)
}
out = strings.TrimSpace(out)
if out == "" {
t.Fatal("docker port command output is empty")
}
out = strings.Split(out, ":")[1]
lastPort, err := strconv.Atoi(out)
if err != nil {