Merge pull request #37635 from kolyshkin/test-logs

integration-cli: error logging improvements
This commit is contained in:
Sebastiaan van Stijn 2018-08-14 14:38:34 +02:00 committed by GitHub
commit 3c5eac3628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 453 additions and 456 deletions

View file

@ -200,7 +200,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) {
func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *check.C) {
if s.reg != nil {
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()
}
if s.d != nil {
@ -233,7 +233,7 @@ func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) {
if s.reg != nil {
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()
}
if s.d != nil {

View file

@ -156,7 +156,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
// create a different tag
for _, d := range daemons {
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
@ -188,7 +188,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
// Roll back to the previous version. This uses the CLI because
// rollback used to be a client-side operation.
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
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
// rollback is a client-side operation.
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
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
// rollback used to be a client-side operation.
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,
map[string]int{image1: instances})

View file

@ -404,7 +404,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *check.C) {
d.CreateService(c, simpleTestService, setInstances(instances))
id, err := d.Cmd("run", "-d", "busybox", "top")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", id))
id = strings.TrimSpace(id)
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, instances+1)
@ -415,7 +415,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *check.C) {
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
id2, err := d.Cmd("ps", "-q")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", id2))
c.Assert(id, checker.HasPrefix, strings.TrimSpace(id2))
}
@ -426,7 +426,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) {
d2 := s.AddDaemon(c, false, false)
id, err := d2.Cmd("run", "-d", "busybox", "top")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", id))
id = strings.TrimSpace(id)
c2 := d2.NewClientT(c)
@ -445,7 +445,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) {
waitAndAssert(c, defaultReconciliationTimeout, d2.CheckActiveContainerCount, checker.Equals, 1)
id2, err := d2.Cmd("ps", "-q")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", id2))
c.Assert(id, checker.HasPrefix, strings.TrimSpace(id2))
}
@ -923,7 +923,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) {
d := s.AddDaemon(c, true, true)
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
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)
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) {

View file

@ -15,17 +15,17 @@ func (s *DockerSwarmSuite) TestConfigCreateWithFile(c *check.C) {
d := s.AddDaemon(c, true, true)
testFile, err := ioutil.TempFile("", "configCreateTest")
c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
c.Assert(err, checker.IsNil) // ensure temp file is created
defer os.Remove(testFile.Name())
testData := "TESTINGDATA"
_, err = testFile.Write([]byte(testData))
c.Assert(err, checker.IsNil, check.Commentf("failed to write to temporary file"))
c.Assert(err, checker.IsNil) // ensure temp file is written
testName := "test_config"
out, err := d.Cmd("config", "create", testName, testFile.Name())
c.Assert(err, checker.IsNil)
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
id := strings.TrimSpace(out)
config := d.GetConfig(c, id)

View file

@ -243,7 +243,7 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
if err == nil {
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".
stat, err = os.Lstat(expectedPath)
@ -315,7 +315,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
if err == nil {
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".
stat, err = os.Lstat(expectedPath)

View file

@ -75,7 +75,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) {
// Ensure this fails because of the defaultBaseFsSize is 10G
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")
}

View file

@ -225,10 +225,10 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
c.Assert(out, checker.Contains, pName)
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)
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
}
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")
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)
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")
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")
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)
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)
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
}
func existsMountpointWithPrefix(mountpointPrefix string) (bool, error) {
@ -278,7 +278,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
s.d.Start(c)
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() {
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
@ -287,16 +287,16 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
}()
out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=true")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Not(checker.Contains), pName)
out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=false")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
c.Assert(out, checker.Contains, "false")
out, err = s.d.Cmd("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
}
@ -306,7 +306,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
s.d.Start(c)
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() {
if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
@ -315,14 +315,14 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
}()
out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=volumedriver")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=authz")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Not(checker.Contains), pName)
out, err = s.d.Cmd("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
}

View file

