mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
integration: use %s for check.Commentf()
It is wrong to pass an arbitrary string to a function expecting %-style formatting. One solution would be to replace any % with %%, but it's easier to just do what this patch does. Generated with: for f in $(git grep -l 'check.Commentf(out)'); do \ sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \ done Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
1fd7e4c28d
commit
83363fb2d4
28 changed files with 285 additions and 285 deletions
|
@ -200,7 +200,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) {
|
||||||
func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *check.C) {
|
func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *check.C) {
|
||||||
if s.reg != nil {
|
if s.reg != nil {
|
||||||
out, err := s.d.Cmd("logout", privateRegistryURL)
|
out, err := s.d.Cmd("logout", privateRegistryURL)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
s.reg.Close()
|
s.reg.Close()
|
||||||
}
|
}
|
||||||
if s.d != nil {
|
if s.d != nil {
|
||||||
|
@ -233,7 +233,7 @@ func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
|
||||||
func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) {
|
func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) {
|
||||||
if s.reg != nil {
|
if s.reg != nil {
|
||||||
out, err := s.d.Cmd("logout", privateRegistryURL)
|
out, err := s.d.Cmd("logout", privateRegistryURL)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
s.reg.Close()
|
s.reg.Close()
|
||||||
}
|
}
|
||||||
if s.d != nil {
|
if s.d != nil {
|
||||||
|
|
|
@ -156,7 +156,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
|
||||||
// create a different tag
|
// create a different tag
|
||||||
for _, d := range daemons {
|
for _, d := range daemons {
|
||||||
out, err := d.Cmd("tag", image1, image2)
|
out, err := d.Cmd("tag", image1, image2)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
// create service
|
// create service
|
||||||
|
@ -188,7 +188,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
|
||||||
// Roll back to the previous version. This uses the CLI because
|
// Roll back to the previous version. This uses the CLI because
|
||||||
// rollback used to be a client-side operation.
|
// rollback used to be a client-side operation.
|
||||||
out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
|
out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// first batch
|
// first batch
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
|
waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
|
||||||
|
@ -297,7 +297,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) {
|
||||||
// Roll back to the previous version. This uses the CLI because
|
// Roll back to the previous version. This uses the CLI because
|
||||||
// rollback is a client-side operation.
|
// rollback is a client-side operation.
|
||||||
out, err := d.Cmd("service", "update", "--detach", "--rollback", id)
|
out, err := d.Cmd("service", "update", "--detach", "--rollback", id)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// first batch
|
// first batch
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckRunningTaskImages, checker.DeepEquals,
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckRunningTaskImages, checker.DeepEquals,
|
||||||
|
@ -342,7 +342,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *check.C) {
|
||||||
// Roll back to the previous version. This uses the CLI because
|
// Roll back to the previous version. This uses the CLI because
|
||||||
// rollback used to be a client-side operation.
|
// rollback used to be a client-side operation.
|
||||||
out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
|
out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
|
waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
|
||||||
map[string]int{image1: instances})
|
map[string]int{image1: instances})
|
||||||
|
|
|
@ -923,7 +923,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "lb")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "lb")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
instances := 1
|
instances := 1
|
||||||
d.CreateService(c, simpleTestService, setInstances(instances), func(s *swarm.Service) {
|
d.CreateService(c, simpleTestService, setInstances(instances), func(s *swarm.Service) {
|
||||||
|
@ -941,7 +941,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) {
|
||||||
containers := d.ActiveContainers(c)
|
containers := d.ActiveContainers(c)
|
||||||
|
|
||||||
out, err = d.Cmd("exec", containers[0], "ping", "-c1", "-W3", "top")
|
out, err = d.Cmd("exec", containers[0], "ping", "-c1", "-W3", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
|
func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (s *DockerSwarmSuite) TestConfigCreateWithFile(c *check.C) {
|
||||||
testName := "test_config"
|
testName := "test_config"
|
||||||
out, err := d.Cmd("config", "create", testName, testFile.Name())
|
out, err := d.Cmd("config", "create", testName, testFile.Name())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf(out))
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf("%s", out))
|
||||||
|
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
config := d.GetConfig(c, id)
|
config := d.GetConfig(c, id)
|
||||||
|
|
|
@ -243,7 +243,7 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
|
out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
|
||||||
}
|
}
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// It *should* have copied the directory using the asked name "dir_link".
|
// It *should* have copied the directory using the asked name "dir_link".
|
||||||
stat, err = os.Lstat(expectedPath)
|
stat, err = os.Lstat(expectedPath)
|
||||||
|
@ -315,7 +315,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
|
out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
|
||||||
}
|
}
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// It *should* have copied the directory using the asked name "dir_link".
|
// It *should* have copied the directory using the asked name "dir_link".
|
||||||
stat, err = os.Lstat(expectedPath)
|
stat, err = os.Lstat(expectedPath)
|
||||||
|
|
|
@ -75,7 +75,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) {
|
||||||
|
|
||||||
// Ensure this fails because of the defaultBaseFsSize is 10G
|
// Ensure this fails because of the defaultBaseFsSize is 10G
|
||||||
out, _, err := dockerCmdWithError("create", "--storage-opt", "size=5G", "busybox")
|
out, _, err := dockerCmdWithError("create", "--storage-opt", "size=5G", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Container size cannot be smaller than")
|
c.Assert(out, checker.Contains, "Container size cannot be smaller than")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,10 +225,10 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
|
||||||
c.Assert(out, checker.Contains, pName)
|
c.Assert(out, checker.Contains, pName)
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
|
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "ls", destDir+destFile)
|
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "ls", destDir+destFile)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
|
func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
|
||||||
|
@ -237,26 +237,26 @@ func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
|
||||||
s.d.Start(c, "--live-restore=true")
|
s.d.Start(c, "--live-restore=true")
|
||||||
|
|
||||||
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName)
|
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, pName)
|
c.Assert(strings.TrimSpace(out), checker.Contains, pName)
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "create", "--driver", pName, "test")
|
out, err = s.d.Cmd("volume", "create", "--driver", pName, "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
s.d.Restart(c, "--live-restore=true")
|
s.d.Restart(c, "--live-restore=true")
|
||||||
|
|
||||||
out, err = s.d.Cmd("plugin", "disable", pName)
|
out, err = s.d.Cmd("plugin", "disable", pName)
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "in use")
|
c.Assert(out, checker.Contains, "in use")
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "rm", "test")
|
out, err = s.d.Cmd("volume", "rm", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("plugin", "disable", pName)
|
out, err = s.d.Cmd("plugin", "disable", pName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("plugin", "rm", pName)
|
out, err = s.d.Cmd("plugin", "rm", pName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func existsMountpointWithPrefix(mountpointPrefix string) (bool, error) {
|
func existsMountpointWithPrefix(mountpointPrefix string) (bool, error) {
|
||||||
|
@ -278,7 +278,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
|
||||||
s.d.Start(c)
|
s.d.Start(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
|
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
|
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
|
||||||
|
@ -306,7 +306,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
|
||||||
s.d.Start(c)
|
s.d.Start(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
|
out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
|
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
|
||||||
|
|
|
@ -142,10 +142,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *check.C) {
|
||||||
testRun(map[string]bool{"top1": true, "top2": true}, "")
|
testRun(map[string]bool{"top1": true, "top2": true}, "")
|
||||||
|
|
||||||
out, err = s.d.Cmd("stop", "top1")
|
out, err = s.d.Cmd("stop", "top1")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("stop", "top2")
|
out, err = s.d.Cmd("stop", "top2")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// both stopped
|
// both stopped
|
||||||
testRun(map[string]bool{"top1": false, "top2": false}, "")
|
testRun(map[string]bool{"top1": false, "top2": false}, "")
|
||||||
|
@ -426,13 +426,13 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) {
|
||||||
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
|
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
|
||||||
out = strings.Trim(out, " \r\n'")
|
out = strings.Trim(out, " \r\n'")
|
||||||
|
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
ip := net.ParseIP(out)
|
ip := net.ParseIP(out)
|
||||||
c.Assert(ip, checker.NotNil, check.Commentf("Container should have a global IPv6 address"))
|
c.Assert(ip, checker.NotNil, check.Commentf("Container should have a global IPv6 address"))
|
||||||
|
|
||||||
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.IPv6Gateway}}", "ipv6test")
|
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.IPv6Gateway}}", "ipv6test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:2::100", check.Commentf("Container should have a global IPv6 gateway"))
|
c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:2::100", check.Commentf("Container should have a global IPv6 gateway"))
|
||||||
}
|
}
|
||||||
|
@ -738,7 +738,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
|
||||||
defer s.d.Restart(c)
|
defer s.d.Restart(c)
|
||||||
|
|
||||||
out, err := d.Cmd("run", "-d", "--name", "bb", "busybox", "top")
|
out, err := d.Cmd("run", "-d", "--name", "bb", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
defer d.Cmd("stop", "bb")
|
defer d.Cmd("stop", "bb")
|
||||||
|
|
||||||
out, err = d.Cmd("exec", "bb", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
out, err = d.Cmd("exec", "bb", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
||||||
|
@ -746,7 +746,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
|
||||||
c.Assert(out, checker.Equals, "10.2.2.0\n")
|
c.Assert(out, checker.Equals, "10.2.2.0\n")
|
||||||
|
|
||||||
out, err = d.Cmd("run", "--rm", "busybox", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
out, err = d.Cmd("run", "--rm", "busybox", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Equals, "10.2.2.2\n")
|
c.Assert(out, checker.Equals, "10.2.2.2\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,7 +763,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCIDREqualBridgeNetwork(c *check
|
||||||
defer s.d.Restart(c)
|
defer s.d.Restart(c)
|
||||||
|
|
||||||
out, err := d.Cmd("run", "-d", "busybox", "top")
|
out, err := d.Cmd("run", "-d", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
cid1 := strings.TrimSpace(out)
|
cid1 := strings.TrimSpace(out)
|
||||||
defer d.Cmd("stop", cid1)
|
defer d.Cmd("stop", cid1)
|
||||||
}
|
}
|
||||||
|
@ -924,10 +924,10 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
|
||||||
check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
||||||
|
|
||||||
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("run", "--link", "icc1:icc1", "busybox", "nc", "icc1", "4567")
|
out, err = d.Cmd("run", "--link", "icc1:icc1", "busybox", "nc", "icc1", "4567")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *check.C) {
|
func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *check.C) {
|
||||||
|
@ -1033,7 +1033,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
id, err := s.d.GetIDByName("test")
|
id, err := s.d.GetIDByName("test")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) {
|
||||||
s.d.StartWithBusybox(c, "--log-driver=none")
|
s.d.StartWithBusybox(c, "--log-driver=none")
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("logs", "test")
|
out, err = s.d.Cmd("logs", "test")
|
||||||
c.Assert(err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
c.Assert(err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
||||||
|
@ -1638,7 +1638,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("create", "-v", "test:/foo", "busybox")
|
out, err := s.d.Cmd("create", "-v", "test:/foo", "busybox")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
s.d.Restart(c)
|
s.d.Restart(c)
|
||||||
|
|
||||||
|
@ -1887,22 +1887,22 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
out, err := s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--name=test2", "--link", "test:abc", "busybox", "sh", "-c", "ping -c 1 -w 1 abc")
|
out, err = s.d.Cmd("run", "--name=test2", "--link", "test:abc", "busybox", "sh", "-c", "ping -c 1 -w 1 abc")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
s.d.Restart(c)
|
s.d.Restart(c)
|
||||||
|
|
||||||
// should fail since test is not running yet
|
// should fail since test is not running yet
|
||||||
out, err = s.d.Cmd("start", "test2")
|
out, err = s.d.Cmd("start", "test2")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("start", "test")
|
out, err = s.d.Cmd("start", "test")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
out, err = s.d.Cmd("start", "-a", "test2")
|
out, err = s.d.Cmd("start", "-a", "test2")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf(out))
|
c.Assert(strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
||||||
|
@ -1910,10 +1910,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("create", "--name=test", "busybox")
|
out, err := s.d.Cmd("create", "--name=test", "busybox")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "-d", "--name=test2", "busybox", "top")
|
out, err = s.d.Cmd("run", "-d", "--name=test2", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
test2ID := strings.TrimSpace(out)
|
test2ID := strings.TrimSpace(out)
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top")
|
out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top")
|
||||||
|
@ -1926,10 +1926,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
||||||
c.Assert(err, check.NotNil, check.Commentf("expected error trying to create container with duplicate name"))
|
c.Assert(err, check.NotNil, check.Commentf("expected error trying to create container with duplicate name"))
|
||||||
// this one is no longer needed, removing simplifies the remainder of the test
|
// this one is no longer needed, removing simplifies the remainder of the test
|
||||||
out, err = s.d.Cmd("rm", "-f", "test")
|
out, err = s.d.Cmd("rm", "-f", "test")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("ps", "-a", "--no-trunc")
|
out, err = s.d.Cmd("ps", "-a", "--no-trunc")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
lines := strings.Split(strings.TrimSpace(out), "\n")[1:]
|
lines := strings.Split(strings.TrimSpace(out), "\n")[1:]
|
||||||
|
|
||||||
|
@ -2112,24 +2112,24 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
out, err := s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--name=test2", "--link=test:abc", "busybox", "sh", "-c", "ping -c 1 abc")
|
out, err = s.d.Cmd("run", "--name=test2", "--link=test:abc", "busybox", "sh", "-c", "ping -c 1 abc")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "1 packets transmitted, 1 packets received")
|
c.Assert(out, checker.Contains, "1 packets transmitted, 1 packets received")
|
||||||
|
|
||||||
out, err = s.d.Cmd("rm", "-f", "test")
|
out, err = s.d.Cmd("rm", "-f", "test")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
out, err = s.d.Cmd("run", "-d", "--name=test", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
out, err = s.d.Cmd("start", "-a", "test2")
|
out, err = s.d.Cmd("start", "-a", "test2")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received")
|
c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received")
|
||||||
|
|
||||||
s.d.Restart(c)
|
s.d.Restart(c)
|
||||||
out, err = s.d.Cmd("start", "-a", "test2")
|
out, err = s.d.Cmd("start", "-a", "test2")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received")
|
c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2253,11 +2253,11 @@ func (s *DockerDaemonSuite) TestDaemonLogOptions(c *check.C) {
|
||||||
s.d.StartWithBusybox(c, "--log-driver=syslog", "--log-opt=syslog-address=udp://127.0.0.1:514")
|
s.d.StartWithBusybox(c, "--log-driver=syslog", "--log-opt=syslog-address=udp://127.0.0.1:514")
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "-d", "--log-driver=json-file", "busybox", "top")
|
out, err := s.d.Cmd("run", "-d", "--log-driver=json-file", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
out, err = s.d.Cmd("inspect", "--format='{{.HostConfig.LogConfig}}'", id)
|
out, err = s.d.Cmd("inspect", "--format='{{.HostConfig.LogConfig}}'", id)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "{json-file map[]}")
|
c.Assert(out, checker.Contains, "{json-file map[]}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2428,19 +2428,19 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
||||||
|
|
||||||
// Run with default runtime
|
// Run with default runtime
|
||||||
out, err := s.d.Cmd("run", "--rm", "busybox", "ls")
|
out, err := s.d.Cmd("run", "--rm", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with default runtime explicitly
|
// Run with default runtime explicitly
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with oci (same path as default) but keep it around
|
// Run with oci (same path as default) but keep it around
|
||||||
out, err = s.d.Cmd("run", "--name", "oci-runtime-ls", "--runtime=oci", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--name", "oci-runtime-ls", "--runtime=oci", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with "vm"
|
// Run with "vm"
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
||||||
|
|
||||||
// Reset config to only have the default
|
// Reset config to only have the default
|
||||||
|
@ -2457,16 +2457,16 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
||||||
|
|
||||||
// Run with default runtime
|
// Run with default runtime
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with "oci"
|
// Run with "oci"
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
||||||
|
|
||||||
// Start previously created container with oci
|
// Start previously created container with oci
|
||||||
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
||||||
|
|
||||||
// Check that we can't override the default runtime
|
// Check that we can't override the default runtime
|
||||||
|
@ -2511,12 +2511,12 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
||||||
<-time.After(1 * time.Second)
|
<-time.After(1 * time.Second)
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
||||||
|
|
||||||
// Run with default runtime explicitly
|
// Run with default runtime explicitly
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
||||||
|
@ -2524,19 +2524,19 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
||||||
|
|
||||||
// Run with default runtime
|
// Run with default runtime
|
||||||
out, err := s.d.Cmd("run", "--rm", "busybox", "ls")
|
out, err := s.d.Cmd("run", "--rm", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with default runtime explicitly
|
// Run with default runtime explicitly
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with oci (same path as default) but keep it around
|
// Run with oci (same path as default) but keep it around
|
||||||
out, err = s.d.Cmd("run", "--name", "oci-runtime-ls", "--runtime=oci", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--name", "oci-runtime-ls", "--runtime=oci", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with "vm"
|
// Run with "vm"
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
||||||
|
|
||||||
// Start a daemon without any extra runtimes
|
// Start a daemon without any extra runtimes
|
||||||
|
@ -2545,16 +2545,16 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
||||||
|
|
||||||
// Run with default runtime
|
// Run with default runtime
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Run with "oci"
|
// Run with "oci"
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
||||||
|
|
||||||
// Start previously created container with oci
|
// Start previously created container with oci
|
||||||
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
c.Assert(out, checker.Contains, "Unknown runtime specified oci")
|
||||||
|
|
||||||
// Check that we can't override the default runtime
|
// Check that we can't override the default runtime
|
||||||
|
@ -2570,12 +2570,12 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
||||||
s.d.StartWithBusybox(c, "--default-runtime=vm", "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager")
|
s.d.StartWithBusybox(c, "--default-runtime=vm", "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager")
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory")
|
||||||
|
|
||||||
// Run with default runtime explicitly
|
// Run with default runtime explicitly
|
||||||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) {
|
func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) {
|
||||||
|
@ -2658,17 +2658,17 @@ func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
|
||||||
// custom one
|
// custom one
|
||||||
s.d.StartWithBusybox(c, "--userland-proxy-path", newProxyPath)
|
s.d.StartWithBusybox(c, "--userland-proxy-path", newProxyPath)
|
||||||
out, err := s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
out, err := s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// try with the original one
|
// try with the original one
|
||||||
s.d.Restart(c, "--userland-proxy-path", dockerProxyPath)
|
s.d.Restart(c, "--userland-proxy-path", dockerProxyPath)
|
||||||
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// not exist
|
// not exist
|
||||||
s.d.Restart(c, "--userland-proxy-path", "/does/not/exist")
|
s.d.Restart(c, "--userland-proxy-path", "/does/not/exist")
|
||||||
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "driver failed programming external connectivity on endpoint")
|
c.Assert(out, checker.Contains, "driver failed programming external connectivity on endpoint")
|
||||||
c.Assert(out, checker.Contains, "/does/not/exist: no such file or directory")
|
c.Assert(out, checker.Contains, "/does/not/exist: no such file or directory")
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,11 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
||||||
containerEvents := eventActionsByIDAndType(c, events, name, "container")
|
containerEvents := eventActionsByIDAndType(c, events, name, "container")
|
||||||
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
||||||
|
|
||||||
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
|
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
|
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
|
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
|
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
|
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,11 +93,11 @@ func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
||||||
containerEvents := eventActionsByIDAndType(c, events, "container-events-test", "container")
|
containerEvents := eventActionsByIDAndType(c, events, "container-events-test", "container")
|
||||||
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
||||||
|
|
||||||
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
|
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
|
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
|
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
|
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
|
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) {
|
func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) {
|
||||||
|
@ -136,11 +136,11 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
|
||||||
containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container")
|
containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container")
|
||||||
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
||||||
|
|
||||||
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
|
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
|
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
|
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
|
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
|
||||||
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
|
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
||||||
|
@ -262,10 +262,10 @@ func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
|
||||||
pluginEvents := eventActionsByIDAndType(c, events, pNameWithTag, "plugin")
|
pluginEvents := eventActionsByIDAndType(c, events, pNameWithTag, "plugin")
|
||||||
c.Assert(pluginEvents, checker.HasLen, 4, check.Commentf("events: %v", events))
|
c.Assert(pluginEvents, checker.HasLen, 4, check.Commentf("events: %v", events))
|
||||||
|
|
||||||
c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf(out))
|
c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf("%s", out))
|
||||||
c.Assert(pluginEvents[1], checker.Equals, "enable", check.Commentf(out))
|
c.Assert(pluginEvents[1], checker.Equals, "enable", check.Commentf("%s", out))
|
||||||
c.Assert(pluginEvents[2], checker.Equals, "disable", check.Commentf(out))
|
c.Assert(pluginEvents[2], checker.Equals, "disable", check.Commentf("%s", out))
|
||||||
c.Assert(pluginEvents[3], checker.Equals, "remove", check.Commentf(out))
|
c.Assert(pluginEvents[3], checker.Equals, "remove", check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
||||||
|
@ -633,7 +633,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
|
||||||
)
|
)
|
||||||
|
|
||||||
events := strings.Split(strings.TrimSpace(out), "\n")
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
||||||
c.Assert(len(events), checker.Equals, 1, check.Commentf(out))
|
c.Assert(len(events), checker.Equals, 1, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, _ = dockerCmd(
|
out, _ = dockerCmd(
|
||||||
c,
|
c,
|
||||||
|
@ -643,7 +643,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
|
||||||
"--filter",
|
"--filter",
|
||||||
"event=exec_create",
|
"event=exec_create",
|
||||||
)
|
)
|
||||||
c.Assert(len(events), checker.Equals, 1, check.Commentf(out))
|
c.Assert(len(events), checker.Equals, 1, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
||||||
|
@ -653,7 +653,7 @@ func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "events", "--filter", "image=busybox", "--since", since, "--until", daemonUnixTime(c))
|
out, _ := dockerCmd(c, "events", "--filter", "image=busybox", "--since", since, "--until", daemonUnixTime(c))
|
||||||
events := strings.Split(strings.TrimSpace(out), "\n")
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
||||||
c.Assert(len(events), checker.GreaterThan, 1, check.Commentf(out))
|
c.Assert(len(events), checker.GreaterThan, 1, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
|
func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
|
||||||
|
|
|
@ -135,8 +135,8 @@ func (s *DockerSuite) TestEventsContainerFilterByName(c *check.C) {
|
||||||
c2 := strings.TrimSpace(cOut)
|
c2 := strings.TrimSpace(cOut)
|
||||||
waitRun("bar")
|
waitRun("bar")
|
||||||
out, _ := dockerCmd(c, "events", "-f", "container=foo", "--since=0", "--until", daemonUnixTime(c))
|
out, _ := dockerCmd(c, "events", "-f", "container=foo", "--since=0", "--until", daemonUnixTime(c))
|
||||||
c.Assert(out, checker.Contains, c1, check.Commentf(out))
|
c.Assert(out, checker.Contains, c1, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Contains), c2, check.Commentf(out))
|
c.Assert(out, checker.Not(checker.Contains), c2, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
// #18453
|
// #18453
|
||||||
|
@ -351,7 +351,7 @@ func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *check.C) {
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "events", "--filter", "type=volume", "--filter", "type=network", "--since", since, "--until", daemonUnixTime(c))
|
out, _ := dockerCmd(c, "events", "--filter", "type=volume", "--filter", "type=network", "--since", since, "--until", daemonUnixTime(c))
|
||||||
events := strings.Split(strings.TrimSpace(out), "\n")
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
||||||
c.Assert(len(events), checker.GreaterOrEqualThan, 2, check.Commentf(out))
|
c.Assert(len(events), checker.GreaterOrEqualThan, 2, check.Commentf("%s", out))
|
||||||
|
|
||||||
networkActions := eventActionsByIDAndType(c, events, "test-event-network-type", "network")
|
networkActions := eventActionsByIDAndType(c, events, "test-event-network-type", "network")
|
||||||
volumeActions := eventActionsByIDAndType(c, events, "test-event-volume-type", "volume")
|
volumeActions := eventActionsByIDAndType(c, events, "test-event-volume-type", "volume")
|
||||||
|
|
|
@ -164,7 +164,7 @@ func (s *DockerSuite) TestExecTTYCloseStdin(c *check.C) {
|
||||||
stdinRw.Close()
|
stdinRw.Close()
|
||||||
|
|
||||||
out, _, err := runCommandWithOutput(cmd)
|
out, _, err := runCommandWithOutput(cmd)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "top", "exec_tty_stdin")
|
out, _ = dockerCmd(c, "top", "exec_tty_stdin")
|
||||||
outArr := strings.Split(out, "\n")
|
outArr := strings.Split(out, "\n")
|
||||||
|
@ -517,7 +517,7 @@ func (s *DockerSuite) TestExecStartFails(c *check.C) {
|
||||||
c.Assert(waitRun(name), checker.IsNil)
|
c.Assert(waitRun(name), checker.IsNil)
|
||||||
|
|
||||||
out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
|
out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "executable file not found")
|
c.Assert(out, checker.Contains, "executable file not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, s.Server.URL)
|
c.Assert(out, checker.Contains, s.Server.URL)
|
||||||
|
|
||||||
_, err = s.d.Cmd("volume", "rm", "external-volume-test")
|
_, err = s.d.Cmd("volume", "rm", "external-volume-test")
|
||||||
|
@ -320,7 +320,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C)
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, s.Server.URL)
|
c.Assert(out, checker.Contains, s.Server.URL)
|
||||||
|
|
||||||
c.Assert(s.ec.activations, checker.Equals, 1)
|
c.Assert(s.ec.activations, checker.Equals, 1)
|
||||||
|
@ -334,13 +334,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
|
out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "--volumes-from", "vol-test1", "--name", "vol-test2", "busybox", "ls", "/tmp")
|
out, err = s.d.Cmd("run", "--rm", "--volumes-from", "vol-test1", "--name", "vol-test2", "busybox", "ls", "/tmp")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
c.Assert(s.ec.activations, checker.Equals, 1)
|
c.Assert(s.ec.activations, checker.Equals, 1)
|
||||||
c.Assert(s.ec.creations, checker.Equals, 1)
|
c.Assert(s.ec.creations, checker.Equals, 1)
|
||||||
|
@ -353,10 +353,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *c
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
|
out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
c.Assert(s.ec.activations, checker.Equals, 1)
|
c.Assert(s.ec.activations, checker.Equals, 1)
|
||||||
c.Assert(s.ec.creations, checker.Equals, 1)
|
c.Assert(s.ec.creations, checker.Equals, 1)
|
||||||
|
@ -453,7 +453,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c
|
||||||
}
|
}
|
||||||
out := inspectFieldJSON(c, "testing", "Mounts")
|
out := inspectFieldJSON(c, "testing", "Mounts")
|
||||||
c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil)
|
c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil)
|
||||||
c.Assert(len(mounts), checker.Equals, 1, check.Commentf(out))
|
c.Assert(len(mounts), checker.Equals, 1, check.Commentf("%s", out))
|
||||||
c.Assert(mounts[0].Name, checker.Equals, "foo")
|
c.Assert(mounts[0].Name, checker.Equals, "foo")
|
||||||
c.Assert(mounts[0].Driver, checker.Equals, volumePluginName)
|
c.Assert(mounts[0].Driver, checker.Equals, volumePluginName)
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
|
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
|
||||||
out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
|
out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "No such volume")
|
c.Assert(out, checker.Contains, "No such volume")
|
||||||
c.Assert(s.ec.gets, check.Equals, 1)
|
c.Assert(s.ec.gets, check.Equals, 1)
|
||||||
|
|
||||||
|
@ -509,10 +509,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *
|
||||||
s.d.Start(c)
|
s.d.Start(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, "abc2", "--opt", "ninja=1")
|
out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, "abc2", "--opt", "ninja=1")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "inspect", "abc2")
|
out, err = s.d.Cmd("volume", "inspect", "abc2")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "No such volume")
|
c.Assert(out, checker.Contains, "No such volume")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,11 +525,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C
|
||||||
c.Assert(s.ec.paths, checker.Equals, 0)
|
c.Assert(s.ec.paths, checker.Equals, 0)
|
||||||
|
|
||||||
out, err := s.d.Cmd("volume", "create", "test", "--driver=test-external-volume-driver")
|
out, err := s.d.Cmd("volume", "create", "test", "--driver=test-external-volume-driver")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(s.ec.paths, checker.Equals, 0)
|
c.Assert(s.ec.paths, checker.Equals, 0)
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "ls")
|
out, err = s.d.Cmd("volume", "ls")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(s.ec.paths, checker.Equals, 0)
|
c.Assert(s.ec.paths, checker.Equals, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C)
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("run", "--rm", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
out, err := s.d.Cmd("run", "--rm", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *chec
|
||||||
|
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, fmt.Sprintf("test%d", i))
|
out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, fmt.Sprintf("test%d", i))
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(s.ec.caps, checker.Equals, 1)
|
c.Assert(s.ec.caps, checker.Equals, 1)
|
||||||
out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i))
|
out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i))
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -564,10 +564,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
out, err := s.d.Cmd("volume", "create", "-d", driverName, "--name", "test")
|
out, err := s.d.Cmd("volume", "create", "-d", driverName, "--name", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "must be unique")
|
c.Assert(out, checker.Contains, "must be unique")
|
||||||
|
|
||||||
// simulate out of band volume deletion on plugin level
|
// simulate out of band volume deletion on plugin level
|
||||||
|
@ -575,9 +575,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
|
||||||
|
|
||||||
// test re-create with same driver
|
// test re-create with same driver
|
||||||
out, err = s.d.Cmd("volume", "create", "-d", driverName, "--opt", "foo=bar", "--name", "test")
|
out, err = s.d.Cmd("volume", "create", "-d", driverName, "--opt", "foo=bar", "--name", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
out, err = s.d.Cmd("volume", "inspect", "test")
|
out, err = s.d.Cmd("volume", "inspect", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
var vs []types.Volume
|
var vs []types.Volume
|
||||||
err = json.Unmarshal([]byte(out), &vs)
|
err = json.Unmarshal([]byte(out), &vs)
|
||||||
|
@ -593,10 +593,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
|
||||||
|
|
||||||
// test create with different driver
|
// test create with different driver
|
||||||
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "inspect", "test")
|
out, err = s.d.Cmd("volume", "inspect", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
vs = nil
|
vs = nil
|
||||||
err = json.Unmarshal([]byte(out), &vs)
|
err = json.Unmarshal([]byte(out), &vs)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -610,9 +610,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c
|
||||||
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
|
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
|
||||||
|
|
||||||
out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
|
out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
|
||||||
c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf(out))
|
c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
||||||
out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
|
out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
|
||||||
c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf(out))
|
c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check.C) {
|
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check.C) {
|
||||||
|
@ -620,12 +620,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check
|
||||||
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
|
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
|
||||||
|
|
||||||
out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
|
out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
|
||||||
c.Assert(s.ec.mounts, checker.Equals, 1, check.Commentf(out))
|
c.Assert(s.ec.mounts, checker.Equals, 1, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
|
out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
|
||||||
c.Assert(s.ec.mounts, checker.Equals, 2, check.Commentf(out))
|
c.Assert(s.ec.mounts, checker.Equals, 2, check.Commentf("%s", out))
|
||||||
c.Assert(s.ec.unmounts, checker.Equals, 1, check.Commentf(out))
|
c.Assert(s.ec.unmounts, checker.Equals, 1, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, _ = s.d.Cmd("kill", "test")
|
out, _ = s.d.Cmd("kill", "test")
|
||||||
c.Assert(s.ec.unmounts, checker.Equals, 2, check.Commentf(out))
|
c.Assert(s.ec.unmounts, checker.Equals, 2, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
|
||||||
func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) {
|
func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) {
|
||||||
// wrong credentials
|
// wrong credentials
|
||||||
out, _, err := dockerCmdWithError("login", "-u", s.reg.Username(), "-p", "WRONGPASSWORD", privateRegistryURL)
|
out, _, err := dockerCmdWithError("login", "-u", s.reg.Username(), "-p", "WRONGPASSWORD", privateRegistryURL)
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "401 Unauthorized")
|
c.Assert(out, checker.Contains, "401 Unauthorized")
|
||||||
|
|
||||||
// now it's fine
|
// now it's fine
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C)
|
||||||
|
|
||||||
// check I cannot pull anymore
|
// check I cannot pull anymore
|
||||||
out, err := s.d.Cmd("--config", tmp, "pull", repoName)
|
out, err := s.d.Cmd("--config", tmp, "pull", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "no basic auth credentials")
|
c.Assert(out, checker.Contains, "no basic auth credentials")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ func (s *DockerSuite) TestLogsWithDetails(c *check.C) {
|
||||||
out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test")
|
out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test")
|
||||||
|
|
||||||
logFields := strings.Fields(strings.TrimSpace(out))
|
logFields := strings.Fields(strings.TrimSpace(out))
|
||||||
c.Assert(len(logFields), checker.Equals, 3, check.Commentf(out))
|
c.Assert(len(logFields), checker.Equals, 3, check.Commentf("%s", out))
|
||||||
|
|
||||||
details := strings.Split(logFields[1], ",")
|
details := strings.Split(logFields[1], ",")
|
||||||
c.Assert(details, checker.HasLen, 2)
|
c.Assert(details, checker.HasLen, 2)
|
||||||
|
|
|
@ -847,11 +847,11 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *
|
||||||
// but discovery is on when connecting to non default bridge network
|
// but discovery is on when connecting to non default bridge network
|
||||||
network := "anotherbridge"
|
network := "anotherbridge"
|
||||||
out, err = s.d.Cmd("network", "create", network)
|
out, err = s.d.Cmd("network", "create", network)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
defer s.d.Cmd("network", "rm", network)
|
defer s.d.Cmd("network", "rm", network)
|
||||||
|
|
||||||
out, err = s.d.Cmd("network", "connect", network, cid1)
|
out, err = s.d.Cmd("network", "connect", network, cid1)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
hosts, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
hosts, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -1063,14 +1063,14 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
|
||||||
func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) {
|
func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) {
|
||||||
// Run a container on the default network
|
// Run a container on the default network
|
||||||
out, err := d.Cmd("run", "-d", "--name", cName, "busybox", "top")
|
out, err := d.Cmd("run", "-d", "--name", cName, "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Attach the container to other networks
|
// Attach the container to other networks
|
||||||
for _, nw := range nws {
|
for _, nw := range nws {
|
||||||
out, err = d.Cmd("network", "create", nw)
|
out, err = d.Cmd("network", "create", nw)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
out, err = d.Cmd("network", "connect", nw, cName)
|
out, err = d.Cmd("network", "connect", nw, cName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,7 +1078,7 @@ func verifyContainerIsConnectedToNetworks(c *check.C, d *daemon.Daemon, cName st
|
||||||
// Verify container is connected to all the networks
|
// Verify container is connected to all the networks
|
||||||
for _, nw := range nws {
|
for _, nw := range nws {
|
||||||
out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName)
|
out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Equals), "<no value>\n")
|
c.Assert(out, checker.Not(checker.Equals), "<no value>\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1137,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
cName := fmt.Sprintf("hostc-%d", i)
|
cName := fmt.Sprintf("hostc-%d", i)
|
||||||
out, err := s.d.Cmd("run", "-d", "--name", cName, "--net=host", "--restart=always", "busybox", "top")
|
out, err := s.d.Cmd("run", "-d", "--name", cName, "--net=host", "--restart=always", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// verify container has finished starting before killing daemon
|
// verify container has finished starting before killing daemon
|
||||||
err = s.d.WaitRun(cName)
|
err = s.d.WaitRun(cName)
|
||||||
|
@ -1160,7 +1160,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *c
|
||||||
c.Assert(waitRun("container1"), check.IsNil)
|
c.Assert(waitRun("container1"), check.IsNil)
|
||||||
dockerCmd(c, "network", "disconnect", "bridge", "container1")
|
dockerCmd(c, "network", "disconnect", "bridge", "container1")
|
||||||
out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
|
out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetwork.Error())
|
c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetwork.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
|
||||||
dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "touch /apple/core")
|
dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "touch /apple/core")
|
||||||
|
|
||||||
out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", plugin, pluginV2)
|
out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", plugin, pluginV2)
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "disabled before upgrading")
|
c.Assert(out, checker.Contains, "disabled before upgrading")
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "plugin", "inspect", "--format={{.ID}}", plugin)
|
out, _ = dockerCmd(c, "plugin", "inspect", "--format={{.ID}}", plugin)
|
||||||
|
@ -457,7 +457,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
|
||||||
|
|
||||||
// make sure "v2" does not exists
|
// make sure "v2" does not exists
|
||||||
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
|
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
|
||||||
c.Assert(os.IsNotExist(err), checker.True, check.Commentf(out))
|
c.Assert(os.IsNotExist(err), checker.True, check.Commentf("%s", out))
|
||||||
|
|
||||||
dockerCmd(c, "plugin", "disable", "-f", plugin)
|
dockerCmd(c, "plugin", "disable", "-f", plugin)
|
||||||
dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
|
dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
|
||||||
|
|
|
@ -282,7 +282,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, check.Not(checker.Contains), "Retrying")
|
c.Assert(out, check.Not(checker.Contains), "Retrying")
|
||||||
c.Assert(out, checker.Contains, "no basic auth credentials")
|
c.Assert(out, checker.Contains, "no basic auth credentials")
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *check.C) {
|
||||||
repoName := "test/busybox"
|
repoName := "test/busybox"
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, check.Not(checker.Contains), "Retrying")
|
c.Assert(out, check.Not(checker.Contains), "Retrying")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *che
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
||||||
c.Assert(out, checker.Contains, "unauthorized: a message")
|
c.Assert(out, checker.Contains, "unauthorized: a message")
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
||||||
split := strings.Split(out, "\n")
|
split := strings.Split(out, "\n")
|
||||||
c.Assert(split[len(split)-2], check.Equals, "unauthorized: authentication required")
|
c.Assert(split[len(split)-2], check.Equals, "unauthorized: authentication required")
|
||||||
|
@ -347,7 +347,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
// TODO: isolate test so that it can be guaranteed that the 503 will trigger xfer retries
|
// TODO: isolate test so that it can be guaranteed that the 503 will trigger xfer retries
|
||||||
//c.Assert(out, checker.Contains, "Retrying")
|
//c.Assert(out, checker.Contains, "Retrying")
|
||||||
//c.Assert(out, checker.Not(checker.Contains), "Retrying in 15")
|
//c.Assert(out, checker.Not(checker.Contains), "Retrying in 15")
|
||||||
|
@ -362,7 +362,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
||||||
split := strings.Split(out, "\n")
|
split := strings.Split(out, "\n")
|
||||||
c.Assert(split[len(split)-2], checker.Contains, "error parsing HTTP 403 response body: ")
|
c.Assert(split[len(split)-2], checker.Contains, "error parsing HTTP 403 response body: ")
|
||||||
|
@ -375,7 +375,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
|
||||||
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
||||||
dockerCmd(c, "tag", "busybox", repoName)
|
dockerCmd(c, "tag", "busybox", repoName)
|
||||||
out, _, err := dockerCmdWithError("push", repoName)
|
out, _, err := dockerCmdWithError("push", repoName)
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
c.Assert(out, checker.Not(checker.Contains), "Retrying")
|
||||||
split := strings.Split(out, "\n")
|
split := strings.Split(out, "\n")
|
||||||
c.Assert(split[len(split)-2], check.Equals, "authorization server did not include a token in the response")
|
c.Assert(split[len(split)-2], check.Equals, "authorization server did not include a token in the response")
|
||||||
|
|
|
@ -85,11 +85,11 @@ func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) {
|
||||||
|
|
||||||
// Disconnect the container from the network
|
// Disconnect the container from the network
|
||||||
out, err := dockerCmd(c, "network", "disconnect", "bridge", "c0")
|
out, err := dockerCmd(c, "network", "disconnect", "bridge", "c0")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Restart the container
|
// Restart the container
|
||||||
dockerCmd(c, "restart", "c0")
|
dockerCmd(c, "restart", "c0")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
|
func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
|
||||||
|
@ -115,7 +115,7 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
|
func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
|
||||||
out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox")
|
out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "maximum retry count cannot be negative")
|
c.Assert(out, checker.Contains, "maximum retry count cannot be negative")
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "create", "--restart=on-failure:1", "busybox")
|
out, _ = dockerCmd(c, "create", "--restart=on-failure:1", "busybox")
|
||||||
|
|
|
@ -3975,13 +3975,13 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) {
|
||||||
|
|
||||||
// test with the nocopy flag
|
// test with the nocopy flag
|
||||||
out, _, err := dockerCmdWithError("run", "-v", "test:/foo:nocopy", "volumecopy")
|
out, _, err := dockerCmdWithError("run", "-v", "test:/foo:nocopy", "volumecopy")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
// test default behavior which is to copy for non-binds
|
// test default behavior which is to copy for non-binds
|
||||||
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
|
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
|
||||||
// error out when the volume is already populated
|
// error out when the volume is already populated
|
||||||
out, _, err = dockerCmdWithError("run", "-v", "test:/foo:copy", "volumecopy")
|
out, _, err = dockerCmdWithError("run", "-v", "test:/foo:copy", "volumecopy")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
// do not error out when copy isn't explicitly set even though it's already populated
|
// do not error out when copy isn't explicitly set even though it's already populated
|
||||||
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
|
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
|
||||||
|
@ -3989,15 +3989,15 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) {
|
||||||
// do not allow copy modes on volumes-from
|
// do not allow copy modes on volumes-from
|
||||||
dockerCmd(c, "run", "--name=test", "-v", "/foo", "busybox", "true")
|
dockerCmd(c, "run", "--name=test", "-v", "/foo", "busybox", "true")
|
||||||
out, _, err = dockerCmdWithError("run", "--volumes-from=test:copy", "busybox", "true")
|
out, _, err = dockerCmdWithError("run", "--volumes-from=test:copy", "busybox", "true")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
out, _, err = dockerCmdWithError("run", "--volumes-from=test:nocopy", "busybox", "true")
|
out, _, err = dockerCmdWithError("run", "--volumes-from=test:nocopy", "busybox", "true")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// do not allow copy modes on binds
|
// do not allow copy modes on binds
|
||||||
out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:copy", "busybox", "true")
|
out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:copy", "busybox", "true")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:nocopy", "busybox", "true")
|
out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:nocopy", "busybox", "true")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test case for #21976
|
// Test case for #21976
|
||||||
|
@ -4314,7 +4314,7 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
|
||||||
out, _, err := dockerCmdWithError("run", "--rm", "--read-only",
|
out, _, err := dockerCmdWithError("run", "--rm", "--read-only",
|
||||||
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
|
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
|
||||||
"busybox", "touch", "/dev/shm/foo")
|
"busybox", "touch", "/dev/shm/foo")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Read-only file system")
|
c.Assert(out, checker.Contains, "Read-only file system")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
|
||||||
func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
expected := "Range of blkio weight is from 10 to 1000"
|
expected := "Range of blkio weight is from 10 to 1000"
|
||||||
c.Assert(out, checker.Contains, expected)
|
c.Assert(out, checker.Contains, expected)
|
||||||
}
|
}
|
||||||
|
@ -587,31 +587,31 @@ func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
|
||||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) {
|
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) {
|
||||||
testRequires(c, blkioWeight)
|
testRequires(c, blkioWeight)
|
||||||
out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true")
|
out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
||||||
|
@ -767,17 +767,17 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
|
||||||
func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
|
func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
|
||||||
testRequires(c, cpuShare, DaemonIsLinux)
|
testRequires(c, cpuShare, DaemonIsLinux)
|
||||||
out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test")
|
out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
expected := "The minimum allowed cpu-shares is 2"
|
expected := "The minimum allowed cpu-shares is 2"
|
||||||
c.Assert(out, checker.Contains, expected)
|
c.Assert(out, checker.Contains, expected)
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("run", "--cpu-shares", "-1", "busybox", "echo", "test")
|
out, _, err = dockerCmdWithError("run", "--cpu-shares", "-1", "busybox", "echo", "test")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
expected = "shares: invalid argument"
|
expected = "shares: invalid argument"
|
||||||
c.Assert(out, checker.Contains, expected)
|
c.Assert(out, checker.Contains, expected)
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("run", "--cpu-shares", "99999999", "busybox", "echo", "test")
|
out, _, err = dockerCmdWithError("run", "--cpu-shares", "99999999", "busybox", "echo", "test")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
expected = "The maximum allowed cpu-shares is"
|
expected = "The maximum allowed cpu-shares is"
|
||||||
c.Assert(out, checker.Contains, expected)
|
c.Assert(out, checker.Contains, expected)
|
||||||
}
|
}
|
||||||
|
@ -1349,7 +1349,7 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) {
|
||||||
testRequires(c, SameHostDaemon, seccompEnabled)
|
testRequires(c, SameHostDaemon, seccompEnabled)
|
||||||
|
|
||||||
out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:jessie", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami")
|
out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:jessie", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami")
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "unshare: unshare failed: Operation not permitted")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "unshare: unshare failed: Operation not permitted")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,29 +18,29 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
|
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
|
||||||
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
|
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "stars=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "stars=a", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "is-automated=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "is-automated=a", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
|
||||||
|
|
||||||
// -s --stars deprecated since Docker 1.13
|
// -s --stars deprecated since Docker 1.13
|
||||||
out, _, err = dockerCmdWithError("search", "--stars=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "--stars=a", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
|
c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
|
||||||
|
|
||||||
// -s --stars deprecated since Docker 1.13
|
// -s --stars deprecated since Docker 1.13
|
||||||
out, _, err = dockerCmdWithError("search", "-s=-1", "busybox")
|
out, _, err = dockerCmdWithError("search", "-s=-1", "busybox")
|
||||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
|
c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (s *DockerSwarmSuite) TestSecretCreateWithFile(c *check.C) {
|
||||||
testName := "test_secret"
|
testName := "test_secret"
|
||||||
out, err := d.Cmd("secret", "create", testName, testFile.Name())
|
out, err := d.Cmd("secret", "create", testName, testFile.Name())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf(out))
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf("%s", out))
|
||||||
|
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
secret := d.GetSecret(c, id)
|
secret := d.GetSecret(c, id)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=volume,source=foo,target=/foo,volume-nocopy", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=volume,source=foo,target=/foo,volume-nocopy", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
var tasks []swarm.Task
|
var tasks []swarm.Task
|
||||||
|
@ -37,7 +37,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
||||||
|
|
||||||
// check container mount config
|
// check container mount config
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
var mountConfig []mount.Mount
|
var mountConfig []mount.Mount
|
||||||
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
|
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
|
||||||
|
@ -51,7 +51,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
||||||
|
|
||||||
// check container mounts actual
|
// check container mounts actual
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
var mounts []types.MountPoint
|
var mounts []types.MountPoint
|
||||||
c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
|
c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
|
||||||
|
@ -77,7 +77,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
|
||||||
c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -93,7 +93,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
|
||||||
c.Assert(refs[0].File.GID, checker.Equals, "0")
|
c.Assert(refs[0].File.GID, checker.Equals, "0")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
d.DeleteSecret(c, testName)
|
d.DeleteSecret(c, testName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
|
||||||
serviceCmd = append(serviceCmd, secretFlags...)
|
serviceCmd = append(serviceCmd, secretFlags...)
|
||||||
serviceCmd = append(serviceCmd, "busybox", "top")
|
serviceCmd = append(serviceCmd, "busybox", "top")
|
||||||
out, err := d.Cmd(serviceCmd...)
|
out, err := d.Cmd(serviceCmd...)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -160,7 +160,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C) {
|
||||||
|
@ -176,7 +176,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
|
||||||
|
|
||||||
serviceName := "svc"
|
serviceName := "svc"
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -200,7 +200,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
|
||||||
}, checker.Equals, true)
|
}, checker.Equals, true)
|
||||||
|
|
||||||
for _, target := range []string{"target1", "target2"} {
|
for _, target := range []string{"target1", "target2"} {
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
path := filepath.Join("/run/secrets", target)
|
path := filepath.Join("/run/secrets", target)
|
||||||
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
|
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -208,7 +208,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
||||||
|
@ -225,7 +225,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
||||||
c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -241,7 +241,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
||||||
c.Assert(refs[0].File.GID, checker.Equals, "0")
|
c.Assert(refs[0].File.GID, checker.Equals, "0")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
d.DeleteConfig(c, testName)
|
d.DeleteConfig(c, testName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
|
||||||
serviceCmd = append(serviceCmd, configFlags...)
|
serviceCmd = append(serviceCmd, configFlags...)
|
||||||
serviceCmd = append(serviceCmd, "busybox", "top")
|
serviceCmd = append(serviceCmd, "busybox", "top")
|
||||||
out, err := d.Cmd(serviceCmd...)
|
out, err := d.Cmd(serviceCmd...)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -307,7 +307,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C) {
|
||||||
|
@ -323,7 +323,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
|
||||||
|
|
||||||
serviceName := "svc"
|
serviceName := "svc"
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -347,7 +347,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
|
||||||
}, checker.Equals, true)
|
}, checker.Equals, true)
|
||||||
|
|
||||||
for _, target := range []string{"target1", "target2"} {
|
for _, target := range []string{"target1", "target2"} {
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
path := filepath.Join("/", target)
|
path := filepath.Join("/", target)
|
||||||
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
|
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -355,13 +355,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = d.Cmd("service", "rm", serviceName)
|
out, err = d.Cmd("service", "rm", serviceName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=tmpfs,target=/foo,tmpfs-size=1MB", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=tmpfs,target=/foo,tmpfs-size=1MB", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
var tasks []swarm.Task
|
var tasks []swarm.Task
|
||||||
|
@ -380,7 +380,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
||||||
|
|
||||||
// check container mount config
|
// check container mount config
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
var mountConfig []mount.Mount
|
var mountConfig []mount.Mount
|
||||||
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
|
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
|
||||||
|
@ -394,7 +394,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
||||||
|
|
||||||
// check container mounts actual
|
// check container mounts actual
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
var mounts []types.MountPoint
|
var mounts []types.MountPoint
|
||||||
c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
|
c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
|
||||||
|
@ -406,7 +406,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
||||||
c.Assert(mounts[0].RW, checker.Equals, true)
|
c.Assert(mounts[0].RW, checker.Equals, true)
|
||||||
|
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.HasPrefix, "tmpfs on /foo type tmpfs")
|
c.Assert(strings.TrimSpace(out), checker.HasPrefix, "tmpfs on /foo type tmpfs")
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, "size=1024k")
|
c.Assert(strings.TrimSpace(out), checker.Contains, "size=1024k")
|
||||||
}
|
}
|
||||||
|
@ -414,10 +414,10 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
||||||
func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
out, err := d.Cmd("network", "create", "--scope=swarm", "test_swarm_br")
|
out, err := d.Cmd("network", "create", "--scope=swarm", "test_swarm_br")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--network=name=test_swarm_br,alias=srv_alias", "--name=alias_tst_container", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--network=name=test_swarm_br,alias=srv_alias", "--name=alias_tst_container", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
var tasks []swarm.Task
|
var tasks []swarm.Task
|
||||||
|
@ -436,7 +436,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
|
||||||
|
|
||||||
// check container alias config
|
// check container alias config
|
||||||
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .NetworkSettings.Networks.test_swarm_br.Aliases}}", task.Status.ContainerStatus.ContainerID)
|
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .NetworkSettings.Networks.test_swarm_br.Aliases}}", task.Status.ContainerStatus.ContainerID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Make sure the only alias seen is the container-id
|
// Make sure the only alias seen is the container-id
|
||||||
var aliases []string
|
var aliases []string
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) {
|
||||||
|
|
||||||
serviceName := "healthServiceRun"
|
serviceName := "healthServiceRun"
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
var tasks []swarm.Task
|
var tasks []swarm.Task
|
||||||
|
@ -95,7 +95,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) {
|
||||||
|
|
||||||
serviceName := "healthServiceStart"
|
serviceName := "healthServiceStart"
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
var tasks []swarm.Task
|
var tasks []swarm.Task
|
||||||
|
|
|
@ -14,39 +14,39 @@ import (
|
||||||
func (s *DockerSwarmSuite) TestServiceUpdateLabel(c *check.C) {
|
func (s *DockerSwarmSuite) TestServiceUpdateLabel(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name=test", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name=test", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service := d.GetService(c, "test")
|
service := d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 0)
|
c.Assert(service.Spec.Labels, checker.HasLen, 0)
|
||||||
|
|
||||||
// add label to empty set
|
// add label to empty set
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo=bar")
|
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo=bar")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service = d.GetService(c, "test")
|
service = d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
||||||
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
|
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
|
||||||
|
|
||||||
// add label to non-empty set
|
// add label to non-empty set
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo2=bar")
|
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo2=bar")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service = d.GetService(c, "test")
|
service = d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 2)
|
c.Assert(service.Spec.Labels, checker.HasLen, 2)
|
||||||
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "bar")
|
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "bar")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--label-rm", "foo2")
|
out, err = d.Cmd("service", "update", "--detach", "test", "--label-rm", "foo2")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service = d.GetService(c, "test")
|
service = d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
||||||
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "")
|
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--label-rm", "foo")
|
out, err = d.Cmd("service", "update", "--detach", "test", "--label-rm", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service = d.GetService(c, "test")
|
service = d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 0)
|
c.Assert(service.Spec.Labels, checker.HasLen, 0)
|
||||||
c.Assert(service.Spec.Labels["foo"], checker.Equals, "")
|
c.Assert(service.Spec.Labels["foo"], checker.Equals, "")
|
||||||
|
|
||||||
// now make sure we can add again
|
// now make sure we can add again
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo=bar")
|
out, err = d.Cmd("service", "update", "--detach", "test", "--label-add", "foo=bar")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
service = d.GetService(c, "test")
|
service = d.GetService(c, "test")
|
||||||
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
c.Assert(service.Spec.Labels, checker.HasLen, 1)
|
||||||
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
|
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
|
||||||
|
@ -66,11 +66,11 @@ func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
|
||||||
serviceName := "test"
|
serviceName := "test"
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// add secret
|
// add secret
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--secret-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
out, err = d.Cmd("service", "update", "--detach", "test", "--secret-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -85,7 +85,7 @@ func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--secret-rm", testName)
|
out, err = d.Cmd("service", "update", "--detach", "test", "--secret-rm", testName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -108,11 +108,11 @@ func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
|
||||||
serviceName := "test"
|
serviceName := "test"
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// add config
|
// add config
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--config-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
out, err = d.Cmd("service", "update", "--detach", "test", "--config-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
@ -127,7 +127,7 @@ func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
out, err = d.Cmd("service", "update", "--detach", "test", "--config-rm", testName)
|
out, err = d.Cmd("service", "update", "--detach", "test", "--config-rm", testName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
|
@ -172,14 +172,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(hostname))
|
c.Assert(err, checker.IsNil, check.Commentf(hostname))
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
||||||
|
|
||||||
containers := d.ActiveContainers(c)
|
containers := d.ActiveContainers(c)
|
||||||
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.Hostname}}", containers[0])
|
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.Hostname}}", containers[0])
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.Split(out, "\n")[0], checker.Equals, "test-1-"+strings.Split(hostname, "\n")[0], check.Commentf("hostname with templating invalid"))
|
c.Assert(strings.Split(out, "\n")[0], checker.Equals, "test-1-"+strings.Split(hostname, "\n")[0], check.Commentf("hostname with templating invalid"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,17 +323,17 @@ func (s *DockerSwarmSuite) TestSwarmContainerAutoStart(c *check.C) {
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
out, err = d.Cmd("run", "-id", "--restart=always", "--net=foo", "--name=test", "busybox", "top")
|
out, err = d.Cmd("run", "-id", "--restart=always", "--net=foo", "--name=test", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
out, err = d.Cmd("ps", "-q")
|
out, err = d.Cmd("ps", "-q")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
d.Restart(c)
|
d.Restart(c)
|
||||||
|
|
||||||
out, err = d.Cmd("ps", "-q")
|
out, err = d.Cmd("ps", "-q")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,25 +341,25 @@ func (s *DockerSwarmSuite) TestSwarmContainerEndpointOptions(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
_, err = d.Cmd("run", "-d", "--net=foo", "--name=first", "--net-alias=first-alias", "busybox:glibc", "top")
|
_, err = d.Cmd("run", "-d", "--net=foo", "--name=first", "--net-alias=first-alias", "busybox:glibc", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
_, err = d.Cmd("run", "-d", "--net=foo", "--name=second", "busybox:glibc", "top")
|
_, err = d.Cmd("run", "-d", "--net=foo", "--name=second", "busybox:glibc", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
_, err = d.Cmd("run", "-d", "--net=foo", "--net-alias=third-alias", "busybox:glibc", "top")
|
_, err = d.Cmd("run", "-d", "--net=foo", "--net-alias=third-alias", "busybox:glibc", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// ping first container and its alias, also ping third and anonymous container by its alias
|
// ping first container and its alias, also ping third and anonymous container by its alias
|
||||||
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "first")
|
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "first")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "first-alias")
|
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "first-alias")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "third-alias")
|
_, err = d.Cmd("exec", "second", "ping", "-c", "1", "third-alias")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) {
|
func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) {
|
||||||
|
@ -394,21 +394,21 @@ func (s *DockerSwarmSuite) TestOverlayAttachable(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", "ovnet")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", "ovnet")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// validate attachable
|
// validate attachable
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{json .Attachable}}", "ovnet")
|
out, err = d.Cmd("network", "inspect", "--format", "{{json .Attachable}}", "ovnet")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
||||||
|
|
||||||
// validate containers can attache to this overlay network
|
// validate containers can attache to this overlay network
|
||||||
out, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c1", "busybox", "top")
|
out, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c1", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// redo validation, there was a bug that the value of attachable changes after
|
// redo validation, there was a bug that the value of attachable changes after
|
||||||
// containers attach to the network
|
// containers attach to the network
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{json .Attachable}}", "ovnet")
|
out, err = d.Cmd("network", "inspect", "--format", "{{json .Attachable}}", "ovnet")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,11 +418,11 @@ func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) {
|
||||||
// Create an attachable swarm network
|
// Create an attachable swarm network
|
||||||
nwName := "attovl"
|
nwName := "attovl"
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", nwName)
|
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", nwName)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Connect a container to the network
|
// Connect a container to the network
|
||||||
out, err = d.Cmd("run", "-d", "--network", nwName, "--name", "c1", "busybox", "top")
|
out, err = d.Cmd("run", "-d", "--network", nwName, "--name", "c1", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Leave the swarm
|
// Leave the swarm
|
||||||
err = d.SwarmLeave(true)
|
err = d.SwarmLeave(true)
|
||||||
|
@ -444,11 +444,11 @@ func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *che
|
||||||
|
|
||||||
// Create attachable network
|
// Create attachable network
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", "--subnet", "10.10.9.0/24", "ovnet")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", "--subnet", "10.10.9.0/24", "ovnet")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Attach a container with specific IP
|
// Attach a container with specific IP
|
||||||
out, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c1", "--ip", "10.10.9.33", "busybox", "top")
|
out, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c1", "--ip", "10.10.9.33", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Attempt to attach another container with same IP, must fail
|
// Attempt to attach another container with same IP, must fail
|
||||||
_, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c2", "--ip", "10.10.9.33", "busybox", "top")
|
_, err = d.Cmd("run", "-d", "--network", "ovnet", "--name", "c2", "--ip", "10.10.9.33", "busybox", "top")
|
||||||
|
@ -456,11 +456,11 @@ func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *che
|
||||||
|
|
||||||
// Remove first container
|
// Remove first container
|
||||||
out, err = d.Cmd("rm", "-f", "c1")
|
out, err = d.Cmd("rm", "-f", "c1")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Verify the network can be removed, no phantom network attachment task left over
|
// Verify the network can be removed, no phantom network attachment task left over
|
||||||
out, err = d.Cmd("network", "rm", "ovnet")
|
out, err = d.Cmd("network", "rm", "ovnet")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
||||||
|
@ -478,7 +478,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
||||||
|
|
||||||
// And recreated
|
// And recreated
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "--ingress", "new-ingress")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "--ingress", "new-ingress")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// But only one is allowed
|
// But only one is allowed
|
||||||
out, err = d.Cmd("network", "create", "-d", "overlay", "--ingress", "another-ingress")
|
out, err = d.Cmd("network", "create", "-d", "overlay", "--ingress", "another-ingress")
|
||||||
|
@ -487,7 +487,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
||||||
|
|
||||||
// It cannot be removed if it is being used
|
// It cannot be removed if it is being used
|
||||||
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv1", "-p", "9000:8000", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv1", "-p", "9000:8000", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
result = removeNetwork("new-ingress")
|
result = removeNetwork("new-ingress")
|
||||||
result.Assert(c, icmd.Expected{
|
result.Assert(c, icmd.Expected{
|
||||||
|
@ -497,7 +497,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
||||||
|
|
||||||
// But it can be removed once no more services depend on it
|
// But it can be removed once no more services depend on it
|
||||||
out, err = d.Cmd("service", "update", "--detach", "--publish-rm", "9000:8000", "srv1")
|
out, err = d.Cmd("service", "update", "--detach", "--publish-rm", "9000:8000", "srv1")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
result = removeNetwork("new-ingress")
|
result = removeNetwork("new-ingress")
|
||||||
result.Assert(c, icmd.Success)
|
result.Assert(c, icmd.Success)
|
||||||
|
@ -514,7 +514,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
||||||
|
|
||||||
// But services which do not need routing mesh can be created regardless
|
// But services which do not need routing mesh can be created regardless
|
||||||
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv3", "--endpoint-mode", "dnsrr", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv3", "--endpoint-mode", "dnsrr", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C) {
|
func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C) {
|
||||||
|
@ -529,9 +529,9 @@ func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C
|
||||||
// Create a overlay network and launch a service on it
|
// Create a overlay network and launch a service on it
|
||||||
// Make sure nothing panics because ingress network is missing
|
// Make sure nothing panics because ingress network is missing
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "another-network")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "another-network")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv4", "--network", "another-network", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv4", "--network", "another-network", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test case for #24108, also the case from:
|
// Test case for #24108, also the case from:
|
||||||
|
@ -1540,22 +1540,22 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("network", "create", "-d", "overlay", "--ipam-opt", "foo=bar", "foo")
|
out, err := d.Cmd("network", "create", "-d", "overlay", "--ipam-opt", "foo=bar", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar")
|
c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar")
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true")
|
c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--network=foo", "--name", "top", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--network=foo", "--name", "top", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
||||||
|
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar")
|
c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar")
|
||||||
c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true")
|
c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true")
|
||||||
}
|
}
|
||||||
|
@ -1611,7 +1611,7 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--publish", "5005:80", "--publish", "5006:80", "--publish", "80", "--publish", "80", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--publish", "5005:80", "--publish", "5006:80", "--publish", "80", "--publish", "80", "busybox", "top")
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
|
@ -1620,7 +1620,7 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) {
|
||||||
// Total len = 4, with 2 dynamic ports and 2 non-dynamic ports
|
// Total len = 4, with 2 dynamic ports and 2 non-dynamic ports
|
||||||
// Dynamic ports are likely to be 30000 and 30001 but doesn't matter
|
// Dynamic ports are likely to be 30000 and 30001 but doesn't matter
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{.Endpoint.Ports}} len={{len .Endpoint.Ports}}", id)
|
out, err = d.Cmd("service", "inspect", "--format", "{{.Endpoint.Ports}} len={{len .Endpoint.Ports}}", id)
|
||||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
c.Assert(err, check.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "len=4")
|
c.Assert(out, checker.Contains, "len=4")
|
||||||
c.Assert(out, checker.Contains, "{ tcp 80 5005 ingress}")
|
c.Assert(out, checker.Contains, "{ tcp 80 5005 ingress}")
|
||||||
c.Assert(out, checker.Contains, "{ tcp 80 5006 ingress}")
|
c.Assert(out, checker.Contains, "{ tcp 80 5006 ingress}")
|
||||||
|
@ -1671,18 +1671,18 @@ func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top", "--read-only", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top", "--read-only", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.ReadOnly }}", "top")
|
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.ReadOnly }}", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
||||||
|
|
||||||
containers := d.ActiveContainers(c)
|
containers := d.ActiveContainers(c)
|
||||||
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.HostConfig.ReadonlyRootfs}}", containers[0])
|
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.HostConfig.ReadonlyRootfs}}", containers[0])
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,32 +1704,32 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) {
|
||||||
|
|
||||||
// Full ID always works
|
// Full ID always works
|
||||||
out, err := d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
out, err := d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
||||||
|
|
||||||
// Name works if it is unique
|
// Name works if it is unique
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
||||||
|
|
||||||
n2, err := cli.NetworkCreate(context.Background(), name, options)
|
n2, err := cli.NetworkCreate(context.Background(), name, options)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
// Full ID always works
|
// Full ID always works
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
||||||
|
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n2.ID)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n2.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n2.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n2.ID)
|
||||||
|
|
||||||
// Name with duplicates
|
// Name with duplicates
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "2 matches found based on name")
|
c.Assert(out, checker.Contains, "2 matches found based on name")
|
||||||
|
|
||||||
out, err = d.Cmd("network", "rm", n2.ID)
|
out, err = d.Cmd("network", "rm", n2.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Dupliates with name but with different driver
|
// Dupliates with name but with different driver
|
||||||
options.Driver = "overlay"
|
options.Driver = "overlay"
|
||||||
|
@ -1739,16 +1739,16 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) {
|
||||||
|
|
||||||
// Full ID always works
|
// Full ID always works
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n1.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n1.ID)
|
||||||
|
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n2.ID)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", n2.ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, n2.ID)
|
c.Assert(strings.TrimSpace(out), checker.Equals, n2.ID)
|
||||||
|
|
||||||
// Name with duplicates
|
// Name with duplicates
|
||||||
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
||||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "2 matches found based on name")
|
c.Assert(out, checker.Contains, "2 matches found based on name")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,25 +1758,25 @@ func (s *DockerSwarmSuite) TestSwarmStopSignal(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top", "--stop-signal=SIGHUP", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top", "--stop-signal=SIGHUP", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.StopSignal }}", "top")
|
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.StopSignal }}", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGHUP")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGHUP")
|
||||||
|
|
||||||
containers := d.ActiveContainers(c)
|
containers := d.ActiveContainers(c)
|
||||||
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.StopSignal}}", containers[0])
|
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.StopSignal}}", containers[0])
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGHUP")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGHUP")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "update", "--detach", "--stop-signal=SIGUSR1", "top")
|
out, err = d.Cmd("service", "update", "--detach", "--stop-signal=SIGUSR1", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.StopSignal }}", "top")
|
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.StopSignal }}", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGUSR1")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "SIGUSR1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1784,18 +1784,18 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top1", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top1", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top2", "--mode=global", "busybox", "top")
|
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top2", "--mode=global", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 2)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 2)
|
||||||
|
|
||||||
out, err = d.Cmd("service", "ls")
|
out, err = d.Cmd("service", "ls")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "top1")
|
c.Assert(out, checker.Contains, "top1")
|
||||||
c.Assert(out, checker.Contains, "top2")
|
c.Assert(out, checker.Contains, "top2")
|
||||||
c.Assert(out, checker.Not(checker.Contains), "localnet")
|
c.Assert(out, checker.Not(checker.Contains), "localnet")
|
||||||
|
@ -1803,10 +1803,10 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) {
|
||||||
out, err = d.Cmd("service", "ls", "--filter", "mode=global")
|
out, err = d.Cmd("service", "ls", "--filter", "mode=global")
|
||||||
c.Assert(out, checker.Not(checker.Contains), "top1")
|
c.Assert(out, checker.Not(checker.Contains), "top1")
|
||||||
c.Assert(out, checker.Contains, "top2")
|
c.Assert(out, checker.Contains, "top2")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out, err = d.Cmd("service", "ls", "--filter", "mode=replicated")
|
out, err = d.Cmd("service", "ls", "--filter", "mode=replicated")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
c.Assert(out, checker.Contains, "top1")
|
c.Assert(out, checker.Contains, "top1")
|
||||||
c.Assert(out, checker.Not(checker.Contains), "top2")
|
c.Assert(out, checker.Not(checker.Contains), "top2")
|
||||||
}
|
}
|
||||||
|
@ -1860,7 +1860,7 @@ func waitForEvent(c *check.C, d *daemon.Daemon, since string, filter string, eve
|
||||||
} else {
|
} else {
|
||||||
out, err = d.Cmd("events", "--since", since, "--until", until)
|
out, err = d.Cmd("events", "--since", since, "--until", until)
|
||||||
}
|
}
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
if strings.Contains(out, event) {
|
if strings.Contains(out, event) {
|
||||||
return strings.TrimSpace(out)
|
return strings.TrimSpace(out)
|
||||||
}
|
}
|
||||||
|
@ -1880,7 +1880,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) {
|
||||||
|
|
||||||
// create a network
|
// create a network
|
||||||
out, err := d1.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
out, err := d1.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
networkID := strings.TrimSpace(out)
|
networkID := strings.TrimSpace(out)
|
||||||
c.Assert(networkID, checker.Not(checker.Equals), "")
|
c.Assert(networkID, checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
|
@ -1898,7 +1898,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) {
|
||||||
|
|
||||||
// create a service
|
// create a service
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
serviceID := strings.Split(out, "\n")[0]
|
serviceID := strings.Split(out, "\n")[0]
|
||||||
|
|
||||||
// scope swarm filters cluster events
|
// scope swarm filters cluster events
|
||||||
|
@ -1919,12 +1919,12 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) {
|
||||||
|
|
||||||
// create a service
|
// create a service
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
serviceID := strings.Split(out, "\n")[0]
|
serviceID := strings.Split(out, "\n")[0]
|
||||||
|
|
||||||
// create a network
|
// create a network
|
||||||
out, err = d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
out, err = d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
networkID := strings.TrimSpace(out)
|
networkID := strings.TrimSpace(out)
|
||||||
c.Assert(networkID, checker.Not(checker.Equals), "")
|
c.Assert(networkID, checker.Not(checker.Equals), "")
|
||||||
|
|
||||||
|
@ -1942,7 +1942,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
||||||
|
|
||||||
// create a service
|
// create a service
|
||||||
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--no-resolve-image", "--name", "test", "--detach=false", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
serviceID := strings.Split(out, "\n")[0]
|
serviceID := strings.Split(out, "\n")[0]
|
||||||
|
|
||||||
// validate service create event
|
// validate service create event
|
||||||
|
@ -1950,7 +1950,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
||||||
|
|
||||||
t1 := daemonUnixTime(c)
|
t1 := daemonUnixTime(c)
|
||||||
out, err = d.Cmd("service", "update", "--force", "--detach=false", "test")
|
out, err = d.Cmd("service", "update", "--force", "--detach=false", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// wait for service update start
|
// wait for service update start
|
||||||
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount)
|
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount)
|
||||||
|
@ -1964,7 +1964,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
||||||
// scale service
|
// scale service
|
||||||
t2 := daemonUnixTime(c)
|
t2 := daemonUnixTime(c)
|
||||||
out, err = d.Cmd("service", "scale", "test=3")
|
out, err = d.Cmd("service", "scale", "test=3")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
out = waitForEvent(c, d, t2, "-f scope=swarm", "service update "+serviceID, defaultRetryCount)
|
out = waitForEvent(c, d, t2, "-f scope=swarm", "service update "+serviceID, defaultRetryCount)
|
||||||
c.Assert(out, checker.Contains, "replicas.new=3, replicas.old=1")
|
c.Assert(out, checker.Contains, "replicas.new=3, replicas.old=1")
|
||||||
|
@ -1972,7 +1972,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
||||||
// remove service
|
// remove service
|
||||||
t3 := daemonUnixTime(c)
|
t3 := daemonUnixTime(c)
|
||||||
out, err = d.Cmd("service", "rm", "test")
|
out, err = d.Cmd("service", "rm", "test")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
waitForEvent(c, d, t3, "-f scope=swarm", "service remove "+serviceID, defaultRetryCount)
|
waitForEvent(c, d, t3, "-f scope=swarm", "service remove "+serviceID, defaultRetryCount)
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1987,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) {
|
||||||
|
|
||||||
t1 := daemonUnixTime(c)
|
t1 := daemonUnixTime(c)
|
||||||
out, err := d1.Cmd("node", "update", "--availability=pause", d3ID)
|
out, err := d1.Cmd("node", "update", "--availability=pause", d3ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// filter by type
|
// filter by type
|
||||||
out = waitForEvent(c, d1, t1, "-f type=node", "node update "+d3ID, defaultRetryCount)
|
out = waitForEvent(c, d1, t1, "-f type=node", "node update "+d3ID, defaultRetryCount)
|
||||||
|
@ -1995,13 +1995,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) {
|
||||||
|
|
||||||
t2 := daemonUnixTime(c)
|
t2 := daemonUnixTime(c)
|
||||||
out, err = d1.Cmd("node", "demote", d3ID)
|
out, err = d1.Cmd("node", "demote", d3ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
waitForEvent(c, d1, t2, "-f type=node", "node update "+d3ID, defaultRetryCount)
|
waitForEvent(c, d1, t2, "-f type=node", "node update "+d3ID, defaultRetryCount)
|
||||||
|
|
||||||
t3 := daemonUnixTime(c)
|
t3 := daemonUnixTime(c)
|
||||||
out, err = d1.Cmd("node", "rm", "-f", d3ID)
|
out, err = d1.Cmd("node", "rm", "-f", d3ID)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// filter by scope
|
// filter by scope
|
||||||
waitForEvent(c, d1, t3, "-f scope=swarm", "node remove "+d3ID, defaultRetryCount)
|
waitForEvent(c, d1, t3, "-f scope=swarm", "node remove "+d3ID, defaultRetryCount)
|
||||||
|
@ -2012,7 +2012,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *check.C) {
|
||||||
|
|
||||||
// create a network
|
// create a network
|
||||||
out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
networkID := strings.TrimSpace(out)
|
networkID := strings.TrimSpace(out)
|
||||||
|
|
||||||
waitForEvent(c, d, "0", "-f scope=swarm", "network create "+networkID, defaultRetryCount)
|
waitForEvent(c, d, "0", "-f scope=swarm", "network create "+networkID, defaultRetryCount)
|
||||||
|
@ -2020,7 +2020,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *check.C) {
|
||||||
// remove network
|
// remove network
|
||||||
t1 := daemonUnixTime(c)
|
t1 := daemonUnixTime(c)
|
||||||
out, err = d.Cmd("network", "rm", "foo")
|
out, err = d.Cmd("network", "rm", "foo")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// filtered by network
|
// filtered by network
|
||||||
waitForEvent(c, d, t1, "-f type=network", "network remove "+networkID, defaultRetryCount)
|
waitForEvent(c, d, t1, "-f type=network", "network remove "+networkID, defaultRetryCount)
|
||||||
|
|
|
@ -16,7 +16,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
|
||||||
d := s.AddDaemon(c, true, true)
|
d := s.AddDaemon(c, true, true)
|
||||||
|
|
||||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--mount", "type=volume,source=my-volume,destination=/foo,volume-driver=customvolumedriver", "--name", "top", "busybox", "top")
|
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--mount", "type=volume,source=my-volume,destination=/foo,volume-driver=customvolumedriver", "--name", "top", "busybox", "top")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// Make sure task stays pending before plugin is available
|
// Make sure task stays pending before plugin is available
|
||||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckServiceTasksInStateWithError("top", swarm.TaskStatePending, "missing plugin on 1 node"), checker.Equals, 1)
|
waitAndAssert(c, defaultReconciliationTimeout, d.CheckServiceTasksInStateWithError("top", swarm.TaskStatePending, "missing plugin on 1 node"), checker.Equals, 1)
|
||||||
|
@ -26,7 +26,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
|
||||||
|
|
||||||
// create a dummy volume to trigger lazy loading of the plugin
|
// create a dummy volume to trigger lazy loading of the plugin
|
||||||
out, err = d.Cmd("volume", "create", "-d", "customvolumedriver", "hello")
|
out, err = d.Cmd("volume", "create", "-d", "customvolumedriver", "hello")
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
|
||||||
|
|
||||||
// TODO(aaronl): It will take about 15 seconds for swarm to realize the
|
// TODO(aaronl): It will take about 15 seconds for swarm to realize the
|
||||||
// plugin was loaded. Switching the test over to plugin v2 would avoid
|
// plugin was loaded. Switching the test over to plugin v2 would avoid
|
||||||
|
@ -48,7 +48,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil)
|
c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil)
|
||||||
c.Assert(len(mounts), checker.Equals, 1, check.Commentf(out))
|
c.Assert(len(mounts), checker.Equals, 1, check.Commentf("%s", out))
|
||||||
c.Assert(mounts[0].Name, checker.Equals, "my-volume")
|
c.Assert(mounts[0].Name, checker.Equals, "my-volume")
|
||||||
c.Assert(mounts[0].Driver, checker.Equals, "customvolumedriver")
|
c.Assert(mounts[0].Driver, checker.Equals, "customvolumedriver")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue