From 83363fb2d4d97d952a0052d079faa8ae39aa20b6 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 14 Aug 2018 10:45:39 +0300 Subject: [PATCH] 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 --- integration-cli/check_test.go | 4 +- .../docker_api_swarm_service_test.go | 8 +- integration-cli/docker_api_swarm_test.go | 4 +- .../docker_cli_config_create_test.go | 2 +- integration-cli/docker_cli_cp_test.go | 4 +- integration-cli/docker_cli_create_test.go | 2 +- .../docker_cli_daemon_plugins_test.go | 20 +-- integration-cli/docker_cli_daemon_test.go | 102 ++++++------- integration-cli/docker_cli_events_test.go | 44 +++--- .../docker_cli_events_unix_test.go | 6 +- integration-cli/docker_cli_exec_test.go | 4 +- ...er_cli_external_volume_driver_unix_test.go | 54 +++---- integration-cli/docker_cli_login_test.go | 2 +- integration-cli/docker_cli_logout_test.go | 2 +- integration-cli/docker_cli_logs_test.go | 2 +- .../docker_cli_network_unix_test.go | 16 +- integration-cli/docker_cli_plugins_test.go | 4 +- integration-cli/docker_cli_push_test.go | 14 +- integration-cli/docker_cli_restart_test.go | 6 +- integration-cli/docker_cli_run_test.go | 14 +- integration-cli/docker_cli_run_unix_test.go | 20 +-- integration-cli/docker_cli_search_test.go | 12 +- .../docker_cli_secret_create_test.go | 2 +- .../docker_cli_service_create_test.go | 48 +++--- .../docker_cli_service_health_test.go | 4 +- .../docker_cli_service_update_test.go | 24 +-- integration-cli/docker_cli_swarm_test.go | 140 +++++++++--------- integration-cli/docker_cli_swarm_unix_test.go | 6 +- 28 files changed, 285 insertions(+), 285 deletions(-) diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 76b17627e7..256b9153d2 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -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 { diff --git a/integration-cli/docker_api_swarm_service_test.go b/integration-cli/docker_api_swarm_service_test.go index 1a826c99c6..4d39a34b09 100644 --- a/integration-cli/docker_api_swarm_service_test.go +++ b/integration-cli/docker_api_swarm_service_test.go @@ -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}) diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index 6a31dd209f..97e7e6ba51 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -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) { diff --git a/integration-cli/docker_cli_config_create_test.go b/integration-cli/docker_cli_config_create_test.go index c499a2c9cf..a04081df23 100644 --- a/integration-cli/docker_cli_config_create_test.go +++ b/integration-cli/docker_cli_config_create_test.go @@ -25,7 +25,7 @@ func (s *DockerSwarmSuite) TestConfigCreateWithFile(c *check.C) { 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(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf("%s", out)) id := strings.TrimSpace(out) config := d.GetConfig(c, id) diff --git a/integration-cli/docker_cli_cp_test.go b/integration-cli/docker_cli_cp_test.go index a1997335b1..b2826ab922 100644 --- a/integration-cli/docker_cli_cp_test.go +++ b/integration-cli/docker_cli_cp_test.go @@ -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) diff --git a/integration-cli/docker_cli_create_test.go b/integration-cli/docker_cli_create_test.go index 9ec400b2e1..cb4de73c5e 100644 --- a/integration-cli/docker_cli_create_test.go +++ b/integration-cli/docker_cli_create_test.go @@ -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") } diff --git a/integration-cli/docker_cli_daemon_plugins_test.go b/integration-cli/docker_cli_daemon_plugins_test.go index 69e190c30d..b04a5be932 100644 --- a/integration-cli/docker_cli_daemon_plugins_test.go +++ b/integration-cli/docker_cli_daemon_plugins_test.go @@ -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 { @@ -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 { diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 674ef94e48..b99a3fc980 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -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}, "") @@ -426,13 +426,13 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) { out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test") 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) 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")) } @@ -738,7 +738,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 +746,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 +763,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) } @@ -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())) 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) { @@ -1033,7 +1033,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 +1145,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")) @@ -1638,7 +1638,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) @@ -1887,22 +1887,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 +1910,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 +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")) // 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 +2112,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 +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") 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 +2428,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 +2457,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 +2511,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 +2524,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 +2545,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 +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") 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 +2658,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") } diff --git a/integration-cli/docker_cli_events_test.go b/integration-cli/docker_cli_events_test.go index db1e34020f..8db120d03d 100644 --- a/integration-cli/docker_cli_events_test.go +++ b/integration-cli/docker_cli_events_test.go @@ -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) { diff --git a/integration-cli/docker_cli_events_unix_test.go b/integration-cli/docker_cli_events_unix_test.go index 343b900342..92403e006e 100644 --- a/integration-cli/docker_cli_events_unix_test.go +++ b/integration-cli/docker_cli_events_unix_test.go @@ -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") diff --git a/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index e97fb85140..2f72eb90e6 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/integration-cli/docker_cli_exec_test.go @@ -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") } diff --git a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/integration-cli/docker_cli_external_volume_driver_unix_test.go index 719473b13e..da8bb7e011 100644 --- a/integration-cli/docker_cli_external_volume_driver_unix_test.go +++ b/integration-cli/docker_cli_external_volume_driver_unix_test.go @@ -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)) } diff --git a/integration-cli/docker_cli_login_test.go b/integration-cli/docker_cli_login_test.go index cb261bed85..546f55c0b9 100644 --- a/integration-cli/docker_cli_login_test.go +++ b/integration-cli/docker_cli_login_test.go @@ -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 diff --git a/integration-cli/docker_cli_logout_test.go b/integration-cli/docker_cli_logout_test.go index e0752f489c..ee4b032b76 100644 --- a/integration-cli/docker_cli_logout_test.go +++ b/integration-cli/docker_cli_logout_test.go @@ -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") } diff --git a/integration-cli/docker_cli_logs_test.go b/integration-cli/docker_cli_logs_test.go index 60ea333815..2740de6f06 100644 --- a/integration-cli/docker_cli_logs_test.go +++ b/integration-cli/docker_cli_logs_test.go @@ -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) diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index 60f211cda8..d3d6256a75 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -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), "\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()) } diff --git a/integration-cli/docker_cli_plugins_test.go b/integration-cli/docker_cli_plugins_test.go index 3692b6cb70..2cc5bfe2ff 100644 --- a/integration-cli/docker_cli_plugins_test.go +++ b/integration-cli/docker_cli_plugins_test.go @@ -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) diff --git a/integration-cli/docker_cli_push_test.go b/integration-cli/docker_cli_push_test.go index 01ad829192..0f0df1ab24 100644 --- a/integration-cli/docker_cli_push_test.go +++ b/integration-cli/docker_cli_push_test.go @@ -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") diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index 02d4254c35..791677e6e0 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -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") diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 53abc21c62..4f55c05aeb 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -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") } diff --git a/integration-cli/docker_cli_run_unix_test.go b/integration-cli/docker_cli_run_unix_test.go index 3444d22bfd..5f782ee530 100644 --- a/integration-cli/docker_cli_run_unix_test.go +++ b/integration-cli/docker_cli_run_unix_test.go @@ -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") } diff --git a/integration-cli/docker_cli_search_test.go b/integration-cli/docker_cli_search_test.go index 2c3312d9e9..809088a115 100644 --- a/integration-cli/docker_cli_search_test.go +++ b/integration-cli/docker_cli_search_test.go @@ -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")) } diff --git a/integration-cli/docker_cli_secret_create_test.go b/integration-cli/docker_cli_secret_create_test.go index 738db3b9e5..cf566f08a0 100644 --- a/integration-cli/docker_cli_secret_create_test.go +++ b/integration-cli/docker_cli_secret_create_test.go @@ -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) diff --git a/integration-cli/docker_cli_service_create_test.go b/integration-cli/docker_cli_service_create_test.go index d690b7e45f..d00e15a0e3 100644 --- a/integration-cli/docker_cli_service_create_test.go +++ b/integration-cli/docker_cli_service_create_test.go @@ -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 diff --git a/integration-cli/docker_cli_service_health_test.go b/integration-cli/docker_cli_service_health_test.go index ae9e7868bb..994ee77b99 100644 --- a/integration-cli/docker_cli_service_health_test.go +++ b/integration-cli/docker_cli_service_health_test.go @@ -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 diff --git a/integration-cli/docker_cli_service_update_test.go b/integration-cli/docker_cli_service_update_test.go index a281327afe..c729860ec9 100644 --- a/integration-cli/docker_cli_service_update_test.go +++ b/integration-cli/docker_cli_service_update_test.go @@ -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) diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index ae9fb3e8dd..9c108e0ecc 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -172,14 +172,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) { 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") - c.Assert(err, checker.IsNil, check.Commentf(out)) + c.Assert(err, checker.IsNil, check.Commentf("%s", out)) // make sure task has been deployed. waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) containers := d.ActiveContainers(c) 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")) } @@ -323,17 +323,17 @@ func (s *DockerSwarmSuite) TestSwarmContainerAutoStart(c *check.C) { c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") 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), "") 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), "") d.Restart(c) 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), "") } @@ -341,25 +341,25 @@ func (s *DockerSwarmSuite) TestSwarmContainerEndpointOptions(c *check.C) { d := s.AddDaemon(c, true, true) 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), "") _, 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") - 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") - 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 _, 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") - 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") - c.Assert(err, check.IsNil, check.Commentf(out)) + c.Assert(err, check.IsNil, check.Commentf("%s", out)) } func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) { @@ -394,21 +394,21 @@ func (s *DockerSwarmSuite) TestOverlayAttachable(c *check.C) { d := s.AddDaemon(c, true, true) 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 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") // validate containers can attache to this overlay network 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 // containers attach to the network 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") } @@ -418,11 +418,11 @@ func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) { // Create an attachable swarm network nwName := "attovl" 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 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 err = d.SwarmLeave(true) @@ -444,11 +444,11 @@ func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *che // Create attachable network 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 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 _, 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 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 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) { @@ -478,7 +478,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) { // And recreated 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 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 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.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 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.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 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) { @@ -529,9 +529,9 @@ func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C // Create a overlay network and launch a service on it // Make sure nothing panics because ingress network is missing 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") - 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: @@ -1540,22 +1540,22 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) { d := s.AddDaemon(c, true, true) 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), "") 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, "com.docker.network.ipam.serial:true") 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. waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) 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, "com.docker.network.ipam.serial:true") } @@ -1611,7 +1611,7 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) { 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") - c.Assert(err, check.IsNil, check.Commentf(out)) + c.Assert(err, check.IsNil, check.Commentf("%s", out)) id := strings.TrimSpace(out) // 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 // 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) - 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, "{ tcp 80 5005 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) 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. waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) 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") containers := d.ActiveContainers(c) 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") } @@ -1704,32 +1704,32 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) { // Full ID always works 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) // Name works if it is unique 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) n2, err := cli.NetworkCreate(context.Background(), name, options) c.Assert(err, checker.IsNil) // Full ID always works 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) 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) // Name with duplicates 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") 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 options.Driver = "overlay" @@ -1739,16 +1739,16 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) { // Full ID always works 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) 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) // Name with duplicates 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") } @@ -1758,25 +1758,25 @@ func (s *DockerSwarmSuite) TestSwarmStopSignal(c *check.C) { d := s.AddDaemon(c, true, true) 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. waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) 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") containers := d.ActiveContainers(c) 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") 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") - 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") } @@ -1784,18 +1784,18 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) { d := s.AddDaemon(c, true, true) 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), "") 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), "") // make sure task has been deployed. waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 2) 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, "top2") 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") c.Assert(out, checker.Not(checker.Contains), "top1") 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") - 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.Not(checker.Contains), "top2") } @@ -1860,7 +1860,7 @@ func waitForEvent(c *check.C, d *daemon.Daemon, since string, filter string, eve } else { 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) { return strings.TrimSpace(out) } @@ -1880,7 +1880,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) { // create a network 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) c.Assert(networkID, checker.Not(checker.Equals), "") @@ -1898,7 +1898,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) { // create a service 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] // scope swarm filters cluster events @@ -1919,12 +1919,12 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) { // create a service 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] // create a network 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) c.Assert(networkID, checker.Not(checker.Equals), "") @@ -1942,7 +1942,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) { // create a service 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] // validate service create event @@ -1950,7 +1950,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) { t1 := daemonUnixTime(c) 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 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 t2 := daemonUnixTime(c) 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) c.Assert(out, checker.Contains, "replicas.new=3, replicas.old=1") @@ -1972,7 +1972,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) { // remove service t3 := daemonUnixTime(c) 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) } @@ -1987,7 +1987,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) { t1 := daemonUnixTime(c) 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 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) 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) t3 := daemonUnixTime(c) 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 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 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) waitForEvent(c, d, "0", "-f scope=swarm", "network create "+networkID, defaultRetryCount) @@ -2020,7 +2020,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *check.C) { // remove network t1 := daemonUnixTime(c) 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 waitForEvent(c, d, t1, "-f type=network", "network remove "+networkID, defaultRetryCount) diff --git a/integration-cli/docker_cli_swarm_unix_test.go b/integration-cli/docker_cli_swarm_unix_test.go index f491a0da60..7473937eda 100644 --- a/integration-cli/docker_cli_swarm_unix_test.go +++ b/integration-cli/docker_cli_swarm_unix_test.go @@ -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") }