Browse code

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>

Pavel Tikhomirov authored on 2015/02/17 19:15:51
Showing 1 changed files
... ...
@@ -2921,6 +2921,10 @@ func TestRunPortFromDockerRangeInUse(t *testing.T) {
2921 2921
 		t.Fatal(out, err)
2922 2922
 	}
2923 2923
 	out = strings.TrimSpace(out)
2924
+
2925
+	if out == "" {
2926
+		t.Fatal("docker port command output is empty")
2927
+	}
2924 2928
 	out = strings.Split(out, ":")[1]
2925 2929
 	lastPort, err := strconv.Atoi(out)
2926 2930
 	if err != nil {