1
0
mirror of https://github.com/moby/moby.git synced 2025-07-29 07:21:35 +03:00

Execdriver implementation on new libcontainer API

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov
2015-03-05 09:55:14 -08:00
parent 7910cb5243
commit 68ba5f0b69
16 changed files with 773 additions and 429 deletions

View File

@ -60,7 +60,7 @@ func TestExecInteractiveStdinClose(t *testing.T) {
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err, out)
t.Fatal(err, string(out))
}
if string(out) == "" {
@ -538,7 +538,6 @@ func TestRunExecDir(t *testing.T) {
id := strings.TrimSpace(out)
execDir := filepath.Join(execDriverPath, id)
stateFile := filepath.Join(execDir, "state.json")
contFile := filepath.Join(execDir, "container.json")
{
fi, err := os.Stat(execDir)
@ -552,10 +551,6 @@ func TestRunExecDir(t *testing.T) {
if err != nil {
t.Fatal(err)
}
fi, err = os.Stat(contFile)
if err != nil {
t.Fatal(err)
}
}
stopCmd := exec.Command(dockerBinary, "stop", id)
@ -564,23 +559,12 @@ func TestRunExecDir(t *testing.T) {
t.Fatal(err, out)
}
{
fi, err := os.Stat(execDir)
if err != nil {
_, err := os.Stat(execDir)
if err == nil {
t.Fatal(err)
}
if !fi.IsDir() {
t.Fatalf("%q must be a directory", execDir)
}
fi, err = os.Stat(stateFile)
if err == nil {
t.Fatalf("Statefile %q is exists for stopped container!", stateFile)
}
if !os.IsNotExist(err) {
t.Fatalf("Error should be about non-existing, got %s", err)
}
fi, err = os.Stat(contFile)
if err == nil {
t.Fatalf("Container file %q is exists for stopped container!", contFile)
t.Fatalf("Exec directory %q exists for removed container!", execDir)
}
if !os.IsNotExist(err) {
t.Fatalf("Error should be about non-existing, got %s", err)
@ -603,10 +587,6 @@ func TestRunExecDir(t *testing.T) {
if err != nil {
t.Fatal(err)
}
fi, err = os.Stat(contFile)
if err != nil {
t.Fatal(err)
}
}
rmCmd := exec.Command(dockerBinary, "rm", "-f", id)
out, _, err = runCommandWithOutput(rmCmd)