浏览代码

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 <todd.whiteman@joyent.com>

Todd Whiteman 10 年之前
父节点
当前提交
3e51a81475
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      integration-cli/docker_cli_ps_test.go

+ 3 - 0
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]