From 3e51a8147510fb59d6206fe7310feaebc2d69fbc Mon Sep 17 00:00:00 2001 From: Todd Whiteman Date: Thu, 2 Apr 2015 14:44:53 -0700 Subject: [PATCH] integration-cli: add check for TestPsListContainersSize when no containers are returned * when no containers are returned, go test would then aborts with: panic: runtime error: index out of range Signed-off-by: Todd Whiteman --- integration-cli/docker_cli_ps_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index 8e634e3b0e..93d5b49955 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -286,6 +286,9 @@ func TestPsListContainersSize(t *testing.T) { t.Fatal(out, err) } lines := strings.Split(strings.Trim(out, "\n "), "\n") + if len(lines) != 2 { + t.Fatalf("Expected 2 lines for 'ps -s -n=1' output, got %d", len(lines)) + } sizeIndex := strings.Index(lines[0], "SIZE") idIndex := strings.Index(lines[0], "CONTAINER ID") foundID := lines[1][idIndex : idIndex+12]