mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move InspectExecID test to exec.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
parent
30293e3fd0
commit
957cbdbf30
2 changed files with 35 additions and 35 deletions
|
@ -453,3 +453,38 @@ func TestExecCgroup(t *testing.T) {
|
|||
|
||||
logDone("exec - exec has the container cgroups")
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
|
|
@ -21,38 +21,3 @@ 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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue