Signed-off-by: Daniel Nephin <dnephin@docker.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,45 +0,0 @@ |
| 1 |
-// +build !windows |
|
| 2 |
- |
|
| 3 |
-package main |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "encoding/json" |
|
| 7 |
- "strings" |
|
| 8 |
- |
|
| 9 |
- "github.com/docker/docker/pkg/integration/checker" |
|
| 10 |
- "github.com/docker/engine-api/types" |
|
| 11 |
- "github.com/docker/engine-api/types/swarm" |
|
| 12 |
- "github.com/go-check/check" |
|
| 13 |
-) |
|
| 14 |
- |
|
| 15 |
-func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
|
| 16 |
- d := s.AddDaemon(c, true, true) |
|
| 17 |
- out, err := d.Cmd("service", "create", "--mount", "type=volume,source=foo,target=/foo", "busybox", "top")
|
|
| 18 |
- c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 19 |
- id := strings.TrimSpace(out) |
|
| 20 |
- |
|
| 21 |
- var tasks []swarm.Task |
|
| 22 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
|
|
| 23 |
- tasks = d.getServiceTasks(c, id) |
|
| 24 |
- return len(tasks) > 0, nil |
|
| 25 |
- }, checker.Equals, true) |
|
| 26 |
- |
|
| 27 |
- task := tasks[0] |
|
| 28 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
|
|
| 29 |
- if task.NodeID == "" || task.Status.ContainerStatus.ContainerID == "" {
|
|
| 30 |
- task = d.getTask(c, task.ID) |
|
| 31 |
- } |
|
| 32 |
- return task.NodeID != "" && task.Status.ContainerStatus.ContainerID != "", nil |
|
| 33 |
- }, checker.Equals, true) |
|
| 34 |
- |
|
| 35 |
- out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
|
| 36 |
- c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 37 |
- |
|
| 38 |
- var mounts []types.MountPoint |
|
| 39 |
- c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 40 |
- c.Assert(mounts, checker.HasLen, 1) |
|
| 41 |
- |
|
| 42 |
- c.Assert(mounts[0].Name, checker.Equals, "foo") |
|
| 43 |
- c.Assert(mounts[0].Destination, checker.Equals, "/foo") |
|
| 44 |
- c.Assert(mounts[0].RW, checker.Equals, true) |
|
| 45 |
-} |
| 46 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,45 @@ |
| 0 |
+// +build !windows |
|
| 1 |
+ |
|
| 2 |
+package main |
|
| 3 |
+ |
|
| 4 |
+import ( |
|
| 5 |
+ "encoding/json" |
|
| 6 |
+ "strings" |
|
| 7 |
+ |
|
| 8 |
+ "github.com/docker/docker/pkg/integration/checker" |
|
| 9 |
+ "github.com/docker/engine-api/types" |
|
| 10 |
+ "github.com/docker/engine-api/types/swarm" |
|
| 11 |
+ "github.com/go-check/check" |
|
| 12 |
+) |
|
| 13 |
+ |
|
| 14 |
+func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
|
| 15 |
+ d := s.AddDaemon(c, true, true) |
|
| 16 |
+ out, err := d.Cmd("service", "create", "--mount", "type=volume,source=foo,target=/foo", "busybox", "top")
|
|
| 17 |
+ c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 18 |
+ id := strings.TrimSpace(out) |
|
| 19 |
+ |
|
| 20 |
+ var tasks []swarm.Task |
|
| 21 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
|
|
| 22 |
+ tasks = d.getServiceTasks(c, id) |
|
| 23 |
+ return len(tasks) > 0, nil |
|
| 24 |
+ }, checker.Equals, true) |
|
| 25 |
+ |
|
| 26 |
+ task := tasks[0] |
|
| 27 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
|
|
| 28 |
+ if task.NodeID == "" || task.Status.ContainerStatus.ContainerID == "" {
|
|
| 29 |
+ task = d.getTask(c, task.ID) |
|
| 30 |
+ } |
|
| 31 |
+ return task.NodeID != "" && task.Status.ContainerStatus.ContainerID != "", nil |
|
| 32 |
+ }, checker.Equals, true) |
|
| 33 |
+ |
|
| 34 |
+ out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
|
| 35 |
+ c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 36 |
+ |
|
| 37 |
+ var mounts []types.MountPoint |
|
| 38 |
+ c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 39 |
+ c.Assert(mounts, checker.HasLen, 1) |
|
| 40 |
+ |
|
| 41 |
+ c.Assert(mounts[0].Name, checker.Equals, "foo") |
|
| 42 |
+ c.Assert(mounts[0].Destination, checker.Equals, "/foo") |
|
| 43 |
+ c.Assert(mounts[0].RW, checker.Equals, true) |
|
| 44 |
+} |