@ -107,7 +107,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *check.C) {
}
out, err := s.d.Cmd("inspect", "-f", "{{json .Mounts}}", "volrestarttest1")
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
if _, err := inspectMountPointJSON(out, "/foo"); err != nil {
c.Fatalf("Expected volume to exist: /foo, error: %v\n", err)
@ -142,10 +142,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *check.C) {
testRun(map[string]bool{"top1": true, "top2": true}, "")
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")
c.Assert(err, check.IsNil, check.Commentf(out))
c.Assert(err, check.IsNil, check.Commentf("%s", out))
// both stopped
testRun(map[string]bool{"top1": false, "top2": false}, "")
@ -387,22 +387,20 @@ func (s *DockerDaemonSuite) TestDaemonIPv6Enabled(c *check.C) {
}
out, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.Networks.bridge.LinkLocalIPv6Address}}'", "ipv6test")
out = strings.Trim(out, " \r\n'")
if err != nil {
c.Fatalf("Error inspecting container: %s, %v", out, err)
}
out = strings.Trim(out, " \r\n'")
if ip := net.ParseIP(out); ip == nil {
c.Fatalf("Container should have a link-local IPv6 address")
}
out, err = s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}'", "ipv6test")
out = strings.Trim(out, " \r\n'")
if err != nil {
c.Fatalf("Error inspecting container: %s, %v", out, err)
}
out = strings.Trim(out, " \r\n'")
if ip := net.ParseIP(out); ip != nil {
c.Fatalf("Container should not have a global IPv6 address: %v", out)
@ -424,15 +422,14 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("Could not run container: %s, %v", out, err))
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
out = strings.Trim(out, " \r\n'")
c.Assert(err, checker.IsNil, check.Commentf(out))
ip := net.ParseIP(out)
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")
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"))
}
@ -448,11 +445,11 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) {
s.d.StartWithBusybox(c, "--ipv6", "--fixed-cidr-v6=2001:db8:1::/64")
_, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
c.Assert(err, checker.IsNil)
out, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
out, err := s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
c.Assert(err, checker.IsNil)
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:1::aabb:ccdd:eeff")
}
@ -467,7 +464,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("Could not run container: %s, %v", out, err))
out, err = s.d.Cmd("exec", "hostcnt", "ip", "-6", "addr", "show", "docker0")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(strings.Trim(out, " \r\n'"), checker.Contains, "2001:db8:2::1")
}
@ -600,8 +597,8 @@ func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) {
Out: ipTablesSearchString,
})
_, err = d.Cmd("run", "-d", "--name", "ExtContainer", "busybox", "top")
c.Assert(err, check.IsNil)
out, err := d.Cmd("run", "-d", "--name", "ExtContainer", "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
containerIP := d.FindContainerIP(c, "ExtContainer")
ip := net.ParseIP(containerIP)
@ -671,8 +668,8 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
Out: ipTablesSearchString,
})
_, err := d.Cmd("run", "-d", "--name", "test", "busybox", "top")
c.Assert(err, check.IsNil)
out, err := d.Cmd("run", "-d", "--name", "test", "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
containerIP := d.FindContainerIP(c, "test")
ip = net.ParseIP(containerIP)
@ -738,7 +735,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
defer s.d.Restart(c)
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")
out, err = d.Cmd("exec", "bb", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
@ -746,7 +743,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
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)}'")
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")
}
@ -763,7 +760,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCIDREqualBridgeNetwork(c *check
defer s.d.Restart(c)
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)
defer d.Cmd("stop", cid1)
}
@ -782,7 +779,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) {
expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(strings.Contains(out, expectedMessage), check.Equals, true,
check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'",
bridgeIP, strings.TrimSpace(out)))
@ -804,7 +801,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) {
expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(strings.Contains(out, expectedMessage), check.Equals, true,
check.Commentf("Explicit default gateway should be %s, but default route was '%s'",
gatewayIP, strings.TrimSpace(out)))
@ -858,7 +855,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) {
defer deleteInterface(c, ifName)
_, err = d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
result := icmd.RunCommand("iptables", "-t", "nat", "-nvL")
result.Assert(c, icmd.Success)
@ -900,8 +897,8 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
// But, Pinging external or a Host interface must succeed
pingCmd := fmt.Sprintf("ping -c 1 %s -W 1", ip.String())
runArgs := []string{"run", "--rm", "busybox", "sh", "-c", pingCmd}
_, err := d.Cmd(runArgs...)
c.Assert(err, check.IsNil)
out, err := d.Cmd(runArgs...)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
}
func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
@ -924,10 +921,10 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
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")
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")
c.Assert(err, check.IsNil, check.Commentf(out))
c.Assert(err, check.IsNil, check.Commentf("%s", out))
}
func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *check.C) {
@ -940,10 +937,10 @@ func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *che
s.d.StartWithBusybox(c, "--bridge", bridgeName, "--icc=false")
defer s.d.Restart(c)
_, err := s.d.Cmd("run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "top")
c.Assert(err, check.IsNil)
_, err = s.d.Cmd("run", "-d", "--name", "parent", "--link", "child:http", "busybox", "top")
c.Assert(err, check.IsNil)
out, err := s.d.Cmd("run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
out, err = s.d.Cmd("run", "-d", "--name", "parent", "--link", "child:http", "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
childIP := s.d.FindContainerIP(c, "child")
parentIP := s.d.FindContainerIP(c, "parent")
@ -970,7 +967,7 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) {
out, err := s.d.Cmd("run", "--ulimit", "nproc=2048", "--name=test", "busybox", "/bin/sh", "-c", "echo $(ulimit -n); echo $(ulimit -p)")
if err != nil {
c.Fatal(out, err)
c.Fatal(err, out)
}
outArr := strings.Split(out, "\n")
@ -992,7 +989,7 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) {
out, err = s.d.Cmd("start", "-a", "test")
if err != nil {
c.Fatal(err)
c.Fatal(err, out)
}
outArr = strings.Split(out, "\n")
@ -1033,7 +1030,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *check.C) {
s.d.StartWithBusybox(c)
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")
c.Assert(err, check.IsNil)
@ -1145,7 +1142,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) {
s.d.StartWithBusybox(c, "--log-driver=none")
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")
c.Assert(err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
@ -1566,22 +1563,22 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway
s.d.StartWithBusybox(c)
out, err := s.d.Cmd("run", "-d", "--restart", "always", "busybox", "top")
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
id := strings.TrimSpace(out)
_, err = s.d.Cmd("stop", id)
c.Assert(err, check.IsNil)
_, err = s.d.Cmd("wait", id)
c.Assert(err, check.IsNil)
out, err = s.d.Cmd("stop", id)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
out, err = s.d.Cmd("wait", id)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
out, err = s.d.Cmd("ps", "-q")
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
c.Assert(out, check.Equals, "")
s.d.Restart(c)
out, err = s.d.Cmd("ps", "-q")
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", out))
c.Assert(strings.TrimSpace(out), check.Equals, id[:12])
}
@ -1638,7 +1635,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) {
s.d.StartWithBusybox(c)
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)
@ -1650,12 +1647,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) {
func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) {
s.d.Start(c)
_, err := s.d.Cmd("volume", "create", "test")
c.Assert(err, check.IsNil)
out, err := s.d.Cmd("volume", "create", "test")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
s.d.Restart(c)
_, err = s.d.Cmd("volume", "inspect", "test")
c.Assert(err, check.IsNil)
out, err = s.d.Cmd("volume", "inspect", "test")
c.Assert(err, check.IsNil, check.Commentf("%s", out))
}
// FIXME(vdemeester) should be a unit test
@ -1762,7 +1759,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C)
break
}
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil, check.Commentf("%s", ip))
c.Assert(ip, check.Not(check.Equals), bridgeIP)
cont++
@ -1792,7 +1789,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
// pull a repository large enough to overfill the mounted filesystem
pullOut, err := s.d.Cmd("pull", "debian:stretch")
c.Assert(err, checker.NotNil, check.Commentf(pullOut))
c.Assert(err, checker.NotNil, check.Commentf("%s", pullOut))
c.Assert(pullOut, checker.Contains, "no space left on device")
}
@ -1887,22 +1884,22 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) {
s.d.StartWithBusybox(c)
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")
c.Assert(err, check.IsNil, check.Commentf(out))
c.Assert(err, check.IsNil, check.Commentf("%s", out))
s.d.Restart(c)
// should fail since test is not running yet
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")
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")
c.Assert(err, check.IsNil, check.Commentf(out))
c.Assert(strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, 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("%s", out))
}
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
@ -1910,10 +1907,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
s.d.StartWithBusybox(c)
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")
c.Assert(err, check.IsNil, check.Commentf(out))
c.Assert(err, check.IsNil, check.Commentf("%s", out))
test2ID := strings.TrimSpace(out)
out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top")
@ -1926,10 +1923,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
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
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")
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:]
@ -2112,24 +2109,24 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) {
s.d.StartWithBusybox(c)
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")
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")
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")
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")
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")
s.d.Restart(c)
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")
}
@ -2253,11 +2250,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")
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)
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[]}")
}
@ -2428,19 +2425,19 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
// Run with default runtime
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
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
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"
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")
// Reset config to only have the default
@ -2457,16 +2454,16 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
// Run with default runtime
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"
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")
// Start previously created container with oci
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")
// Check that we can't override the default runtime
@ -2511,12 +2508,12 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
<-time.After(1 * time.Second)
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")
// Run with default runtime explicitly
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) {
@ -2524,19 +2521,19 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
// Run with default runtime
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
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
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"
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")
// Start a daemon without any extra runtimes
@ -2545,16 +2542,16 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
// Run with default runtime
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"
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")
// Start previously created container with oci
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")
// Check that we can't override the default runtime
@ -2570,12 +2567,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")
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")
// Run with default runtime explicitly
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) {
@ -2658,17 +2655,17 @@ func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
// custom one
s.d.StartWithBusybox(c, "--userland-proxy-path", newProxyPath)
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
s.d.Restart(c, "--userland-proxy-path", dockerProxyPath)
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
s.d.Restart(c, "--userland-proxy-path", "/does/not/exist")
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, "/does/not/exist: no such file or directory")
}

