go run rm-gocheck.go redress '\bc\.Assert\b.*(,|\()\s*$' \
"integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 36e7001b996afda232318d5f286ed9bf55492654)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -679,9 +679,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
|
| 679 | 679 |
|
| 680 | 680 |
containerIP := d.FindContainerIP(c, "test") |
| 681 | 681 |
ip = net.ParseIP(containerIP) |
| 682 |
- c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, |
|
| 683 |
- check.Commentf("Container IP-Address must be in the same subnet range : %s",
|
|
| 684 |
- containerIP)) |
|
| 682 |
+ c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 685 | 683 |
deleteInterface(c, defaultNetworkBridge) |
| 686 | 684 |
} |
| 687 | 685 |
|
| ... | ... |
@@ -785,9 +783,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) {
|
| 785 | 785 |
expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
|
| 786 | 786 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 787 | 787 |
assert.NilError(c, err, out) |
| 788 |
- c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, |
|
| 789 |
- check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'",
|
|
| 790 |
- bridgeIP, strings.TrimSpace(out))) |
|
| 788 |
+ 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)))
|
|
| 791 | 789 |
deleteInterface(c, defaultNetworkBridge) |
| 792 | 790 |
} |
| 793 | 791 |
|
| ... | ... |
@@ -807,9 +803,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) {
|
| 807 | 807 |
expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
|
| 808 | 808 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 809 | 809 |
assert.NilError(c, err, out) |
| 810 |
- c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, |
|
| 811 |
- check.Commentf("Explicit default gateway should be %s, but default route was '%s'",
|
|
| 812 |
- gatewayIP, strings.TrimSpace(out))) |
|
| 810 |
+ 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)))
|
|
| 813 | 811 |
deleteInterface(c, defaultNetworkBridge) |
| 814 | 812 |
} |
| 815 | 813 |
|
| ... | ... |
@@ -850,8 +844,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) {
|
| 850 | 850 |
defer d.Restart(c) |
| 851 | 851 |
|
| 852 | 852 |
out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
|
| 853 |
- c.Assert(err, check.NotNil, |
|
| 854 |
- check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 853 |
+ c.Assert(err, check.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 855 | 854 |
c.Assert(strings.Contains(out, "Error starting userland proxy"), check.Equals, true) |
| 856 | 855 |
|
| 857 | 856 |
ifName := "dummy" |
| ... | ... |
@@ -865,8 +858,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) {
|
| 865 | 865 |
result.Assert(c, icmd.Success) |
| 866 | 866 |
regex := fmt.Sprintf("DNAT.*%s.*dpt:8000", ip.String())
|
| 867 | 867 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 868 |
- c.Assert(matched, check.Equals, true, |
|
| 869 |
- check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 868 |
+ c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 870 | 869 |
} |
| 871 | 870 |
|
| 872 | 871 |
func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
|
| ... | ... |
@@ -886,9 +878,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
|
| 886 | 886 |
result.Assert(c, icmd.Success) |
| 887 | 887 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 888 | 888 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 889 |
- c.Assert(matched, check.Equals, true, |
|
| 890 |
- check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 891 |
- |
|
| 889 |
+ c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 892 | 890 |
// Pinging another container must fail with --icc=false |
| 893 | 891 |
pingContainers(c, d, true) |
| 894 | 892 |
|
| ... | ... |
@@ -921,9 +911,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
|
| 921 | 921 |
result.Assert(c, icmd.Success) |
| 922 | 922 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 923 | 923 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 924 |
- c.Assert(matched, check.Equals, true, |
|
| 925 |
- check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 926 |
- |
|
| 924 |
+ c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 927 | 925 |
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
| 928 | 926 |
assert.NilError(c, err, out) |
| 929 | 927 |
|
| ... | ... |
@@ -826,18 +826,14 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 826 | 826 |
// verify first container's etc/hosts file has not changed after spawning the second named container |
| 827 | 827 |
hostsPost, err := s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 828 | 828 |
assert.NilError(c, err) |
| 829 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), |
|
| 830 |
- check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 831 |
- |
|
| 829 |
+ c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 832 | 830 |
// stop container 2 and verify first container's etc/hosts has not changed |
| 833 | 831 |
_, err = s.d.Cmd("stop", cid2)
|
| 834 | 832 |
assert.NilError(c, err) |
| 835 | 833 |
|
| 836 | 834 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 837 | 835 |
assert.NilError(c, err) |
| 838 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), |
|
| 839 |
- check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 840 |
- |
|
| 836 |
+ c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 841 | 837 |
// but discovery is on when connecting to non default bridge network |
| 842 | 838 |
network := "anotherbridge" |
| 843 | 839 |
out, err = s.d.Cmd("network", "create", network)
|
| ... | ... |
@@ -852,8 +848,7 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 852 | 852 |
|
| 853 | 853 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 854 | 854 |
assert.NilError(c, err) |
| 855 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), |
|
| 856 |
- check.Commentf("Unexpected %s change on second network connection", hostsFile))
|
|
| 855 |
+ c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile))
|
|
| 857 | 856 |
} |
| 858 | 857 |
|
| 859 | 858 |
func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| ... | ... |
@@ -876,9 +871,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 876 | 876 |
|
| 877 | 877 |
// verify first container etc/hosts file has not changed |
| 878 | 878 |
hosts1post := readContainerFileWithExec(c, cid1, hostsFile) |
| 879 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), |
|
| 880 |
- check.Commentf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 881 |
- |
|
| 879 |
+ c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 882 | 880 |
// Connect the 2nd container to a new network and verify the |
| 883 | 881 |
// first container /etc/hosts file still hasn't changed. |
| 884 | 882 |
dockerCmd(c, "network", "create", "-d", "bridge", cstmBridgeNw1) |
| ... | ... |
@@ -888,9 +881,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 888 | 888 |
|
| 889 | 889 |
hosts2 := readContainerFileWithExec(c, cid2, hostsFile) |
| 890 | 890 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 891 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), |
|
| 892 |
- check.Commentf("Unexpected %s change on container connect", hostsFile))
|
|
| 893 |
- |
|
| 891 |
+ c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on container connect", hostsFile))
|
|
| 894 | 892 |
// start a named container |
| 895 | 893 |
cName := "AnyName" |
| 896 | 894 |
out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "--name", cName, "busybox", "top") |
| ... | ... |
@@ -903,13 +894,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 903 | 903 |
// Stop named container and verify first two containers' etc/hosts file hasn't changed |
| 904 | 904 |
dockerCmd(c, "stop", cid3) |
| 905 | 905 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 906 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), |
|
| 907 |
- check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 908 |
- |
|
| 906 |
+ c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 909 | 907 |
hosts2post := readContainerFileWithExec(c, cid2, hostsFile) |
| 910 |
- c.Assert(string(hosts2), checker.Equals, string(hosts2post), |
|
| 911 |
- check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 912 |
- |
|
| 908 |
+ c.Assert(string(hosts2), checker.Equals, string(hosts2post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 913 | 909 |
// verify that container 1 and 2 can't ping the named container now |
| 914 | 910 |
_, _, err := dockerCmdWithError("exec", cid1, "ping", "-c", "1", cName)
|
| 915 | 911 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -338,15 +338,11 @@ func (s *DockerSuite) TestPortBindingOnSandbox(c *check.C) {
|
| 338 | 338 |
c.Assert(waitRun("c1"), check.IsNil)
|
| 339 | 339 |
|
| 340 | 340 |
_, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 341 |
- c.Assert(err, check.NotNil, |
|
| 342 |
- check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 343 |
- |
|
| 341 |
+ c.Assert(err, check.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 344 | 342 |
// Connect container to another normal bridge network |
| 345 | 343 |
dockerCmd(c, "network", "create", "-d", "bridge", "foo-net") |
| 346 | 344 |
dockerCmd(c, "network", "connect", "foo-net", "c1") |
| 347 | 345 |
|
| 348 | 346 |
_, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 349 |
- c.Assert(err, check.IsNil, |
|
| 350 |
- check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 351 |
- |
|
| 347 |
+ c.Assert(err, check.IsNil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 352 | 348 |
} |
| ... | ... |
@@ -4495,14 +4495,11 @@ func (s *DockerSuite) TestRunMount(c *check.C) {
|
| 4495 | 4495 |
_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
|
| 4496 | 4496 |
append(opts, []string{"busybox", "top"}...)...)...)
|
| 4497 | 4497 |
if testCase.valid {
|
| 4498 |
- c.Assert(err, check.IsNil, |
|
| 4499 |
- check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4500 |
- c.Assert(testCase.fn(cName), check.IsNil, |
|
| 4501 |
- check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4498 |
+ c.Assert(err, check.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4499 |
+ c.Assert(testCase.fn(cName), check.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4502 | 4500 |
dockerCmd(c, "rm", "-f", cName) |
| 4503 | 4501 |
} else {
|
| 4504 |
- c.Assert(err, checker.NotNil, |
|
| 4505 |
- check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4502 |
+ c.Assert(err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4506 | 4503 |
} |
| 4507 | 4504 |
} |
| 4508 | 4505 |
} |
| ... | ... |
@@ -1549,8 +1549,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *check.C) {
|
| 1549 | 1549 |
out, err := d.Cmd("network", "create", "--driver", driver1, nwName)
|
| 1550 | 1550 |
assert.NilError(c, err, "out: %v", out) |
| 1551 | 1551 |
out, err = d.Cmd("network", "create", "--driver", driver2, nwName)
|
| 1552 |
- c.Assert(out, checker.Contains, |
|
| 1553 |
- fmt.Sprintf("network with name %s already exists", nwName))
|
|
| 1552 |
+ c.Assert(out, checker.Contains, fmt.Sprintf("network with name %s already exists", nwName))
|
|
| 1554 | 1553 |
assert.ErrorContains(c, err, "") |
| 1555 | 1554 |
c.Logf("As expected, the attempt to network %q with %q failed: %s",
|
| 1556 | 1555 |
nwName, driver2, out) |
| ... | ... |
@@ -37,12 +37,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *check.C) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func (s *DockerSuite) TestVolumeCLIInspect(c *check.C) {
|
| 40 |
- c.Assert( |
|
| 41 |
- exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), |
|
| 42 |
- check.Not(check.IsNil), |
|
| 43 |
- check.Commentf("volume inspect should error on non-existent volume"),
|
|
| 44 |
- ) |
|
| 45 |
- |
|
| 40 |
+ c.Assert(exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
|
|
| 46 | 41 |
out, _ := dockerCmd(c, "volume", "create") |
| 47 | 42 |
name := strings.TrimSpace(out) |
| 48 | 43 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name)
|
| ... | ... |
@@ -215,11 +210,7 @@ func (s *DockerSuite) TestVolumeCLIRm(c *check.C) {
|
| 215 | 215 |
dockerCmd(c, "rm", "test2") |
| 216 | 216 |
|
| 217 | 217 |
dockerCmd(c, "volume", "rm", volumeID) |
| 218 |
- c.Assert( |
|
| 219 |
- exec.Command("volume", "rm", "doesnotexist").Run(),
|
|
| 220 |
- check.Not(check.IsNil), |
|
| 221 |
- check.Commentf("volume rm should fail with non-existent volume"),
|
|
| 222 |
- ) |
|
| 218 |
+ c.Assert(exec.Command("volume", "rm", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
|
|
| 223 | 219 |
} |
| 224 | 220 |
|
| 225 | 221 |
// FIXME(vdemeester) should be a unit test in cli/command/volume package |