Merge pull request #9089 from cpuguy83/8942_create_volumes_on_create

Initialize volumes when container is created
This commit is contained in:
Jessie Frazelle
2014-12-03 15:42:09 -08:00
3 changed files with 29 additions and 0 deletions
+19
View File
@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"os"
"os/exec"
"testing"
"time"
@@ -125,3 +126,21 @@ func TestCreateEchoStdout(t *testing.T) {
logDone("create - echo test123")
}
func TestCreateVolumesCreated(t *testing.T) {
name := "test_create_volume"
cmd(t, "create", "--name", name, "-v", "/foo", "busybox")
dir, err := inspectFieldMap(name, "Volumes", "/foo")
if err != nil {
t.Fatalf("Error getting volume host path: %q", err)
}
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
t.Fatalf("Volume was not created")
}
if err != nil {
t.Fatalf("Error statting volume host path: %q", err)
}
logDone("create - volumes are created")
}