2016-06-28 17:39:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *DockerSwarmSuite) TestStackRemove(c *check.C) {
|
2016-10-06 14:09:54 +00:00
|
|
|
testRequires(c, ExperimentalDaemon)
|
2016-06-28 17:39:49 +00:00
|
|
|
d := s.AddDaemon(c, true, true)
|
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
stackArgs := append([]string{"stack", "remove", "UNKNOWN_STACK"})
|
2016-06-28 17:39:49 +00:00
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
out, err := d.Cmd(stackArgs...)
|
2016-06-28 17:39:49 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(out, check.Equals, "Nothing found in stack: UNKNOWN_STACK\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSwarmSuite) TestStackTasks(c *check.C) {
|
2016-10-06 14:09:54 +00:00
|
|
|
testRequires(c, ExperimentalDaemon)
|
2016-06-28 17:39:49 +00:00
|
|
|
d := s.AddDaemon(c, true, true)
|
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
stackArgs := append([]string{"stack", "ps", "UNKNOWN_STACK"})
|
2016-06-28 17:39:49 +00:00
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
out, err := d.Cmd(stackArgs...)
|
2016-06-28 17:39:49 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(out, check.Equals, "Nothing found in stack: UNKNOWN_STACK\n")
|
|
|
|
}
|
2016-07-02 02:12:16 +00:00
|
|
|
|
|
|
|
func (s *DockerSwarmSuite) TestStackServices(c *check.C) {
|
2016-10-06 14:09:54 +00:00
|
|
|
testRequires(c, ExperimentalDaemon)
|
2016-07-02 02:12:16 +00:00
|
|
|
d := s.AddDaemon(c, true, true)
|
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
stackArgs := append([]string{"stack", "services", "UNKNOWN_STACK"})
|
2016-07-02 02:12:16 +00:00
|
|
|
|
2016-07-22 16:14:05 +00:00
|
|
|
out, err := d.Cmd(stackArgs...)
|
2016-07-02 02:12:16 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(out, check.Equals, "Nothing found in stack: UNKNOWN_STACK\n")
|
|
|
|
}
|
2016-06-23 05:00:21 +00:00
|
|
|
|
2016-11-04 20:55:24 +00:00
|
|
|
func (s *DockerSwarmSuite) TestStackDeployComposeFile(c *check.C) {
|
2016-10-06 14:09:54 +00:00
|
|
|
testRequires(c, ExperimentalDaemon)
|
2016-06-23 05:00:21 +00:00
|
|
|
d := s.AddDaemon(c, true, true)
|
2016-11-04 20:55:24 +00:00
|
|
|
|
|
|
|
testStackName := "testdeploy"
|
|
|
|
stackArgs := []string{
|
|
|
|
"stack", "deploy",
|
|
|
|
"--compose-file", "fixtures/deploy/default.yaml",
|
|
|
|
testStackName,
|
|
|
|
}
|
2016-06-23 05:00:21 +00:00
|
|
|
out, err := d.Cmd(stackArgs...)
|
2016-11-04 20:55:24 +00:00
|
|
|
c.Assert(err, checker.IsNil, check.Commentf(out))
|
|
|
|
|
|
|
|
out, err = d.Cmd([]string{"stack", "ls"}...)
|
2016-06-23 05:00:21 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
2016-11-04 20:55:24 +00:00
|
|
|
c.Assert(out, check.Equals, "NAME SERVICES\n"+"testdeploy 2\n")
|
2016-10-12 17:24:19 +00:00
|
|
|
|
2016-11-04 20:55:24 +00:00
|
|
|
out, err = d.Cmd([]string{"stack", "rm", testStackName}...)
|
2016-10-12 17:24:19 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
2016-11-04 20:55:24 +00:00
|
|
|
out, err = d.Cmd([]string{"stack", "ls"}...)
|
2016-10-12 17:24:19 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
2016-11-04 20:55:24 +00:00
|
|
|
c.Assert(out, check.Equals, "NAME SERVICES\n")
|
2016-10-12 17:24:19 +00:00
|
|
|
}
|