Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -1265,6 +1265,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) {
|
| 1265 | 1265 |
c.Assert(waitRun(id), checker.IsNil) |
| 1266 | 1266 |
|
| 1267 | 1267 |
source, err := inspectMountSourceField(id, vol) |
| 1268 |
+ c.Assert(err, checker.IsNil) |
|
| 1268 | 1269 |
_, err = os.Stat(source) |
| 1269 | 1270 |
c.Assert(err, checker.IsNil) |
| 1270 | 1271 |
|
| ... | ... |
@@ -2201,6 +2202,7 @@ func (s *DockerSuite) TestContainerKillCustomStopSignal(c *check.C) {
|
| 2201 | 2201 |
defer res.Body.Close() |
| 2202 | 2202 |
|
| 2203 | 2203 |
b, err := ioutil.ReadAll(res.Body) |
| 2204 |
+ c.Assert(err, checker.IsNil) |
|
| 2204 | 2205 |
c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent, check.Commentf(string(b))) |
| 2205 | 2206 |
err = waitInspect(id, "{{.State.Running}} {{.State.Restarting}}", "false false", 30*time.Second)
|
| 2206 | 2207 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -1012,10 +1012,6 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
|
| 1012 | 1012 |
ADD foo.txt /x/` |
| 1013 | 1013 |
targetFile = "foo.txt" |
| 1014 | 1014 |
) |
| 1015 |
- var ( |
|
| 1016 |
- name = "test-link-absolute-volume" |
|
| 1017 |
- dockerfile = "" |
|
| 1018 |
- ) |
|
| 1019 | 1015 |
|
| 1020 | 1016 |
tempDir, err := ioutil.TempDir("", "test-link-absolute-volume-temp-")
|
| 1021 | 1017 |
if err != nil {
|
| ... | ... |
@@ -1023,7 +1019,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
|
| 1023 | 1023 |
} |
| 1024 | 1024 |
defer os.RemoveAll(tempDir) |
| 1025 | 1025 |
|
| 1026 |
- dockerfile = fmt.Sprintf(dockerfileTemplate, tempDir) |
|
| 1026 |
+ dockerfile := fmt.Sprintf(dockerfileTemplate, tempDir) |
|
| 1027 | 1027 |
nonExistingFile := filepath.Join(tempDir, targetFile) |
| 1028 | 1028 |
|
| 1029 | 1029 |
ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(dockerfile)) |
| ... | ... |
@@ -1040,7 +1036,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
|
| 1040 | 1040 |
c.Fatal(err) |
| 1041 | 1041 |
} |
| 1042 | 1042 |
|
| 1043 |
- buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx)) |
|
| 1043 |
+ buildImageSuccessfully(c, "test-link-absolute-volume", build.WithExternalBuildContext(ctx)) |
|
| 1044 | 1044 |
if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) {
|
| 1045 | 1045 |
c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
|
| 1046 | 1046 |
} |
| ... | ... |
@@ -46,8 +46,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
|
| 46 | 46 |
cleanedContainerID := strings.TrimSpace(out) |
| 47 | 47 |
|
| 48 | 48 |
dockerCmd(c, "pause", cleanedContainerID) |
| 49 |
- |
|
| 50 |
- out, _ = dockerCmd(c, "commit", cleanedContainerID) |
|
| 49 |
+ dockerCmd(c, "commit", cleanedContainerID) |
|
| 51 | 50 |
|
| 52 | 51 |
out = inspectField(c, cleanedContainerID, "State.Paused") |
| 53 | 52 |
// commit should not unpause a paused container |
| ... | ... |
@@ -78,6 +78,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
|
| 78 | 78 |
c.Assert(out, checker.Contains, fake) |
| 79 | 79 |
|
| 80 | 80 |
out, err = d.Cmd("config", "rm", id)
|
| 81 |
+ c.Assert(err, checker.IsNil) |
|
| 81 | 82 |
c.Assert(out, checker.Contains, id) |
| 82 | 83 |
|
| 83 | 84 |
// Fake one will remain |
| ... | ... |
@@ -93,6 +94,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
|
| 93 | 93 |
// - Full Name |
| 94 | 94 |
// - Partial ID (prefix) |
| 95 | 95 |
out, err = d.Cmd("config", "rm", id[:5])
|
| 96 |
+ c.Assert(err, checker.Not(checker.IsNil)) |
|
| 96 | 97 |
c.Assert(out, checker.Not(checker.Contains), id) |
| 97 | 98 |
out, err = d.Cmd("config", "ls")
|
| 98 | 99 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -101,6 +103,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
|
| 101 | 101 |
|
| 102 | 102 |
// Remove based on ID prefix of the fake one should succeed |
| 103 | 103 |
out, err = d.Cmd("config", "rm", fake[:5])
|
| 104 |
+ c.Assert(err, checker.IsNil) |
|
| 104 | 105 |
c.Assert(out, checker.Contains, fake[:5]) |
| 105 | 106 |
out, err = d.Cmd("config", "ls")
|
| 106 | 107 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -423,6 +423,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
|
| 423 | 423 |
|
| 424 | 424 |
expected := readContainerFile(c, containerID, "resolv.conf") |
| 425 | 425 |
actual, err := ioutil.ReadFile(outDir + "/resolv.conf") |
| 426 |
+ c.Assert(err, checker.IsNil) |
|
| 426 | 427 |
|
| 427 | 428 |
// Expected copied file to be duplicate of the container resolvconf |
| 428 | 429 |
c.Assert(bytes.Equal(actual, expected), checker.True) |
| ... | ... |
@@ -432,6 +433,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
|
| 432 | 432 |
|
| 433 | 433 |
expected = readContainerFile(c, containerID, "hosts") |
| 434 | 434 |
actual, err = ioutil.ReadFile(outDir + "/hosts") |
| 435 |
+ c.Assert(err, checker.IsNil) |
|
| 435 | 436 |
|
| 436 | 437 |
// Expected copied file to be duplicate of the container hosts |
| 437 | 438 |
c.Assert(bytes.Equal(actual, expected), checker.True) |
| ... | ... |
@@ -639,6 +641,7 @@ func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
|
| 639 | 639 |
|
| 640 | 640 |
expected := []byte(cpContainerContents) |
| 641 | 641 |
actual, err := ioutil.ReadFile(expectedPath) |
| 642 |
+ c.Assert(err, checker.IsNil) |
|
| 642 | 643 |
|
| 643 | 644 |
if !bytes.Equal(actual, expected) {
|
| 644 | 645 |
c.Fatalf("Expected copied file to be duplicate of the container symbol link target")
|
| ... | ... |
@@ -448,10 +448,10 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) {
|
| 448 | 448 |
|
| 449 | 449 |
s.d.StartWithBusybox(c, "--ipv6", "--fixed-cidr-v6=2001:db8:1::/64") |
| 450 | 450 |
|
| 451 |
- out, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
|
|
| 451 |
+ _, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
|
|
| 452 | 452 |
c.Assert(err, checker.IsNil) |
| 453 | 453 |
|
| 454 |
- out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
|
|
| 454 |
+ out, err := s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
|
|
| 455 | 455 |
c.Assert(err, checker.IsNil) |
| 456 | 456 |
c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:1::aabb:ccdd:eeff") |
| 457 | 457 |
} |
| ... | ... |
@@ -742,6 +742,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
|
| 742 | 742 |
defer d.Cmd("stop", "bb")
|
| 743 | 743 |
|
| 744 | 744 |
out, err = d.Cmd("exec", "bb", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
| 745 |
+ c.Assert(err, check.IsNil) |
|
| 745 | 746 |
c.Assert(out, checker.Equals, "10.2.2.0\n") |
| 746 | 747 |
|
| 747 | 748 |
out, err = d.Cmd("run", "--rm", "busybox", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
|
| ... | ... |
@@ -1944,11 +1945,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
| 1944 | 1944 |
test2ID := strings.TrimSpace(out) |
| 1945 | 1945 |
|
| 1946 | 1946 |
out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top")
|
| 1947 |
+ c.Assert(err, check.IsNil) |
|
| 1947 | 1948 |
test3ID := strings.TrimSpace(out) |
| 1948 | 1949 |
|
| 1949 | 1950 |
s.d.Restart(c) |
| 1950 | 1951 |
|
| 1951 |
- out, err = s.d.Cmd("create", "--name=test", "busybox")
|
|
| 1952 |
+ _, err = s.d.Cmd("create", "--name=test", "busybox")
|
|
| 1952 | 1953 |
c.Assert(err, check.NotNil, check.Commentf("expected error trying to create container with duplicate name"))
|
| 1953 | 1954 |
// this one is no longer needed, removing simplifies the remainder of the test |
| 1954 | 1955 |
out, err = s.d.Cmd("rm", "-f", "test")
|
| ... | ... |
@@ -2615,6 +2617,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) |
| 2615 | 2615 |
c.Assert(err, checker.IsNil, check.Commentf("run top2: %v", out))
|
| 2616 | 2616 |
|
| 2617 | 2617 |
out, err = s.d.Cmd("ps")
|
| 2618 |
+ c.Assert(err, checker.IsNil) |
|
| 2618 | 2619 |
c.Assert(out, checker.Contains, "top1", check.Commentf("top1 should be running"))
|
| 2619 | 2620 |
c.Assert(out, checker.Contains, "top2", check.Commentf("top2 should be running"))
|
| 2620 | 2621 |
|
| ... | ... |
@@ -2639,11 +2642,11 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| 2639 | 2639 |
// captured, so `.State.Error` is empty. |
| 2640 | 2640 |
// See the discussion on https://github.com/docker/docker/pull/30227#issuecomment-274161426, |
| 2641 | 2641 |
// and https://github.com/docker/docker/pull/26061#r78054578 for more information. |
| 2642 |
- out, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto")
|
|
| 2642 |
+ _, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto")
|
|
| 2643 | 2643 |
c.Assert(err, checker.NotNil) |
| 2644 | 2644 |
|
| 2645 | 2645 |
// Check that those values were saved on disk |
| 2646 |
- out, err = s.d.Cmd("inspect", "-f", "{{.State.ExitCode}}", containerName)
|
|
| 2646 |
+ out, err := s.d.Cmd("inspect", "-f", "{{.State.ExitCode}}", containerName)
|
|
| 2647 | 2647 |
out = strings.TrimSpace(out) |
| 2648 | 2648 |
c.Assert(err, checker.IsNil) |
| 2649 | 2649 |
c.Assert(out, checker.Equals, "127") |
| ... | ... |
@@ -81,7 +81,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 81 | 81 |
dockerCmd(c, "rm", "-f", name) |
| 82 | 82 |
|
| 83 | 83 |
// Disable the check from the CLI |
| 84 |
- out, _ = dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName) |
|
| 84 |
+ dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName) |
|
| 85 | 85 |
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "noh")
|
| 86 | 86 |
c.Check(out, checker.Equals, "[NONE]\n") |
| 87 | 87 |
dockerCmd(c, "rm", "noh") |
| ... | ... |
@@ -181,14 +181,14 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
| 181 | 181 |
// TODO Windows TP5 - Figure out why this test is so flakey. Disabled for now. |
| 182 | 182 |
testRequires(c, DaemonIsLinux) |
| 183 | 183 |
name := "testlogssincefuturefollow" |
| 184 |
- out, _ := dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do echo log$i; sleep 1; done`) |
|
| 184 |
+ dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do echo log$i; sleep 1; done`) |
|
| 185 | 185 |
|
| 186 | 186 |
// Extract one timestamp from the log file to give us a starting point for |
| 187 | 187 |
// our `--since` argument. Because the log producer runs in the background, |
| 188 | 188 |
// we need to check repeatedly for some output to be produced. |
| 189 | 189 |
var timestamp string |
| 190 | 190 |
for i := 0; i != 100 && timestamp == ""; i++ {
|
| 191 |
- if out, _ = dockerCmd(c, "logs", "-t", name); out == "" {
|
|
| 191 |
+ if out, _ := dockerCmd(c, "logs", "-t", name); out == "" {
|
|
| 192 | 192 |
time.Sleep(time.Millisecond * 100) // Retry |
| 193 | 193 |
} else {
|
| 194 | 194 |
timestamp = strings.Split(strings.Split(out, "\n")[0], " ")[0] |
| ... | ... |
@@ -200,7 +200,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
| 200 | 200 |
c.Assert(err, check.IsNil) |
| 201 | 201 |
|
| 202 | 202 |
since := t.Unix() + 2 |
| 203 |
- out, _ = dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
|
|
| 203 |
+ out, _ := dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
|
|
| 204 | 204 |
c.Assert(out, checker.Not(checker.HasLen), 0, check.Commentf("cannot read from empty log"))
|
| 205 | 205 |
lines := strings.Split(strings.TrimSpace(out), "\n") |
| 206 | 206 |
for _, v := range lines {
|
| ... | ... |
@@ -348,7 +348,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
|
| 348 | 348 |
out, _ = dockerCmd(c, "network", "ls", "-f", "type=custom", "-f", "type=builtin") |
| 349 | 349 |
assertNwList(c, out, []string{"bridge", "dev", "host", "none"})
|
| 350 | 350 |
|
| 351 |
- out, _ = dockerCmd(c, "network", "create", "--label", testLabel+"="+testValue, testNet) |
|
| 351 |
+ dockerCmd(c, "network", "create", "--label", testLabel+"="+testValue, testNet) |
|
| 352 | 352 |
assertNwIsAvailable(c, testNet) |
| 353 | 353 |
|
| 354 | 354 |
out, _ = dockerCmd(c, "network", "ls", "-f", "label="+testLabel) |
| ... | ... |
@@ -880,8 +880,6 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 880 | 880 |
out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "busybox", "top") |
| 881 | 881 |
cid2 := strings.TrimSpace(out) |
| 882 | 882 |
|
| 883 |
- hosts2 := readContainerFileWithExec(c, cid2, hostsFile) |
|
| 884 |
- |
|
| 885 | 883 |
// verify first container etc/hosts file has not changed |
| 886 | 884 |
hosts1post := readContainerFileWithExec(c, cid1, hostsFile) |
| 887 | 885 |
c.Assert(string(hosts1), checker.Equals, string(hosts1post), |
| ... | ... |
@@ -894,7 +892,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 894 | 894 |
|
| 895 | 895 |
dockerCmd(c, "network", "connect", cstmBridgeNw1, cid2) |
| 896 | 896 |
|
| 897 |
- hosts2 = readContainerFileWithExec(c, cid2, hostsFile) |
|
| 897 |
+ hosts2 := readContainerFileWithExec(c, cid2, hostsFile) |
|
| 898 | 898 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 899 | 899 |
c.Assert(string(hosts1), checker.Equals, string(hosts1post), |
| 900 | 900 |
check.Commentf("Unexpected %s change on container connect", hostsFile))
|
| ... | ... |
@@ -62,10 +62,10 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
|
| 62 | 62 |
func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) {
|
| 63 | 63 |
pNameWithTag := ps.getPluginRepoWithTag() |
| 64 | 64 |
|
| 65 |
- out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
|
|
| 65 |
+ _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
|
|
| 66 | 66 |
c.Assert(err, checker.IsNil) |
| 67 | 67 |
|
| 68 |
- out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
|
| 68 |
+ out, _, _ := dockerCmdWithError("plugin", "remove", pNameWithTag)
|
|
| 69 | 69 |
c.Assert(out, checker.Contains, "is enabled") |
| 70 | 70 |
|
| 71 | 71 |
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
|
| ... | ... |
@@ -82,7 +82,7 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
|
| 82 | 82 |
_, _, err = dockerCmdWithError("volume", "create", "-d", pNameWithTag, "--name", "testvol1")
|
| 83 | 83 |
c.Assert(err, checker.IsNil) |
| 84 | 84 |
|
| 85 |
- out, _, err := dockerCmdWithError("plugin", "disable", pNameWithTag)
|
|
| 85 |
+ out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
|
|
| 86 | 86 |
c.Assert(out, checker.Contains, "in use") |
| 87 | 87 |
|
| 88 | 88 |
_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
|
| ... | ... |
@@ -98,21 +98,21 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
|
| 98 | 98 |
|
| 99 | 99 |
func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
|
| 100 | 100 |
testRequires(c, DaemonIsLinux, IsAmd64, Network) |
| 101 |
- out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
|
|
| 101 |
+ _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
|
|
| 102 | 102 |
c.Assert(err, checker.IsNil) |
| 103 | 103 |
|
| 104 |
- out, _, err = dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
|
|
| 104 |
+ out, _, err := dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
|
|
| 105 | 105 |
c.Assert(err, checker.IsNil) |
| 106 | 106 |
|
| 107 | 107 |
nID := strings.TrimSpace(out) |
| 108 | 108 |
|
| 109 |
- out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
|
| 109 |
+ out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
|
| 110 | 110 |
c.Assert(out, checker.Contains, "is in use") |
| 111 | 111 |
|
| 112 | 112 |
_, _, err = dockerCmdWithError("network", "rm", nID)
|
| 113 | 113 |
c.Assert(err, checker.IsNil) |
| 114 | 114 |
|
| 115 |
- out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
|
| 115 |
+ out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
|
| 116 | 116 |
c.Assert(out, checker.Contains, "is enabled") |
| 117 | 117 |
|
| 118 | 118 |
_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
|
| ... | ... |
@@ -400,7 +400,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
|
| 400 | 400 |
c.Assert(out, checker.Contains, "false") |
| 401 | 401 |
|
| 402 | 402 |
// Remove |
| 403 |
- out, _, err = dockerCmdWithError("plugin", "remove", id[:5])
|
|
| 403 |
+ _, _, err = dockerCmdWithError("plugin", "remove", id[:5])
|
|
| 404 | 404 |
c.Assert(err, checker.IsNil) |
| 405 | 405 |
// List returns none |
| 406 | 406 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| ... | ... |
@@ -792,19 +792,14 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| 792 | 792 |
} |
| 793 | 793 |
|
| 794 | 794 |
func (s *DockerSuite) TestPsByOrder(c *check.C) {
|
| 795 |
- name1 := "xyz-abc" |
|
| 796 |
- out := runSleepingContainer(c, "--name", name1) |
|
| 795 |
+ out := runSleepingContainer(c, "--name", "xyz-abc") |
|
| 797 | 796 |
container1 := strings.TrimSpace(out) |
| 798 | 797 |
|
| 799 |
- name2 := "xyz-123" |
|
| 800 |
- out = runSleepingContainer(c, "--name", name2) |
|
| 798 |
+ out = runSleepingContainer(c, "--name", "xyz-123") |
|
| 801 | 799 |
container2 := strings.TrimSpace(out) |
| 802 | 800 |
|
| 803 |
- name3 := "789-abc" |
|
| 804 |
- out = runSleepingContainer(c, "--name", name3) |
|
| 805 |
- |
|
| 806 |
- name4 := "789-123" |
|
| 807 |
- out = runSleepingContainer(c, "--name", name4) |
|
| 801 |
+ runSleepingContainer(c, "--name", "789-abc") |
|
| 802 |
+ runSleepingContainer(c, "--name", "789-123") |
|
| 808 | 803 |
|
| 809 | 804 |
// Run multiple time should have the same result |
| 810 | 805 |
out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined() |
| ... | ... |
@@ -224,6 +224,7 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) {
|
| 224 | 224 |
c.Assert(err, check.IsNil) |
| 225 | 225 |
|
| 226 | 226 |
err = waitInspect("second", "{{.State.Status}}", "running", 5*time.Second)
|
| 227 |
+ c.Assert(err, check.IsNil) |
|
| 227 | 228 |
|
| 228 | 229 |
// ping to first and its alias foo must still succeed |
| 229 | 230 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -623,6 +623,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
|
| 623 | 623 |
// Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...) |
| 624 | 624 |
testRequires(c, DaemonIsLinux) |
| 625 | 625 |
workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink")
|
| 626 |
+ c.Assert(err, checker.IsNil) |
|
| 626 | 627 |
image := "docker-test-createvolumewithsymlink" |
| 627 | 628 |
|
| 628 | 629 |
buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-") |
| ... | ... |
@@ -39,6 +39,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
|
| 39 | 39 |
c.Assert(out, checker.Contains, fake) |
| 40 | 40 |
|
| 41 | 41 |
out, err = d.Cmd("secret", "rm", id)
|
| 42 |
+ c.Assert(err, checker.IsNil) |
|
| 42 | 43 |
c.Assert(out, checker.Contains, id) |
| 43 | 44 |
|
| 44 | 45 |
// Fake one will remain |
| ... | ... |
@@ -54,6 +55,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
|
| 54 | 54 |
// - Full Name |
| 55 | 55 |
// - Partial ID (prefix) |
| 56 | 56 |
out, err = d.Cmd("secret", "rm", id[:5])
|
| 57 |
+ c.Assert(err, checker.Not(checker.IsNil)) |
|
| 57 | 58 |
c.Assert(out, checker.Not(checker.Contains), id) |
| 58 | 59 |
out, err = d.Cmd("secret", "ls")
|
| 59 | 60 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -62,6 +64,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
|
| 62 | 62 |
|
| 63 | 63 |
// Remove based on ID prefix of the fake one should succeed |
| 64 | 64 |
out, err = d.Cmd("secret", "rm", fake[:5])
|
| 65 |
+ c.Assert(err, checker.IsNil) |
|
| 65 | 66 |
c.Assert(out, checker.Contains, fake[:5]) |
| 66 | 67 |
out, err = d.Cmd("secret", "ls")
|
| 67 | 68 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -21,16 +21,16 @@ func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
|
| 21 | 21 |
service2Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service2Name, "--mode=global", defaultSleepImage}, sleepCommandForDaemonPlatform()...)
|
| 22 | 22 |
|
| 23 | 23 |
// Create services |
| 24 |
- out, err := d.Cmd(service1Args...) |
|
| 24 |
+ _, err := d.Cmd(service1Args...) |
|
| 25 | 25 |
c.Assert(err, checker.IsNil) |
| 26 | 26 |
|
| 27 |
- out, err = d.Cmd(service2Args...) |
|
| 27 |
+ _, err = d.Cmd(service2Args...) |
|
| 28 | 28 |
c.Assert(err, checker.IsNil) |
| 29 | 29 |
|
| 30 |
- out, err = d.Cmd("service", "scale", "TestService1=2")
|
|
| 30 |
+ _, err = d.Cmd("service", "scale", "TestService1=2")
|
|
| 31 | 31 |
c.Assert(err, checker.IsNil) |
| 32 | 32 |
|
| 33 |
- out, err = d.Cmd("service", "scale", "TestService1=foobar")
|
|
| 33 |
+ out, err := d.Cmd("service", "scale", "TestService1=foobar")
|
|
| 34 | 34 |
c.Assert(err, checker.NotNil) |
| 35 | 35 |
|
| 36 | 36 |
str := fmt.Sprintf("%s: invalid replicas value %s", service1Name, "foobar")
|
| ... | ... |
@@ -279,13 +279,13 @@ func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) {
|
| 279 | 279 |
c.Assert(err, checker.IsNil) |
| 280 | 280 |
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") |
| 281 | 281 |
|
| 282 |
- out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
|
| 282 |
+ _, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
|
| 283 | 283 |
c.Assert(err, checker.IsNil) |
| 284 | 284 |
|
| 285 |
- out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
|
| 285 |
+ _, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
|
| 286 | 286 |
c.Assert(err, checker.IsNil) |
| 287 | 287 |
|
| 288 |
- out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
|
|
| 288 |
+ _, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
|
|
| 289 | 289 |
c.Assert(err, checker.NotNil) |
| 290 | 290 |
|
| 291 | 291 |
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.EndpointSpec.Ports }}", name)
|
| ... | ... |
@@ -841,14 +841,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
|
| 841 | 841 |
|
| 842 | 842 |
// Without --tty |
| 843 | 843 |
expectedOutput := "none" |
| 844 |
- out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", ttyCheck)
|
|
| 844 |
+ _, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", ttyCheck)
|
|
| 845 | 845 |
c.Assert(err, checker.IsNil) |
| 846 | 846 |
|
| 847 | 847 |
// Make sure task has been deployed. |
| 848 | 848 |
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) |
| 849 | 849 |
|
| 850 | 850 |
// We need to get the container id. |
| 851 |
- out, err = d.Cmd("ps", "-q", "--no-trunc")
|
|
| 851 |
+ out, err := d.Cmd("ps", "-q", "--no-trunc")
|
|
| 852 | 852 |
c.Assert(err, checker.IsNil) |
| 853 | 853 |
id := strings.TrimSpace(out) |
| 854 | 854 |
|
| ... | ... |
@@ -857,14 +857,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
|
| 857 | 857 |
c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
| 858 | 858 |
|
| 859 | 859 |
// Remove service |
| 860 |
- out, err = d.Cmd("service", "rm", name)
|
|
| 860 |
+ _, err = d.Cmd("service", "rm", name)
|
|
| 861 | 861 |
c.Assert(err, checker.IsNil) |
| 862 | 862 |
// Make sure container has been destroyed. |
| 863 | 863 |
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 0) |
| 864 | 864 |
|
| 865 | 865 |
// With --tty |
| 866 | 866 |
expectedOutput = "TTY" |
| 867 |
- out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--tty", "busybox", "sh", "-c", ttyCheck)
|
|
| 867 |
+ _, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--tty", "busybox", "sh", "-c", ttyCheck)
|
|
| 868 | 868 |
c.Assert(err, checker.IsNil) |
| 869 | 869 |
|
| 870 | 870 |
// Make sure task has been deployed. |
| ... | ... |
@@ -1069,6 +1069,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) {
|
| 1069 | 1069 |
c.Assert(unlockKey, checker.Not(checker.Equals), "") |
| 1070 | 1070 |
|
| 1071 | 1071 |
outs, err = d.Cmd("swarm", "unlock-key", "-q")
|
| 1072 |
+ c.Assert(err, checker.IsNil) |
|
| 1072 | 1073 |
c.Assert(outs, checker.Equals, unlockKey+"\n") |
| 1073 | 1074 |
|
| 1074 | 1075 |
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
| ... | ... |
@@ -1168,6 +1169,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
|
| 1168 | 1168 |
c.Assert(unlockKey, checker.Not(checker.Equals), "") |
| 1169 | 1169 |
|
| 1170 | 1170 |
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
|
| 1171 |
+ c.Assert(err, checker.IsNil) |
|
| 1171 | 1172 |
c.Assert(outs, checker.Equals, unlockKey+"\n") |
| 1172 | 1173 |
|
| 1173 | 1174 |
// The ones that got the cluster update should be set to locked |
| ... | ... |
@@ -1234,6 +1236,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
|
| 1234 | 1234 |
c.Assert(unlockKey, checker.Not(checker.Equals), "") |
| 1235 | 1235 |
|
| 1236 | 1236 |
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
|
| 1237 |
+ c.Assert(err, checker.IsNil) |
|
| 1237 | 1238 |
c.Assert(outs, checker.Equals, unlockKey+"\n") |
| 1238 | 1239 |
|
| 1239 | 1240 |
// joined workers start off unlocked |
| ... | ... |
@@ -1306,6 +1309,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
|
| 1306 | 1306 |
c.Assert(unlockKey, checker.Not(checker.Equals), "") |
| 1307 | 1307 |
|
| 1308 | 1308 |
outs, err = d.Cmd("swarm", "unlock-key", "-q")
|
| 1309 |
+ c.Assert(err, checker.IsNil) |
|
| 1309 | 1310 |
c.Assert(outs, checker.Equals, unlockKey+"\n") |
| 1310 | 1311 |
|
| 1311 | 1312 |
// Rotate multiple times |
| ... | ... |
@@ -1390,6 +1394,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
|
| 1390 | 1390 |
c.Assert(unlockKey, checker.Not(checker.Equals), "") |
| 1391 | 1391 |
|
| 1392 | 1392 |
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
|
| 1393 |
+ c.Assert(err, checker.IsNil) |
|
| 1393 | 1394 |
c.Assert(outs, checker.Equals, unlockKey+"\n") |
| 1394 | 1395 |
|
| 1395 | 1396 |
// Rotate multiple times |
| ... | ... |
@@ -26,6 +26,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
|
| 26 | 26 |
|
| 27 | 27 |
// create a dummy volume to trigger lazy loading of the plugin |
| 28 | 28 |
out, err = d.Cmd("volume", "create", "-d", "customvolumedriver", "hello")
|
| 29 |
+ c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 29 | 30 |
|
| 30 | 31 |
// TODO(aaronl): It will take about 15 seconds for swarm to realize the |
| 31 | 32 |
// plugin was loaded. Switching the test over to plugin v2 would avoid |
| ... | ... |
@@ -324,7 +324,7 @@ func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) {
|
| 324 | 324 |
c.Assert(err, checker.NotNil) |
| 325 | 325 |
c.Assert(out, checker.Contains, "Conflicting options: CPU Quota cannot be updated as NanoCPUs has already been set") |
| 326 | 326 |
|
| 327 |
- out, _ = dockerCmd(c, "update", "--cpus", "0.8", "top") |
|
| 327 |
+ dockerCmd(c, "update", "--cpus", "0.8", "top") |
|
| 328 | 328 |
inspect, err = clt.ContainerInspect(context.Background(), "top") |
| 329 | 329 |
c.Assert(err, checker.IsNil) |
| 330 | 330 |
c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(800000000)) |
| ... | ... |
@@ -61,12 +61,12 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
|
| 61 | 61 |
c.Assert(err, checker.IsNil, check.Commentf("Could not inspect running container: out: %q", pid))
|
| 62 | 62 |
// check the uid and gid maps for the PID to ensure root is remapped |
| 63 | 63 |
// (cmd = cat /proc/<pid>/uid_map | grep -E '0\s+9999\s+1') |
| 64 |
- out, err = RunCommandPipelineWithOutput( |
|
| 64 |
+ _, err = RunCommandPipelineWithOutput( |
|
| 65 | 65 |
exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/uid_map"),
|
| 66 | 66 |
exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", uid)))
|
| 67 | 67 |
c.Assert(err, check.IsNil) |
| 68 | 68 |
|
| 69 |
- out, err = RunCommandPipelineWithOutput( |
|
| 69 |
+ _, err = RunCommandPipelineWithOutput( |
|
| 70 | 70 |
exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/gid_map"),
|
| 71 | 71 |
exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", gid)))
|
| 72 | 72 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -300,10 +300,10 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) {
|
| 300 | 300 |
testLabel := "foo" |
| 301 | 301 |
testValue := "bar" |
| 302 | 302 |
|
| 303 |
- out, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol)
|
|
| 303 |
+ _, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol)
|
|
| 304 | 304 |
c.Assert(err, check.IsNil) |
| 305 | 305 |
|
| 306 |
- out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
|
|
| 306 |
+ out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
|
|
| 307 | 307 |
c.Assert(strings.TrimSpace(out), check.Equals, testValue) |
| 308 | 308 |
} |
| 309 | 309 |
|
| ... | ... |
@@ -325,25 +325,25 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
|
| 325 | 325 |
args = append(args, "--label", k+"="+v) |
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 |
- out, _, err := dockerCmdWithError(args...) |
|
| 328 |
+ _, _, err := dockerCmdWithError(args...) |
|
| 329 | 329 |
c.Assert(err, check.IsNil) |
| 330 | 330 |
|
| 331 | 331 |
for k, v := range testLabels {
|
| 332 |
- out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
|
|
| 332 |
+ out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
|
|
| 333 | 333 |
c.Assert(strings.TrimSpace(out), check.Equals, v) |
| 334 | 334 |
} |
| 335 | 335 |
} |
| 336 | 336 |
|
| 337 | 337 |
func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
|
| 338 | 338 |
testVol1 := "testvolcreatelabel-1" |
| 339 |
- out, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
|
|
| 339 |
+ _, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
|
|
| 340 | 340 |
c.Assert(err, check.IsNil) |
| 341 | 341 |
|
| 342 | 342 |
testVol2 := "testvolcreatelabel-2" |
| 343 |
- out, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2)
|
|
| 343 |
+ _, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2)
|
|
| 344 | 344 |
c.Assert(err, check.IsNil) |
| 345 | 345 |
|
| 346 |
- out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo") |
|
| 346 |
+ out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo") |
|
| 347 | 347 |
|
| 348 | 348 |
// filter with label=key |
| 349 | 349 |
c.Assert(out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
| ... | ... |
@@ -367,15 +367,15 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
|
| 367 | 367 |
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) {
|
| 368 | 368 |
// using default volume driver local to create volumes |
| 369 | 369 |
testVol1 := "testvol-1" |
| 370 |
- out, _, err := dockerCmdWithError("volume", "create", testVol1)
|
|
| 370 |
+ _, _, err := dockerCmdWithError("volume", "create", testVol1)
|
|
| 371 | 371 |
c.Assert(err, check.IsNil) |
| 372 | 372 |
|
| 373 | 373 |
testVol2 := "testvol-2" |
| 374 |
- out, _, err = dockerCmdWithError("volume", "create", testVol2)
|
|
| 374 |
+ _, _, err = dockerCmdWithError("volume", "create", testVol2)
|
|
| 375 | 375 |
c.Assert(err, check.IsNil) |
| 376 | 376 |
|
| 377 | 377 |
// filter with driver=local |
| 378 |
- out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=local") |
|
| 378 |
+ out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local") |
|
| 379 | 379 |
c.Assert(out, checker.Contains, "testvol-1\n", check.Commentf("expected volume 'testvol-1' in output"))
|
| 380 | 380 |
c.Assert(out, checker.Contains, "testvol-2\n", check.Commentf("expected volume 'testvol-2' in output"))
|
| 381 | 381 |
|
| ... | ... |
@@ -434,7 +434,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
|
| 434 | 434 |
c.Assert(id, checker.Equals, name) |
| 435 | 435 |
|
| 436 | 436 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 437 |
- out, e := dockerCmd(c, "create", "-v", "testvolume:"+prefix+slash+"foo", "busybox") |
|
| 437 |
+ out, _ = dockerCmd(c, "create", "-v", "testvolume:"+prefix+slash+"foo", "busybox") |
|
| 438 | 438 |
cid := strings.TrimSpace(out) |
| 439 | 439 |
|
| 440 | 440 |
_, _, err := dockerCmdWithError("volume", "rm", "-f", name)
|
| ... | ... |
@@ -454,7 +454,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
|
| 454 | 454 |
c.Assert(out, checker.Contains, name) |
| 455 | 455 |
|
| 456 | 456 |
// Verify removing the volume after the container is removed works |
| 457 |
- _, e = dockerCmd(c, "rm", cid) |
|
| 457 |
+ _, e := dockerCmd(c, "rm", cid) |
|
| 458 | 458 |
c.Assert(e, check.Equals, 0) |
| 459 | 459 |
|
| 460 | 460 |
_, e = dockerCmd(c, "volume", "rm", "-f", name) |