diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index d27e7d7e57..26a89a0be0 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -679,9 +679,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) { containerIP := d.FindContainerIP(c, "test") ip = net.ParseIP(containerIP) - c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, - check.Commentf("Container IP-Address must be in the same subnet range : %s", - containerIP)) + c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP)) deleteInterface(c, defaultNetworkBridge) } @@ -785,9 +783,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) { expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP) out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0") assert.NilError(c, err, out) - c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, - check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", - bridgeIP, strings.TrimSpace(out))) + c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out))) deleteInterface(c, defaultNetworkBridge) } @@ -807,9 +803,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) { expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP) out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0") assert.NilError(c, err, out) - c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, - check.Commentf("Explicit default gateway should be %s, but default route was '%s'", - gatewayIP, strings.TrimSpace(out))) + c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out))) deleteInterface(c, defaultNetworkBridge) } @@ -850,8 +844,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) { defer d.Restart(c) out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top") - c.Assert(err, check.NotNil, - check.Commentf("Running a container must fail with an invalid --ip option")) + c.Assert(err, check.NotNil, check.Commentf("Running a container must fail with an invalid --ip option")) c.Assert(strings.Contains(out, "Error starting userland proxy"), check.Equals, true) ifName := "dummy" @@ -865,8 +858,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) { result.Assert(c, icmd.Success) regex := fmt.Sprintf("DNAT.*%s.*dpt:8000", ip.String()) matched, _ := regexp.MatchString(regex, result.Combined()) - c.Assert(matched, check.Equals, true, - check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) + c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) } func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) { @@ -886,9 +878,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) { result.Assert(c, icmd.Success) regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName) matched, _ := regexp.MatchString(regex, result.Combined()) - c.Assert(matched, check.Equals, true, - check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) - + c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) // Pinging another container must fail with --icc=false pingContainers(c, d, true) @@ -921,9 +911,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) { result.Assert(c, icmd.Success) regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName) matched, _ := regexp.MatchString(regex, result.Combined()) - c.Assert(matched, check.Equals, true, - check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) - + c.Assert(matched, check.Equals, true, 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") assert.NilError(c, err, out) diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index ba525dd50c..242ec016b2 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -826,18 +826,14 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * // verify first container's etc/hosts file has not changed after spawning the second named container hostsPost, err := s.d.Cmd("exec", cid1, "cat", hostsFile) assert.NilError(c, err) - c.Assert(string(hosts), checker.Equals, string(hostsPost), - check.Commentf("Unexpected %s change on second container creation", hostsFile)) - + c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile)) // stop container 2 and verify first container's etc/hosts has not changed _, err = s.d.Cmd("stop", cid2) assert.NilError(c, err) hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile) assert.NilError(c, err) - c.Assert(string(hosts), checker.Equals, string(hostsPost), - check.Commentf("Unexpected %s change on second container creation", hostsFile)) - + c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile)) // but discovery is on when connecting to non default bridge network network := "anotherbridge" out, err = s.d.Cmd("network", "create", network) @@ -852,8 +848,7 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile) assert.NilError(c, err) - c.Assert(string(hosts), checker.Equals, string(hostsPost), - check.Commentf("Unexpected %s change on second network connection", hostsFile)) + c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile)) } func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { @@ -876,9 +871,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { // verify first container etc/hosts file has not changed hosts1post := readContainerFileWithExec(c, cid1, hostsFile) - c.Assert(string(hosts1), checker.Equals, string(hosts1post), - check.Commentf("Unexpected %s change on anonymous container creation", hostsFile)) - + c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on anonymous container creation", hostsFile)) // Connect the 2nd container to a new network and verify the // first container /etc/hosts file still hasn't changed. dockerCmd(c, "network", "create", "-d", "bridge", cstmBridgeNw1) @@ -888,9 +881,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { hosts2 := readContainerFileWithExec(c, cid2, hostsFile) hosts1post = readContainerFileWithExec(c, cid1, hostsFile) - c.Assert(string(hosts1), checker.Equals, string(hosts1post), - check.Commentf("Unexpected %s change on container connect", hostsFile)) - + c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on container connect", hostsFile)) // start a named container cName := "AnyName" out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "--name", cName, "busybox", "top") @@ -903,13 +894,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { // Stop named container and verify first two containers' etc/hosts file hasn't changed dockerCmd(c, "stop", cid3) hosts1post = readContainerFileWithExec(c, cid1, hostsFile) - c.Assert(string(hosts1), checker.Equals, string(hosts1post), - check.Commentf("Unexpected %s change on name container creation", hostsFile)) - + c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on name container creation", hostsFile)) hosts2post := readContainerFileWithExec(c, cid2, hostsFile) - c.Assert(string(hosts2), checker.Equals, string(hosts2post), - check.Commentf("Unexpected %s change on name container creation", hostsFile)) - + c.Assert(string(hosts2), checker.Equals, string(hosts2post), check.Commentf("Unexpected %s change on name container creation", hostsFile)) // verify that container 1 and 2 can't ping the named container now _, _, err := dockerCmdWithError("exec", cid1, "ping", "-c", "1", cName) assert.ErrorContains(c, err, "") diff --git a/integration-cli/docker_cli_port_test.go b/integration-cli/docker_cli_port_test.go index 32f59eb3f4..86dff0d0f5 100644 --- a/integration-cli/docker_cli_port_test.go +++ b/integration-cli/docker_cli_port_test.go @@ -338,15 +338,11 @@ func (s *DockerSuite) TestPortBindingOnSandbox(c *check.C) { c.Assert(waitRun("c1"), check.IsNil) _, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080") - c.Assert(err, check.NotNil, - check.Commentf("Port mapping on internal network is expected to fail")) - + c.Assert(err, check.NotNil, check.Commentf("Port mapping on internal network is expected to fail")) // Connect container to another normal bridge network dockerCmd(c, "network", "create", "-d", "bridge", "foo-net") dockerCmd(c, "network", "connect", "foo-net", "c1") _, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080") - c.Assert(err, check.IsNil, - check.Commentf("Port mapping on the new network is expected to succeed")) - + c.Assert(err, check.IsNil, check.Commentf("Port mapping on the new network is expected to succeed")) } diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index a2b944d2e1..8e1d01e447 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -4497,14 +4497,11 @@ func (s *DockerSuite) TestRunMount(c *check.C) { _, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName}, append(opts, []string{"busybox", "top"}...)...)...) if testCase.valid { - c.Assert(err, check.IsNil, - check.Commentf("got error while creating a container with %v (%s)", opts, cName)) - c.Assert(testCase.fn(cName), check.IsNil, - check.Commentf("got error while executing test for %v (%s)", opts, cName)) + c.Assert(err, check.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName)) + c.Assert(testCase.fn(cName), check.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName)) dockerCmd(c, "rm", "-f", cName) } else { - c.Assert(err, checker.NotNil, - check.Commentf("got nil while creating a container with %v (%s)", opts, cName)) + c.Assert(err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName)) } } } diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index 0eca47cd09..aae03e557e 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -1549,8 +1549,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *check.C) { out, err := d.Cmd("network", "create", "--driver", driver1, nwName) assert.NilError(c, err, "out: %v", out) out, err = d.Cmd("network", "create", "--driver", driver2, nwName) - c.Assert(out, checker.Contains, - fmt.Sprintf("network with name %s already exists", nwName)) + c.Assert(out, checker.Contains, fmt.Sprintf("network with name %s already exists", nwName)) assert.ErrorContains(c, err, "") c.Logf("As expected, the attempt to network %q with %q failed: %s", nwName, driver2, out) diff --git a/integration-cli/docker_cli_volume_test.go b/integration-cli/docker_cli_volume_test.go index 8e6321f3ed..174a167b69 100644 --- a/integration-cli/docker_cli_volume_test.go +++ b/integration-cli/docker_cli_volume_test.go @@ -37,12 +37,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *check.C) { } func (s *DockerSuite) TestVolumeCLIInspect(c *check.C) { - c.Assert( - exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), - check.Not(check.IsNil), - check.Commentf("volume inspect should error on non-existent volume"), - ) - + c.Assert(exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume")) out, _ := dockerCmd(c, "volume", "create") name := strings.TrimSpace(out) out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name) @@ -215,11 +210,7 @@ func (s *DockerSuite) TestVolumeCLIRm(c *check.C) { dockerCmd(c, "rm", "test2") dockerCmd(c, "volume", "rm", volumeID) - c.Assert( - exec.Command("volume", "rm", "doesnotexist").Run(), - check.Not(check.IsNil), - check.Commentf("volume rm should fail with non-existent volume"), - ) + c.Assert(exec.Command("volume", "rm", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume rm should fail with non-existent volume")) } // FIXME(vdemeester) should be a unit test in cli/command/volume package