From 580d3677c80398fb0fffb12a6a7db784ec1a135d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 27 Nov 2019 15:36:45 +0100 Subject: [PATCH] integration-cli: normalize comment formatting Signed-off-by: Sebastiaan van Stijn --- integration-cli/docker_api_build_test.go | 15 +++------ integration-cli/docker_api_containers_test.go | 2 +- integration-cli/docker_api_images_test.go | 2 +- .../docker_api_swarm_service_test.go | 10 +++--- integration-cli/docker_cli_by_digest_test.go | 5 ++- integration-cli/docker_cli_commit_test.go | 2 +- integration-cli/docker_cli_daemon_test.go | 14 ++++---- integration-cli/docker_cli_events_test.go | 8 ++--- .../docker_cli_events_unix_test.go | 2 +- integration-cli/docker_cli_images_test.go | 4 +-- integration-cli/docker_cli_inspect_test.go | 29 ++++++++--------- integration-cli/docker_cli_ps_test.go | 2 +- integration-cli/docker_cli_run_test.go | 32 +++++++++---------- .../docker_cli_save_load_unix_test.go | 2 +- integration-cli/docker_cli_search_test.go | 6 ++-- 15 files changed, 64 insertions(+), 71 deletions(-) diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index f1acaed9d7..4226fae495 100644 --- a/integration-cli/docker_api_build_test.go +++ b/integration-cli/docker_api_build_test.go @@ -210,26 +210,21 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) { Name: "Dockerfile", Size: int64(len(dockerfile)), }) - //failed to write tar file header - assert.NilError(c, err) + assert.NilError(c, err, "failed to write tar file header") _, err = tw.Write(dockerfile) - // failed to write Dockerfile in tar file content - assert.NilError(c, err) + assert.NilError(c, err, "failed to write Dockerfile in tar file content") err = tw.WriteHeader(&tar.Header{ Name: "dir/./file", Size: int64(len(fileContents)), }) - //failed to write tar file header - assert.NilError(c, err) + assert.NilError(c, err, "failed to write tar file header") _, err = tw.Write(fileContents) - // failed to write file contents in tar file content - assert.NilError(c, err) + assert.NilError(c, err, "failed to write file contents in tar file content") - // failed to close tar archive - assert.NilError(c, tw.Close()) + assert.NilError(c, tw.Close(), "failed to close tar archive") res, body, err := request.Post("/build", request.RawContent(ioutil.NopCloser(buffer)), request.ContentType("application/x-tar")) assert.NilError(c, err) diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 34edd47588..14ce5127c0 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -689,7 +689,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) { body.Close() } -//Issue 14230. daemon should return 500 for invalid port syntax +// Issue 14230. daemon should return 500 for invalid port syntax func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) { config := `{ "Image": "busybox", diff --git a/integration-cli/docker_api_images_test.go b/integration-cli/docker_api_images_test.go index 2367b59a74..495893277f 100644 --- a/integration-cli/docker_api_images_test.go +++ b/integration-cli/docker_api_images_test.go @@ -44,7 +44,7 @@ func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) { return images } - //incorrect number of matches returned + // incorrect number of matches returned images := getImages("utest*/*") assert.Equal(c, len(images[0].RepoTags), 2) diff --git a/integration-cli/docker_api_swarm_service_test.go b/integration-cli/docker_api_swarm_service_test.go index ebf12fb8b6..81aa1fe9b4 100644 --- a/integration-cli/docker_api_swarm_service_test.go +++ b/integration-cli/docker_api_swarm_service_test.go @@ -356,7 +356,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) { node := daemons[0].GetNode(c, task.NodeID) assert.Equal(c, node.Spec.Role, swarm.NodeRoleWorker) } - //remove service + // remove service daemons[0].RemoveService(c, id) // create service @@ -370,7 +370,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) { node := daemons[0].GetNode(c, task.NodeID) assert.Equal(c, node.Spec.Role, swarm.NodeRoleManager) } - //remove service + // remove service daemons[0].RemoveService(c, id) // create service @@ -423,7 +423,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) { for _, task := range tasks { assert.Assert(c, task.NodeID == nodes[0].ID) } - //remove service + // remove service daemons[0].RemoveService(c, id) // create service @@ -436,7 +436,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) { for _, task := range tasks { assert.Assert(c, task.NodeID != nodes[0].ID) } - //remove service + // remove service daemons[0].RemoveService(c, id) constraints = []string{"node.labels.security==medium"} @@ -450,7 +450,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) { for _, task := range tasks { assert.Assert(c, task.NodeID == "") } - //remove service + // remove service daemons[0].RemoveService(c, id) // multiple constraints diff --git a/integration-cli/docker_cli_by_digest_test.go b/integration-cli/docker_cli_by_digest_test.go index 5c0f57b874..a6a89a79c8 100644 --- a/integration-cli/docker_cli_by_digest_test.go +++ b/integration-cli/docker_cli_by_digest_test.go @@ -175,7 +175,7 @@ func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *testing.T) { // try to inspect again - it should error this time _, err = inspectFieldWithError(imageReference, "Id") - //unexpected nil err trying to inspect what should be a non-existent image + // unexpected nil err trying to inspect what should be a non-existent image assert.ErrorContains(c, err, "No such object") } @@ -255,8 +255,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out) // setup image2 digest2, err := setupImageWithTag(c, "tag2") - //error setting up image - assert.NilError(c, err) + assert.NilError(c, err, "error setting up image") imageReference2 := fmt.Sprintf("%s@%s", repoName, digest2) c.Logf("imageReference2 = %s", imageReference2) diff --git a/integration-cli/docker_cli_commit_test.go b/integration-cli/docker_cli_commit_test.go index 126e30a627..c5b8f43868 100644 --- a/integration-cli/docker_cli_commit_test.go +++ b/integration-cli/docker_cli_commit_test.go @@ -38,7 +38,7 @@ func (s *DockerSuite) TestCommitWithoutPause(c *testing.T) { dockerCmd(c, "inspect", cleanedImageID) } -//test commit a paused container should not unpause it after commit +// TestCommitPausedContainer tests that a paused container is not unpaused after being committed func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-i", "-d", "busybox") diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index fa2b89bdda..08aa71ee2e 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -213,7 +213,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) { s.d.Start(c) oldBasesizeBytes := getBaseDeviceSize(c, s.d) - var newBasesizeBytes int64 = 1073741824 //1GB in bytes + var newBasesizeBytes int64 = 1073741824 // 1GB in bytes if newBasesizeBytes < oldBasesizeBytes { err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes)) @@ -234,7 +234,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T) oldBasesizeBytes := getBaseDeviceSize(c, s.d) - var newBasesizeBytes int64 = 53687091200 //50GB in bytes + var newBasesizeBytes int64 = 53687091200 // 50GB in bytes if newBasesizeBytes < oldBasesizeBytes { c.Skip(fmt.Sprintf("New base device size (%v) must be greater than (%s)", units.HumanSize(float64(newBasesizeBytes)), units.HumanSize(float64(oldBasesizeBytes)))) @@ -572,16 +572,16 @@ func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *testing.T) { // Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means // to get a daemon init failure; no other tests for -b/--bip conflict are therefore required func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *testing.T) { - //attempt to start daemon with incorrect flags (we know -b and --bip conflict) + // attempt to start daemon with incorrect flags (we know -b and --bip conflict) if err := s.d.StartWithError("--bridge", "nosuchbridge", "--bip", "1.1.1.1"); err != nil { - //verify we got the right error + // verify we got the right error if !strings.Contains(err.Error(), "daemon exited") { c.Fatalf("Expected daemon not to start, got %v", err) } // look in the log and make sure we got the message that daemon is shutting down icmd.RunCommand("grep", "failed to start daemon", s.d.LogFileName()).Assert(c, icmd.Success) } else { - //if we didn't get an error and the daemon is running, this is a failure + // if we didn't get an error and the daemon is running, this is a failure c.Fatal("Conflicting options should cause the daemon to error out with a failure") } } @@ -697,7 +697,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithBridgeIPChange(c *testing.T) { s.d.Start(c, "--bip", bridgeIP) - //check if the iptables contains new bridgeIP MASQUERADE rule + // check if the iptables contains new bridgeIP MASQUERADE rule ipTablesSearchString := bridgeIPNet.String() icmd.RunCommand("iptables", "-t", "nat", "-nvL").Assert(c, icmd.Expected{ Out: ipTablesSearchString, @@ -1203,7 +1203,7 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *testing.T) { c.Fatalf("Error Unmarshal: %s", err) } - //replace config.Kid with the fake value + // replace config.Kid with the fake value config.Kid = "VSAJ:FUYR:X3H2:B2VZ:KZ6U:CJD5:K7BX:ZXHY:UZXT:P4FT:MJWG:HRJ4" // NEW Data-Struct to byte[] diff --git a/integration-cli/docker_cli_events_test.go b/integration-cli/docker_cli_events_test.go index 2034ac4ebf..02e8c0697b 100644 --- a/integration-cli/docker_cli_events_test.go +++ b/integration-cli/docker_cli_events_test.go @@ -48,7 +48,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *testing.T) { events = events[:len(events)-1] nEvents := len(events) - assert.Assert(c, nEvents >= 5) //Missing expected event + assert.Assert(c, nEvents >= 5) containerEvents := eventActionsByIDAndType(c, events, name, "container") assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out) } @@ -99,7 +99,7 @@ func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *testing.T) { events := strings.Split(out, "\n") nEvents := len(events) - assert.Assert(c, nEvents >= 3) //Missing expected event + assert.Assert(c, nEvents >= 3) matchedEvents := 0 for _, event := range events { matches := eventstestutils.ScanMap(event) @@ -124,7 +124,7 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) { events = events[:len(events)-1] nEvents := len(events) - assert.Assert(c, nEvents >= 5) //Missing expected event + assert.Assert(c, nEvents >= 5) containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container") assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out) } @@ -664,7 +664,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *testing.T) { events := strings.Split(strings.TrimSpace(out), "\n") nEvents := len(events) - assert.Assert(c, nEvents >= 1) //Missing expected event + assert.Assert(c, nEvents >= 1) actions := eventActionsByIDAndType(c, events, "testEvent", "container") for _, a := range actions { diff --git a/integration-cli/docker_cli_events_unix_test.go b/integration-cli/docker_cli_events_unix_test.go index 4d70e8c355..051bdeea7c 100644 --- a/integration-cli/docker_cli_events_unix_test.go +++ b/integration-cli/docker_cli_events_unix_test.go @@ -243,7 +243,7 @@ func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *testing.T) { assert.Assert(c, strings.Contains(netEvents[0], "disconnect")) assert.Assert(c, strings.Contains(netEvents[1], "disconnect")) - //both networks appeared in the network event output + // both networks appeared in the network event output assert.Assert(c, strings.Contains(out, "test-event-network-local-1")) assert.Assert(c, strings.Contains(out, "test-event-network-local-2")) } diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go index d81bc39533..0173c853e5 100644 --- a/integration-cli/docker_cli_images_test.go +++ b/integration-cli/docker_cli_images_test.go @@ -242,10 +242,10 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T) assert.Equal(c, strings.Count(out, imageID), 1) out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=false") - //dangling=false would not include dangling images + // dangling=false would not include dangling images assert.Assert(c, !strings.Contains(out, imageID)) out, _ = dockerCmd(c, "images") - //docker images still include dangling images + // docker images still include dangling images assert.Assert(c, strings.Contains(out, imageID)) } diff --git a/integration-cli/docker_cli_inspect_test.go b/integration-cli/docker_cli_inspect_test.go index be804394eb..6f91318aa4 100644 --- a/integration-cli/docker_cli_inspect_test.go +++ b/integration-cli/docker_cli_inspect_test.go @@ -42,8 +42,8 @@ func (s *DockerSuite) TestInspectInt64(c *testing.T) { } func (s *DockerSuite) TestInspectDefault(c *testing.T) { - //Both the container and image are named busybox. docker inspect will fetch the container JSON. - //If the container JSON is not available, it will go for the image JSON. + // Both the container and image are named busybox. docker inspect will fetch the container JSON. + // If the container JSON is not available, it will go for the image JSON. out, _ := dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") containerID := strings.TrimSpace(out) @@ -78,8 +78,8 @@ func (s *DockerSuite) TestInspectStatus(c *testing.T) { } func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) { - //Both the container and image are named busybox. docker inspect will fetch container - //JSON State.Running field. If the field is true, it's a container. + // Both the container and image are named busybox. docker inspect will fetch container + // JSON State.Running field. If the field is true, it's a container. runSleepingContainer(c, "--name=busybox", "-d") formatStr := "--format={{.State.Running}}" @@ -88,9 +88,9 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) { } func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) { - //Run this test on an image named busybox. docker inspect will try to fetch container - //JSON. Since there is no container named busybox and --type=container, docker inspect will - //not try to get the image JSON. It will throw an error. + // Run this test on an image named busybox. docker inspect will try to fetch container + // JSON. Since there is no container named busybox and --type=container, docker inspect will + // not try to get the image JSON. It will throw an error. dockerCmd(c, "run", "-d", "busybox", "true") @@ -100,9 +100,9 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) { } func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) { - //Both the container and image are named busybox. docker inspect will fetch image - //JSON as --type=image. if there is no image with name busybox, docker inspect - //will throw an error. + // Both the container and image are named busybox. docker inspect will fetch image + // JSON as --type=image. if there is no image with name busybox, docker inspect + // will throw an error. dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") @@ -112,8 +112,8 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) { } func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) { - //Both the container and image are named busybox. docker inspect will fail - //as --type=foobar is not a valid value for the flag. + // Both the container and image are named busybox. docker inspect will fail + // as --type=foobar is not a valid value for the flag. dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") @@ -295,9 +295,8 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) { } func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) { - - //Both the container and image are named busybox. docker inspect will fetch container - //JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields. + // Both the container and image are named busybox. docker inspect will fetch container + // JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields. runSleepingContainer(c, "--name=busybox", "-d") diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index bbbe792b2b..80d465c180 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -755,7 +755,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) { // skip header lines = lines[1:] - //ps output should have both the containers + // ps output should have both the containers assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2) // Making sure onbridgenetwork and onnonenetwork is on the output diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 6f3578f239..bef7e85834 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -175,7 +175,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *testing.T) { } } -//test --link use container name to link target +// test --link use container name to link target func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as the networking // settings are not populated back yet on inspect. @@ -190,7 +190,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *testing.T) { } } -//test --link use container id to link target +// test --link use container id to link target func (s *DockerSuite) TestRunLinksContainerWithContainerID(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as the networking // settings are not populated back yet on inspect. @@ -1430,7 +1430,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { tmpResolvConf := []byte("search pommesfrites.fr\nnameserver 12.34.56.78\n") tmpLocalhostResolvConf := []byte("nameserver 127.0.0.1") - //take a copy of resolv.conf for restoring after test completes + // take a copy of resolv.conf for restoring after test completes resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf") if err != nil { c.Fatal(err) @@ -1447,14 +1447,14 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { icmd.RunCommand("umount", "/etc/resolv.conf").Assert(c, icmd.Success) } - //cleanup + // cleanup defer func() { if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil { c.Fatal(err) } }() - //1. test that a restarting container gets an updated resolv.conf + // 1. test that a restarting container gets an updated resolv.conf dockerCmd(c, "run", "--name=first", "busybox", "true") containerID1 := getIDByName(c, "first") @@ -1472,16 +1472,16 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Restarted container does not have updated resolv.conf; expected %q, got %q", tmpResolvConf, string(containerResolv)) } - /* //make a change to resolv.conf (in this case replacing our tmp copy with orig copy) + /* // make a change to resolv.conf (in this case replacing our tmp copy with orig copy) if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil { c.Fatal(err) } */ - //2. test that a restarting container does not receive resolv.conf updates + // 2. test that a restarting container does not receive resolv.conf updates // if it modified the container copy of the starting point resolv.conf dockerCmd(c, "run", "--name=second", "busybox", "sh", "-c", "echo 'search mylittlepony.com' >>/etc/resolv.conf") containerID2 := getIDByName(c, "second") - //make a change to resolv.conf (in this case replacing our tmp copy with orig copy) + // make a change to resolv.conf (in this case replacing our tmp copy with orig copy) if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil { c.Fatal(err) } @@ -1495,7 +1495,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Container's resolv.conf should not have been updated with host resolv.conf: %q", string(containerResolv)) } - //3. test that a running container's resolv.conf is not modified while running + // 3. test that a running container's resolv.conf is not modified while running out, _ := dockerCmd(c, "run", "-d", "busybox", "top") runningContainerID := strings.TrimSpace(out) @@ -1510,7 +1510,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Running container should not have updated resolv.conf; expected %q, got %q", string(resolvConfSystem), string(containerResolv)) } - //4. test that a running container's resolv.conf is updated upon restart + // 4. test that a running container's resolv.conf is updated upon restart // (the above container is still running..) dockerCmd(c, "restart", runningContainerID) @@ -1520,7 +1520,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Restarted container should have updated resolv.conf; expected %q, got %q", string(tmpResolvConf), string(containerResolv)) } - //5. test that additions of a localhost resolver are cleaned from + // 5. test that additions of a localhost resolver are cleaned from // host resolv.conf before updating container's resolv.conf copies // replace resolv.conf with a localhost-only nameserver copy @@ -1539,7 +1539,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Container does not have cleaned/replaced DNS in resolv.conf; expected %q, got %q", expected, string(containerResolv)) } - //6. Test that replacing (as opposed to modifying) resolv.conf triggers an update + // 6. Test that replacing (as opposed to modifying) resolv.conf triggers an update // of containers' resolv.conf. // Restore the original resolv.conf @@ -1570,7 +1570,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { c.Fatalf("Stopped container does not have updated resolv.conf; expected\n%q\n got\n%q", tmpResolvConf, string(containerResolv)) } - //cleanup, restore original resolv.conf happens in defer func() + // cleanup, restore original resolv.conf happens in defer func() } func (s *DockerSuite) TestRunAddHost(c *testing.T) { @@ -1958,7 +1958,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *testing.T) { } // #2098 - Docker cidFiles only contain short version of the containerId -//sudo docker run --cidfile /tmp/docker_tesc.cid ubuntu echo "test" +// sudo docker run --cidfile /tmp/docker_tesc.cid ubuntu echo "test" // TestRunCidFile tests that run --cidfile returns the longid func (s *DockerSuite) TestRunCidFileCheckIDLength(c *testing.T) { tmpDir, err := ioutil.TempDir("", "TestRunCidFile") @@ -2016,7 +2016,7 @@ func (s *DockerSuite) TestRunInspectMacAddress(c *testing.T) { // test docker run use an invalid mac address func (s *DockerSuite) TestRunWithInvalidMacAddress(c *testing.T) { out, _, err := dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29", "busybox") - //use an invalid mac address should with an error out + // use an invalid mac address should with an error out if err == nil || !strings.Contains(out, "is not a valid mac address") { c.Fatalf("run with an invalid --mac-address should with error out") } @@ -2148,7 +2148,7 @@ func (s *DockerSuite) TestRunReuseBindVolumeThatIsSymlink(c *testing.T) { dockerCmd(c, "run", "-v", fmt.Sprintf("%s:"+prefix+"/tmp/test", linkPath), "busybox", "ls", prefix+"/tmp/test") } -//GH#10604: Test an "/etc" volume doesn't overlay special bind mounts in container +// GH#10604: Test an "/etc" volume doesn't overlay special bind mounts in container func (s *DockerSuite) TestRunCreateVolumeEtc(c *testing.T) { // While Windows supports volumes, it does not support --add-host hence // this test is not applicable on Windows. diff --git a/integration-cli/docker_cli_save_load_unix_test.go b/integration-cli/docker_cli_save_load_unix_test.go index c1dfa012d8..0d36b01125 100644 --- a/integration-cli/docker_cli_save_load_unix_test.go +++ b/integration-cli/docker_cli_save_load_unix_test.go @@ -66,7 +66,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *testing.T) { buf := make([]byte, 1024) n, err := pty.Read(buf) - assert.NilError(c, err) //could not read tty output + assert.NilError(c, err, "could not read tty output") assert.Assert(c, strings.Contains(string(buf[:n]), "cowardly refusing"), "help output is not being yielded") } diff --git a/integration-cli/docker_cli_search_test.go b/integration-cli/docker_cli_search_test.go index a029c95c4b..0631f91b45 100644 --- a/integration-cli/docker_cli_search_test.go +++ b/integration-cli/docker_cli_search_test.go @@ -36,19 +36,19 @@ func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) { outSearchCmd, _ := dockerCmd(c, "search", "busybox") assert.Assert(c, strings.Count(outSearchCmd, "\n") > 3, outSearchCmd) - outSearchCmdautomated, _ := dockerCmd(c, "search", "--filter", "is-automated=true", "busybox") //The busybox is a busybox base image, not an AUTOMATED image. + outSearchCmdautomated, _ := dockerCmd(c, "search", "--filter", "is-automated=true", "busybox") // The busybox is a busybox base image, not an AUTOMATED image. outSearchCmdautomatedSlice := strings.Split(outSearchCmdautomated, "\n") for i := range outSearchCmdautomatedSlice { assert.Assert(c, !strings.HasPrefix(outSearchCmdautomatedSlice[i], "busybox "), "The busybox is not an AUTOMATED image: %s", outSearchCmdautomated) } - outSearchCmdNotOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=false", "busybox") //The busybox is a busybox base image, official image. + outSearchCmdNotOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=false", "busybox") // The busybox is a busybox base image, official image. outSearchCmdNotOfficialSlice := strings.Split(outSearchCmdNotOfficial, "\n") for i := range outSearchCmdNotOfficialSlice { assert.Assert(c, !strings.HasPrefix(outSearchCmdNotOfficialSlice[i], "busybox "), "The busybox is not an OFFICIAL image: %s", outSearchCmdNotOfficial) } - outSearchCmdOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=true", "busybox") //The busybox is a busybox base image, official image. + outSearchCmdOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=true", "busybox") // The busybox is a busybox base image, official image. outSearchCmdOfficialSlice := strings.Split(outSearchCmdOfficial, "\n") assert.Equal(c, len(outSearchCmdOfficialSlice), 3) // 1 header, 1 line, 1 carriage return assert.Assert(c, strings.HasPrefix(outSearchCmdOfficialSlice[1], "busybox "), "The busybox is an OFFICIAL image: %s", outSearchCmdOfficial)