Merge pull request #9800 from vieux/execIDs_inspect

Add ExecIDs to docker inspect
Upstream-commit: 12fef2d8df4e5da024418e324f7e3c3e82220a27
Component: engine
This commit is contained in:
Alexander Morozov
2014-12-29 15:32:33 -08:00
5 changed files with 62 additions and 3 deletions
@@ -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 != "<no value>" {
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 == "<no value>" {
t.Fatalf("ExecIDs should not be empty, got: %s", out)
}
logDone("inspect - inspect a container with ExecIDs")
}