mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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>
This commit is contained in:
parent
c88b2c422f
commit
3e51a81475
1 changed files with 3 additions and 0 deletions
|
@ -286,6 +286,9 @@ func TestPsListContainersSize(t *testing.T) {
|
||||||
t.Fatal(out, err)
|
t.Fatal(out, err)
|
||||||
}
|
}
|
||||||
lines := strings.Split(strings.Trim(out, "\n "), "\n")
|
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")
|
sizeIndex := strings.Index(lines[0], "SIZE")
|
||||||
idIndex := strings.Index(lines[0], "CONTAINER ID")
|
idIndex := strings.Index(lines[0], "CONTAINER ID")
|
||||||
foundID := lines[1][idIndex : idIndex+12]
|
foundID := lines[1][idIndex : idIndex+12]
|
||||||
|
|
Loading…
Reference in a new issue