View file

@ -50,11 +50,11 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
containerEvents := eventActionsByIDAndType(c, events, name, "container")
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", 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")
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
}
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")
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
}
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
@ -262,10 +262,10 @@ func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
pluginEvents := eventActionsByIDAndType(c, events, pNameWithTag, "plugin")
c.Assert(pluginEvents, checker.HasLen, 4, check.Commentf("events: %v", events))
c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf(out))
c.Assert(pluginEvents[1], checker.Equals, "enable", check.Commentf(out))
c.Assert(pluginEvents[2], checker.Equals, "disable", check.Commentf(out))
c.Assert(pluginEvents[3], checker.Equals, "remove", check.Commentf(out))
c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf("%s", out))
c.Assert(pluginEvents[1], checker.Equals, "enable", check.Commentf("%s", out))
c.Assert(pluginEvents[2], checker.Equals, "disable", check.Commentf("%s", out))
c.Assert(pluginEvents[3], checker.Equals, "remove", check.Commentf("%s", out))
}
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")
c.Assert(len(events), checker.Equals, 1, check.Commentf(out))
c.Assert(len(events), checker.Equals, 1, check.Commentf("%s", out))
out, _ = dockerCmd(
c,
@ -643,7 +643,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
"--filter",
"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) {
@ -653,7 +653,7 @@ func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
out, _ := dockerCmd(c, "events", "--filter", "image=busybox", "--since", since, "--until", daemonUnixTime(c))
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) {

View file

@ -135,8 +135,8 @@ func (s *DockerSuite) TestEventsContainerFilterByName(c *check.C) {
c2 := strings.TrimSpace(cOut)
waitRun("bar")
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.Not(checker.Contains), c2, check.Commentf(out))
c.Assert(out, checker.Contains, c1, check.Commentf("%s", out))
c.Assert(out, checker.Not(checker.Contains), c2, check.Commentf("%s", out))
}
// #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))
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")
volumeActions := eventActionsByIDAndType(c, events, "test-event-volume-type", "volume")

