diff options
| author | Liu Hua <sdu.liu@huawei.com> | 2015-04-01 22:08:00 +0800 |
|---|---|---|
| committer | Liu Hua <sdu.liu@huawei.com> | 2015-04-09 23:03:23 +0800 |
| commit | 645c020f5ab7119cd06d7c6a790e9d99fe1cd309 (patch) | |
| tree | 2791dbf7f92dd63c2a273e1c6c809a2fd9862f06 /integration-cli/docker_cli_ps_test.go | |
| parent | 663d9130118548c648c4463bae088fd983099e08 (diff) | |
| download | docker-645c020f5ab7119cd06d7c6a790e9d99fe1cd309.tar.gz | |
fix up Image-name related issues in docker ps and CI
This patch include the following fixs:
- fix image name error when docker ps
- fix docker events test failure: use the exact image name for filter
- fix docker build CI test failure due to "docker events" change
Because of change of daemon log behavior. Now we record
the exact Image name as you typed. So docker run -d busybux sh
and docker run -d busybox:latest are not the same in the log.
So it will affect the docker events. So change the related CI
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Diffstat (limited to 'integration-cli/docker_cli_ps_test.go')
| -rw-r--r-- | integration-cli/docker_cli_ps_test.go | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index f97da5be3f..9ac3474102 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -594,6 +594,21 @@ func TestPsRightTagName(t *testing.T) { } else { id2 = strings.TrimSpace(string(out)) } + + var imageID string + if out, err := exec.Command(dockerBinary, "inspect", "-f", "{{.Id}}", "busybox").CombinedOutput(); err != nil { + t.Fatalf("failed to get the image ID of busybox: %s, %v", out, err) + } else { + imageID = strings.TrimSpace(string(out)) + } + + var id3 string + if out, err := exec.Command(dockerBinary, "run", "-d", imageID, "top").CombinedOutput(); err != nil { + t.Fatalf("Failed to run container: %s, out: %q", err, out) + } else { + id3 = strings.TrimSpace(string(out)) + } + out, err := exec.Command(dockerBinary, "ps", "--no-trunc").CombinedOutput() if err != nil { t.Fatalf("Failed to run 'ps': %s, out: %q", err, out) @@ -601,22 +616,26 @@ func TestPsRightTagName(t *testing.T) { lines := strings.Split(strings.TrimSpace(string(out)), "\n") // skip header lines = lines[1:] - if len(lines) != 2 { - t.Fatalf("There should be 2 running container, got %d", len(lines)) + if len(lines) != 3 { + t.Fatalf("There should be 3 running container, got %d", len(lines)) } for _, line := range lines { f := strings.Fields(line) switch f[0] { case id1: - if f[1] != "busybox:latest" { + if f[1] != "busybox" { t.Fatalf("Expected %s tag for id %s, got %s", "busybox", id1, f[1]) } case id2: if f[1] != tag { - t.Fatalf("Expected %s tag for id %s, got %s", tag, id1, f[1]) + t.Fatalf("Expected %s tag for id %s, got %s", tag, id2, f[1]) + } + case id3: + if f[1] != imageID { + t.Fatalf("Expected %s imageID for id %s, got %s", tag, id3, f[1]) } default: - t.Fatalf("Unexpected id %s, expected %s and %s", f[0], id1, id2) + t.Fatalf("Unexpected id %s, expected %s and %s and %s", f[0], id1, id2, id3) } } logDone("ps - right tags for containers") |
