summaryrefslogtreecommitdiff
path: root/integration-cli/docker_cli_volume_test.go
diff options
context:
space:
mode:
authorJohn Howard <jhoward@microsoft.com>2015-09-23 16:04:51 -0700
committerJohn Howard <jhoward@microsoft.com>2015-10-26 14:33:28 -0700
commit2af5034ce8faa1f93d81864aa25ec64527fac76b (patch)
treeb8b00db46b0196c6d0c69f654c4697eeaf15a67c /integration-cli/docker_cli_volume_test.go
parent7e275cf0e5e1edff77ce9b159e995e03f6ac3371 (diff)
downloaddocker-2af5034ce8faa1f93d81864aa25ec64527fac76b.tar.gz
Windows: Volume integration tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Diffstat (limited to 'integration-cli/docker_cli_volume_test.go')
-rw-r--r--integration-cli/docker_cli_volume_test.go42
1 files changed, 30 insertions, 12 deletions
diff --git a/integration-cli/docker_cli_volume_test.go b/integration-cli/docker_cli_volume_test.go
index a0c70693d5..71b89ba9b5 100644
--- a/integration-cli/docker_cli_volume_test.go
+++ b/integration-cli/docker_cli_volume_test.go
@@ -11,7 +11,9 @@ import (
)
func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
- testRequires(c, DaemonIsLinux)
+ if daemonPlatform == "windows" {
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
dockerCmd(c, "volume", "create")
_, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver"))
@@ -23,6 +25,9 @@ func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
}
func (s *DockerSuite) TestVolumeCliCreateOptionConflict(c *check.C) {
+ if daemonPlatform == "windows" {
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
dockerCmd(c, "volume", "create", "--name=test")
out, _, err := dockerCmdWithError("volume", "create", "--name", "test", "--driver", "nosuchdriver")
c.Assert(err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
@@ -35,7 +40,9 @@ func (s *DockerSuite) TestVolumeCliCreateOptionConflict(c *check.C) {
}
func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
- testRequires(c, DaemonIsLinux)
+ if daemonPlatform == "windows" {
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
c.Assert(
exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(),
check.Not(check.IsNil),
@@ -53,33 +60,40 @@ func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
}
func (s *DockerSuite) TestVolumeCliLs(c *check.C) {
- testRequires(c, DaemonIsLinux)
+ prefix := ""
+ if daemonPlatform == "windows" {
+ prefix = "c:"
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
out, _ := dockerCmd(c, "volume", "create")
id := strings.TrimSpace(out)
dockerCmd(c, "volume", "create", "--name", "test")
- dockerCmd(c, "run", "-v", "/foo", "busybox", "ls", "/")
+ dockerCmd(c, "run", "-v", prefix+"/foo", "busybox", "ls", "/")
out, _ = dockerCmd(c, "volume", "ls")
outArr := strings.Split(strings.TrimSpace(out), "\n")
c.Assert(len(outArr), check.Equals, 4, check.Commentf("\n%s", out))
- // Since there is no guarentee of ordering of volumes, we just make sure the names are in the output
+ // Since there is no guarantee of ordering of volumes, we just make sure the names are in the output
c.Assert(strings.Contains(out, id+"\n"), check.Equals, true)
c.Assert(strings.Contains(out, "test\n"), check.Equals, true)
}
func (s *DockerSuite) TestVolumeCliLsFilterDangling(c *check.C) {
- testRequires(c, DaemonIsLinux)
-
+ prefix := ""
+ if daemonPlatform == "windows" {
+ prefix = "c:"
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
dockerCmd(c, "volume", "create", "--name", "testnotinuse1")
dockerCmd(c, "volume", "create", "--name", "testisinuse1")
dockerCmd(c, "volume", "create", "--name", "testisinuse2")
// Make sure both "created" (but not started), and started
// containers are included in reference counting
- dockerCmd(c, "run", "--name", "volume-test1", "-v", "testisinuse1:/foo", "busybox", "true")
- dockerCmd(c, "create", "--name", "volume-test2", "-v", "testisinuse2:/foo", "busybox", "true")
+ dockerCmd(c, "run", "--name", "volume-test1", "-v", "testisinuse1:"+prefix+"/foo", "busybox", "true")
+ dockerCmd(c, "create", "--name", "volume-test2", "-v", "testisinuse2:"+prefix+"/foo", "busybox", "true")
out, _ := dockerCmd(c, "volume", "ls")
@@ -104,7 +118,11 @@ func (s *DockerSuite) TestVolumeCliLsFilterDangling(c *check.C) {
}
func (s *DockerSuite) TestVolumeCliRm(c *check.C) {
- testRequires(c, DaemonIsLinux)
+ prefix := ""
+ if daemonPlatform == "windows" {
+ prefix = "c:"
+ testRequires(c, WindowsDaemonSupportsVolumes)
+ }
out, _ := dockerCmd(c, "volume", "create")
id := strings.TrimSpace(out)
@@ -117,7 +135,7 @@ func (s *DockerSuite) TestVolumeCliRm(c *check.C) {
c.Assert(len(outArr), check.Equals, 1, check.Commentf("%s\n", out))
volumeID := "testing"
- dockerCmd(c, "run", "-v", volumeID+":/foo", "--name=test", "busybox", "sh", "-c", "echo hello > /foo/bar")
+ dockerCmd(c, "run", "-v", volumeID+":"+prefix+"/foo", "--name=test", "busybox", "sh", "-c", "echo hello > /foo/bar")
out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "volume", "rm", "testing"))
c.Assert(
err,
@@ -130,7 +148,7 @@ func (s *DockerSuite) TestVolumeCliRm(c *check.C) {
dockerCmd(c, "volume", "inspect", volumeID)
dockerCmd(c, "rm", "-f", "test")
- out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":/foo", "busybox", "sh", "-c", "cat /foo/bar")
+ out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":"+prefix+"/foo", "busybox", "sh", "-c", "cat /foo/bar")
c.Assert(strings.TrimSpace(out), check.Equals, "hello", check.Commentf("volume data was removed"))
dockerCmd(c, "rm", "test2")