View file

@ -164,7 +164,7 @@ func (s *DockerSuite) TestExecTTYCloseStdin(c *check.C) {
stdinRw.Close()
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")
outArr := strings.Split(out, "\n")
@ -517,7 +517,7 @@ func (s *DockerSuite) TestExecStartFails(c *check.C) {
c.Assert(waitRun(name), checker.IsNil)
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")
}

View file

@ -298,7 +298,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.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")
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)
_, err = s.d.Cmd("volume", "rm", "external-volume-test")
@ -320,7 +320,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.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")
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(s.ec.activations, checker.Equals, 1)
@ -334,13 +334,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check
s.d.StartWithBusybox(c)
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")
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")
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.creations, checker.Equals, 1)
@ -353,10 +353,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *c
s.d.StartWithBusybox(c)
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")
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.creations, checker.Equals, 1)
@ -453,7 +453,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c
}
out := inspectFieldJSON(c, "testing", "Mounts")
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].Driver, checker.Equals, volumePluginName)
}
@ -474,7 +474,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) {
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
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(s.ec.gets, check.Equals, 1)
@ -509,10 +509,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *
s.d.Start(c)
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")
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")
}
@ -525,11 +525,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C
c.Assert(s.ec.paths, checker.Equals, 0)
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)
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)
}
@ -537,7 +537,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.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")
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), "")
}
@ -548,7 +548,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *chec
for i := 0; i < 3; 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)
out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i))
c.Assert(err, checker.IsNil)
@ -564,10 +564,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
s.d.StartWithBusybox(c)
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")
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")
// 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
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")
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
var vs []types.Volume
err = json.Unmarshal([]byte(out), &vs)
@ -593,10 +593,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
// test create with different driver
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")
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
vs = nil
err = json.Unmarshal([]byte(out), &vs)
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")
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")
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) {
@ -620,12 +620,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check
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")
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")
c.Assert(s.ec.mounts, checker.Equals, 2, check.Commentf(out))
c.Assert(s.ec.unmounts, checker.Equals, 1, 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("%s", out))
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))
}

