Bläddra i källkod

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 10 år sedan
förälder
incheckning
cad770f992
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      integration-cli/docker_cli_run_test.go

+ 4 - 0
integration-cli/docker_cli_run_test.go

@@ -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 {