From c0bb1c77ee2461f8bceb03202f60f5673815c026 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Sat, 27 Dec 2014 02:38:46 +0000 Subject: [PATCH] add test Signed-off-by: Victor Vieux --- integration-cli/docker_cli_inspect_test.go | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/integration-cli/docker_cli_inspect_test.go b/integration-cli/docker_cli_inspect_test.go index cf42217ac8..ee69a89a43 100644 --- a/integration-cli/docker_cli_inspect_test.go +++ b/integration-cli/docker_cli_inspect_test.go @@ -21,3 +21,38 @@ func TestInspectImage(t *testing.T) { logDone("inspect - inspect an image") } + +func TestInspectExecID(t *testing.T) { + defer deleteAllContainers() + + out, exitCode, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "-d", "busybox", "top")) + if exitCode != 0 || err != nil { + t.Fatalf("failed to run container: %s, %v", out, err) + } + id := strings.TrimSuffix(out, "\n") + + out, err = inspectField(id, "ExecIDs") + if err != nil { + t.Fatalf("failed to inspect container: %s, %v", out, err) + } + if out != "" { + t.Fatalf("ExecIDs should be empty, got: %s", out) + } + + exitCode, err = runCommand(exec.Command(dockerBinary, "exec", "-d", id, "ls", "/")) + if exitCode != 0 || err != nil { + t.Fatalf("failed to exec in container: %s, %v", out, err) + } + + out, err = inspectField(id, "ExecIDs") + if err != nil { + t.Fatalf("failed to inspect container: %s, %v", out, err) + } + + out = strings.TrimSuffix(out, "\n") + if out == "[]" || out == "" { + t.Fatalf("ExecIDs should not be empty, got: %s", out) + } + + logDone("inspect - inspect a container with ExecIDs") +}