View file

@ -22,7 +22,7 @@ func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) {
// wrong credentials
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")
// now it's fine

View file

@ -59,7 +59,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C)
// check I cannot pull anymore
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")
}

View file

@ -327,7 +327,7 @@ func (s *DockerSuite) TestLogsWithDetails(c *check.C) {
out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test")
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], ",")
c.Assert(details, checker.HasLen, 2)

View file

@ -847,11 +847,11 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *
// but discovery is on when connecting to non default bridge network
network := "anotherbridge"
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)
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)
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) {
// Run a container on the default network
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
for _, nw := range nws {
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)
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
for _, nw := range nws {
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")
}
}
@ -1137,7 +1137,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c
for i := 0; i < 10; i++ {
cName := fmt.Sprintf("hostc-%d", i)
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
err = s.d.WaitRun(cName)
@ -1160,7 +1160,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *c
c.Assert(waitRun("container1"), check.IsNil)
dockerCmd(c, "network", "disconnect", "bridge", "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())
}

View file

@ -449,7 +449,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "touch /apple/core")
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")
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
_, 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", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)

View file

@ -282,7 +282,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
dockerCmd(c, "tag", "busybox", 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, checker.Contains, "no basic auth credentials")
}
@ -293,7 +293,7 @@ func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *check.C) {
repoName := "test/busybox"
dockerCmd(c, "tag", "busybox", 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")
}
@ -322,7 +322,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *che
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
dockerCmd(c, "tag", "busybox", 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.Contains, "unauthorized: a message")
}
@ -334,7 +334,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
dockerCmd(c, "tag", "busybox", 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")
split := strings.Split(out, "\n")
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)
dockerCmd(c, "tag", "busybox", 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
//c.Assert(out, checker.Contains, "Retrying")
//c.Assert(out, checker.Not(checker.Contains), "Retrying in 15")
@ -362,7 +362,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
dockerCmd(c, "tag", "busybox", 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")
split := strings.Split(out, "\n")
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)
dockerCmd(c, "tag", "busybox", 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")
split := strings.Split(out, "\n")
c.Assert(split[len(split)-2], check.Equals, "authorization server did not include a token in the response")

View file

@ -85,11 +85,11 @@ func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) {
// Disconnect the container from the network
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
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) {
@ -115,7 +115,7 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
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")
out, _ = dockerCmd(c, "create", "--restart=on-failure:1", "busybox")

View file

@ -3975,13 +3975,13 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) {
// test with the nocopy flag
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
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
// error out when the volume is already populated
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
out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
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
dockerCmd(c, "run", "--name=test", "-v", "/foo", "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")
c.Assert(err, checker.NotNil, check.Commentf(out))
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
// do not allow copy modes on binds
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")
c.Assert(err, checker.NotNil, check.Commentf(out))
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
}
// Test case for #21976
@ -4314,7 +4314,7 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
out, _, err := dockerCmdWithError("run", "--rm", "--read-only",
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
"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")
}

View file

@ -579,7 +579,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
testRequires(c, blkioWeight)
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"
c.Assert(out, checker.Contains, expected)
}
@ -587,31 +587,31 @@ func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) {
testRequires(c, blkioWeight)
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) {
testRequires(c, blkioWeight)
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) {
testRequires(c, blkioWeight)
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) {
testRequires(c, blkioWeight)
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) {
testRequires(c, blkioWeight)
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) {
@ -767,17 +767,17 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
testRequires(c, cpuShare, DaemonIsLinux)
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"
c.Assert(out, checker.Contains, expected)
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"
c.Assert(out, checker.Contains, expected)
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"
c.Assert(out, checker.Contains, expected)
}
@ -1349,7 +1349,7 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) {
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")
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")
}

