Browse code

integration-cli: dockerCmdWithFail: remove unused return

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/07/27 20:03:15
Showing 2 changed files
... ...
@@ -29,12 +29,11 @@ func (s *DockerCLINetmodeSuite) OnTimeout(c *testing.T) {
29 29
 }
30 30
 
31 31
 // DockerCmdWithFail executes a docker command that is supposed to fail and returns
32
-// the output, the exit code. If the command returns a Nil error, it will fail and
33
-// stop the tests.
34
-func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
35
-	out, status, err := dockerCmdWithError(args...)
32
+// the output. If the command returns a Nil error, it will fail and stop the tests.
33
+func dockerCmdWithFail(c *testing.T, args ...string) string {
34
+	out, _, err := dockerCmdWithError(args...)
36 35
 	assert.Assert(c, err != nil, "%v", out)
37
-	return out, status
36
+	return out
38 37
 }
39 38
 
40 39
 func (s *DockerCLINetmodeSuite) TestNetHostnameWithNetHost(c *testing.T) {
... ...
@@ -53,48 +52,48 @@ func (s *DockerCLINetmodeSuite) TestNetHostname(c *testing.T) {
53 53
 	assert.Assert(c, strings.Contains(out, stringCheckPS))
54 54
 	out = cli.DockerCmd(c, "run", "-h=name", "--net=none", "busybox", "ps").Stdout()
55 55
 	assert.Assert(c, strings.Contains(out, stringCheckPS))
56
-	out, _ = dockerCmdWithFail(c, "run", "-h=name", "--net=container:other", "busybox", "ps")
56
+	out = dockerCmdWithFail(c, "run", "-h=name", "--net=container:other", "busybox", "ps")
57 57
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkHostname.Error()))
58
-	out, _ = dockerCmdWithFail(c, "run", "--net=container", "busybox", "ps")
58
+	out = dockerCmdWithFail(c, "run", "--net=container", "busybox", "ps")
59 59
 	assert.Assert(c, strings.Contains(out, "invalid container format container:<name|id>"))
60
-	out, _ = dockerCmdWithFail(c, "run", "--net=weird", "busybox", "ps")
60
+	out = dockerCmdWithFail(c, "run", "--net=weird", "busybox", "ps")
61 61
 	assert.Assert(c, strings.Contains(strings.ToLower(out), "not found"))
62 62
 }
63 63
 
64 64
 func (s *DockerCLINetmodeSuite) TestConflictContainerNetworkAndLinks(c *testing.T) {
65 65
 	testRequires(c, DaemonIsLinux)
66 66
 
67
-	out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps")
67
+	out := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps")
68 68
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndLinks.Error()))
69 69
 }
70 70
 
71 71
 func (s *DockerCLINetmodeSuite) TestConflictContainerNetworkHostAndLinks(c *testing.T) {
72 72
 	testRequires(c, DaemonIsLinux, NotUserNamespace)
73 73
 
74
-	out, _ := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps")
74
+	out := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps")
75 75
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error()))
76 76
 }
77 77
 
78 78
 func (s *DockerCLINetmodeSuite) TestConflictNetworkModeNetHostAndOptions(c *testing.T) {
79 79
 	testRequires(c, DaemonIsLinux, NotUserNamespace)
80 80
 
81
-	out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
81
+	out := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
82 82
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error()))
83 83
 }
84 84
 
85 85
 func (s *DockerCLINetmodeSuite) TestConflictNetworkModeAndOptions(c *testing.T) {
86 86
 	testRequires(c, DaemonIsLinux)
87 87
 
88
-	out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps")
88
+	out := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps")
89 89
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkAndDNS.Error()))
90
-	out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--add-host=name:8.8.8.8", "busybox", "ps")
90
+	out = dockerCmdWithFail(c, "run", "--net=container:other", "--add-host=name:8.8.8.8", "busybox", "ps")
91 91
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkHosts.Error()))
92
-	out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
92
+	out = dockerCmdWithFail(c, "run", "--net=container:other", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
93 93
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error()))
94
-	out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-P", "busybox", "ps")
94
+	out = dockerCmdWithFail(c, "run", "--net=container:other", "-P", "busybox", "ps")
95 95
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error()))
96
-	out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-p", "8080", "busybox", "ps")
96
+	out = dockerCmdWithFail(c, "run", "--net=container:other", "-p", "8080", "busybox", "ps")
97 97
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error()))
98
-	out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--expose", "8000-9000", "busybox", "ps")
98
+	out = dockerCmdWithFail(c, "run", "--net=container:other", "--expose", "8000-9000", "busybox", "ps")
99 99
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkExposePorts.Error()))
100 100
 }
... ...
@@ -2450,7 +2450,7 @@ func (s *DockerCLIRunSuite) TestRunModeUTSHost(c *testing.T) {
2450 2450
 		c.Fatalf("UTS should be different without --uts=host %s == %s\n", hostUTS, out)
2451 2451
 	}
2452 2452
 
2453
-	out, _ = dockerCmdWithFail(c, "run", "-h=name", "--uts=host", "busybox", "ps")
2453
+	out = dockerCmdWithFail(c, "run", "-h=name", "--uts=host", "busybox", "ps")
2454 2454
 	assert.Assert(c, strings.Contains(out, runconfig.ErrConflictUTSHostname.Error()))
2455 2455
 }
2456 2456