View file

@ -18,29 +18,29 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
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"))
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"))
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"))
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"))
// -s --stars deprecated since Docker 1.13
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"))
// -s --stars deprecated since Docker 1.13
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"))
}

View file

@ -87,7 +87,7 @@ func (s *DockerSwarmSuite) TestSecretCreateWithFile(c *check.C) {
testName := "test_secret"
out, err := d.Cmd("secret", "create", testName, testFile.Name())
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)
secret := d.GetSecret(c, id)

View file

@ -18,7 +18,7 @@ import (
func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
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")
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
id := strings.TrimSpace(out)
var tasks []swarm.Task
@ -37,7 +37,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
// check container mount config
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
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
@ -51,7 +51,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
// check container mounts actual
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
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))
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)
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")
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)
}
@ -126,7 +126,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
serviceCmd = append(serviceCmd, secretFlags...)
serviceCmd = append(serviceCmd, "busybox", "top")
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)
c.Assert(err, checker.IsNil)
@ -160,7 +160,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
}
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) {
@ -176,7 +176,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
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")
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)
c.Assert(err, checker.IsNil)
@ -200,7 +200,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
}, checker.Equals, true)
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)
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
c.Assert(err, checker.IsNil)
@ -208,7 +208,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
}
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) {
@ -225,7 +225,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
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")
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)
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")
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)
}
@ -273,7 +273,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
serviceCmd = append(serviceCmd, configFlags...)
serviceCmd = append(serviceCmd, "busybox", "top")
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)
c.Assert(err, checker.IsNil)
@ -307,7 +307,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
}
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) {
@ -323,7 +323,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
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")
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)
c.Assert(err, checker.IsNil)
@ -347,7 +347,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
}, checker.Equals, true)
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)
out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
c.Assert(err, checker.IsNil)
@ -355,13 +355,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
}
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) {
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")
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
id := strings.TrimSpace(out)
var tasks []swarm.Task
@ -380,7 +380,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
// check container mount config
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
c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
@ -394,7 +394,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
// check container mounts actual
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
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)
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.Contains, "size=1024k")
}
@ -414,10 +414,10 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
d := s.AddDaemon(c, true, true)
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")
c.Assert(err, checker.IsNil, check.Commentf(out))
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
id := strings.TrimSpace(out)
var tasks []swarm.Task
@ -436,7 +436,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
// check container alias config
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
var aliases []string

View file

@ -34,7 +34,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) {
serviceName := "healthServiceRun"
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)
var tasks []swarm.Task
@ -95,7 +95,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) {
serviceName := "healthServiceStart"
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)
var tasks []swarm.Task

View file

@ -14,39 +14,39 @@ import (
func (s *DockerSwarmSuite) TestServiceUpdateLabel(c *check.C) {
d := s.AddDaemon(c, true, true)
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")
c.Assert(service.Spec.Labels, checker.HasLen, 0)
// add label to empty set
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")
c.Assert(service.Spec.Labels, checker.HasLen, 1)
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
// add label to non-empty set
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")
c.Assert(service.Spec.Labels, checker.HasLen, 2)
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "bar")
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")
c.Assert(service.Spec.Labels, checker.HasLen, 1)
c.Assert(service.Spec.Labels["foo2"], checker.Equals, "")
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")
c.Assert(service.Spec.Labels, checker.HasLen, 0)
c.Assert(service.Spec.Labels["foo"], checker.Equals, "")
// now make sure we can add again
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")
c.Assert(service.Spec.Labels, checker.HasLen, 1)
c.Assert(service.Spec.Labels["foo"], checker.Equals, "bar")
@ -66,11 +66,11 @@ func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
serviceName := "test"
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
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)
c.Assert(err, checker.IsNil)
@ -85,7 +85,7 @@ func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
// remove
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)
c.Assert(err, checker.IsNil)
@ -108,11 +108,11 @@ func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
serviceName := "test"
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
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)
c.Assert(err, checker.IsNil)
@ -127,7 +127,7 @@ func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
// remove
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)
c.Assert(err, checker.IsNil)

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
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")
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
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
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
// 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(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].Driver, checker.Equals, "customvolumedriver")
}