rm-gocheck: convert check.Commentf to string - with just one string
sed -E -i 's#\bcheck.Commentf\(("[^"]+")\)#\1#g' \
-- "integration-cli/daemon/daemon_swarm.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_utils_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 6135eec30a
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
673cf751ca
commit
2f069fa3a5
22 changed files with 140 additions and 140 deletions
|
@ -176,7 +176,7 @@ func (d *Daemon) CheckLeader(c *testing.T) (interface{}, check.CommentInterface)
|
|||
cli := d.NewClientT(c)
|
||||
defer cli.Close()
|
||||
|
||||
errList := check.Commentf("could not get node list")
|
||||
errList := "could not get node list"
|
||||
|
||||
ls, err := cli.NodeList(context.Background(), types.NodeListOptions{})
|
||||
if err != nil {
|
||||
|
@ -188,7 +188,7 @@ func (d *Daemon) CheckLeader(c *testing.T) (interface{}, check.CommentInterface)
|
|||
return nil, nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("no leader"), check.Commentf("could not find leader")
|
||||
return fmt.Errorf("no leader"), "could not find leader"
|
||||
}
|
||||
|
||||
// CmdRetryOutOfSequence tries the specified command against the current daemon
|
||||
|
|
|
@ -121,7 +121,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
|
|||
break
|
||||
}
|
||||
}
|
||||
assert.Assert(c, found, check.Commentf("The created test file has not been found in the exported image"))
|
||||
assert.Assert(c, found, "The created test file has not been found in the exported image")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
|
||||
|
@ -144,7 +144,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
|
|||
success = true
|
||||
}
|
||||
}
|
||||
assert.Assert(c, success, check.Commentf("/etc/passwd has been removed but is not present in the diff"))
|
||||
assert.Assert(c, success, "/etc/passwd has been removed but is not present in the diff")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
|
||||
|
@ -215,7 +215,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *testing.T) {
|
|||
|
||||
// Now remove without `-f` and make sure we are still pulling stats
|
||||
_, _, err = dockerCmdWithError("rm", id)
|
||||
assert.Assert(c, err != nil, check.Commentf("rm should have failed but didn't"))
|
||||
assert.Assert(c, err != nil, "rm should have failed but didn't")
|
||||
_, err = buf.ReadTimeout(b, 2*time.Second)
|
||||
assert.NilError(c, err)
|
||||
|
||||
|
@ -389,7 +389,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
|
||||
pausedContainers = getPaused(c)
|
||||
assert.Equal(c, len(pausedContainers), 0, check.Commentf("There should be no paused container."))
|
||||
assert.Equal(c, len(pausedContainers), 0, "There should be no paused container.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
||||
|
@ -615,7 +615,7 @@ func UtilCreateNetworkMode(c *testing.T, networkMode containertypes.NetworkMode)
|
|||
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
|
||||
assert.NilError(c, err)
|
||||
|
||||
assert.Equal(c, containerJSON.HostConfig.NetworkMode, containertypes.NetworkMode(networkMode), check.Commentf("Mismatched NetworkMode"))
|
||||
assert.Equal(c, containerJSON.HostConfig.NetworkMode, containertypes.NetworkMode(networkMode), "Mismatched NetworkMode")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
|
||||
|
@ -888,7 +888,7 @@ func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
|
||||
name := inspectField(c, containerID, "Name")
|
||||
assert.Equal(c, name, "/"+newName, check.Commentf("Failed to rename container"))
|
||||
assert.Equal(c, name, "/"+newName, "Failed to rename container")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
|
||||
|
@ -1168,7 +1168,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
|||
assert.Assert(c, waitRun(id2) == nil)
|
||||
|
||||
links := inspectFieldJSON(c, id2, "HostConfig.Links")
|
||||
assert.Equal(c, links, "[\"/tlink1:/tlink2/tlink1\"]", check.Commentf("expected to have links between containers"))
|
||||
assert.Equal(c, links, "[\"/tlink1:/tlink2/tlink1\"]", "expected to have links between containers")
|
||||
|
||||
removeOptions := types.ContainerRemoveOptions{
|
||||
RemoveLinks: true,
|
||||
|
@ -1182,7 +1182,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
|
||||
linksPostRm := inspectFieldJSON(c, id2, "HostConfig.Links")
|
||||
assert.Equal(c, linksPostRm, "null", check.Commentf("call to api deleteContainer links should have removed the specified links"))
|
||||
assert.Equal(c, linksPostRm, "null", "call to api deleteContainer links should have removed the specified links")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) {
|
||||
|
@ -1250,7 +1250,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) {
|
|||
req.ContentLength = -1
|
||||
return nil
|
||||
}))
|
||||
assert.Assert(c, err == nil, check.Commentf("error creating container with chunked encoding"))
|
||||
assert.Assert(c, err == nil, "error creating container with chunked encoding")
|
||||
defer resp.Body.Close()
|
||||
assert.Equal(c, resp.StatusCode, http.StatusCreated)
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
|
|||
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
||||
return certs[0].Subject.OrganizationalUnit[0], nil
|
||||
}
|
||||
return "", check.Commentf("could not get organizational unit from certificate")
|
||||
return "", "could not get organizational unit from certificate"
|
||||
}, checker.Equals, "swarm-worker")
|
||||
|
||||
// Demoting last node should fail
|
||||
|
@ -340,7 +340,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) {
|
|||
}
|
||||
|
||||
if leader == nil {
|
||||
return false, check.Commentf("no leader elected")
|
||||
return false, "no leader elected"
|
||||
}
|
||||
|
||||
return true, fmt.Sprintf("elected %v", leader.ID())
|
||||
|
@ -742,7 +742,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
|
|||
client := d.NewClientT(c)
|
||||
daemonInfo, err := client.Info(context.Background())
|
||||
info = daemonInfo.Swarm
|
||||
return err, check.Commentf("cluster not ready in time")
|
||||
return err, "cluster not ready in time"
|
||||
}
|
||||
waitAndAssert(c, defaultReconciliationTimeout, checkInfo, checker.IsNil)
|
||||
if !info.ControlAvailable {
|
||||
|
|
|
@ -58,14 +58,14 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
|||
err := json.Unmarshal([]byte(cfg), &c1)
|
||||
assert.Assert(c, err == nil, check.Commentf(cfg))
|
||||
|
||||
assert.Equal(c, c1.Memory, int64(64*1024*1024), check.Commentf("resource constraints not set properly for Memory"))
|
||||
assert.Equal(c, c1.MemorySwap, int64(-1), check.Commentf("resource constraints not set properly for MemorySwap"))
|
||||
assert.Equal(c, c1.CpusetCpus, "0", check.Commentf("resource constraints not set properly for CpusetCpus"))
|
||||
assert.Equal(c, c1.CpusetMems, "0", check.Commentf("resource constraints not set properly for CpusetMems"))
|
||||
assert.Equal(c, c1.CPUShares, int64(100), check.Commentf("resource constraints not set properly for CPUShares"))
|
||||
assert.Equal(c, c1.CPUQuota, int64(8000), check.Commentf("resource constraints not set properly for CPUQuota"))
|
||||
assert.Equal(c, c1.Ulimits[0].Name, "nofile", check.Commentf("resource constraints not set properly for Ulimits"))
|
||||
assert.Equal(c, c1.Ulimits[0].Hard, int64(42), check.Commentf("resource constraints not set properly for Ulimits"))
|
||||
assert.Equal(c, c1.Memory, int64(64*1024*1024), "resource constraints not set properly for Memory")
|
||||
assert.Equal(c, c1.MemorySwap, int64(-1), "resource constraints not set properly for MemorySwap")
|
||||
assert.Equal(c, c1.CpusetCpus, "0", "resource constraints not set properly for CpusetCpus")
|
||||
assert.Equal(c, c1.CpusetMems, "0", "resource constraints not set properly for CpusetMems")
|
||||
assert.Equal(c, c1.CPUShares, int64(100), "resource constraints not set properly for CPUShares")
|
||||
assert.Equal(c, c1.CPUQuota, int64(8000), "resource constraints not set properly for CPUQuota")
|
||||
assert.Equal(c, c1.Ulimits[0].Name, "nofile", "resource constraints not set properly for Ulimits")
|
||||
assert.Equal(c, c1.Ulimits[0].Hard, int64(42), "resource constraints not set properly for Ulimits")
|
||||
|
||||
// Make sure constraints aren't saved to image
|
||||
cli.DockerCmd(c, "run", "--name=test", name)
|
||||
|
@ -76,13 +76,13 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
|||
err = json.Unmarshal([]byte(cfg), &c2)
|
||||
assert.Assert(c, err == nil, check.Commentf(cfg))
|
||||
|
||||
assert.Assert(c, c2.Memory != int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
|
||||
assert.Assert(c, c2.MemorySwap != int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
|
||||
assert.Assert(c, c2.CpusetCpus != "0", check.Commentf("resource leaked from build for CpusetCpus"))
|
||||
assert.Assert(c, c2.CpusetMems != "0", check.Commentf("resource leaked from build for CpusetMems"))
|
||||
assert.Assert(c, c2.CPUShares != int64(100), check.Commentf("resource leaked from build for CPUShares"))
|
||||
assert.Assert(c, c2.CPUQuota != int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
|
||||
assert.Assert(c, c2.Ulimits == nil, check.Commentf("resource leaked from build for Ulimits"))
|
||||
assert.Assert(c, c2.Memory != int64(64*1024*1024), "resource leaked from build for Memory")
|
||||
assert.Assert(c, c2.MemorySwap != int64(-1), "resource leaked from build for MemorySwap")
|
||||
assert.Assert(c, c2.CpusetCpus != "0", "resource leaked from build for CpusetCpus")
|
||||
assert.Assert(c, c2.CpusetMems != "0", "resource leaked from build for CpusetMems")
|
||||
assert.Assert(c, c2.CPUShares != int64(100), "resource leaked from build for CPUShares")
|
||||
assert.Assert(c, c2.CPUQuota != int64(8000), "resource leaked from build for CPUQuota")
|
||||
assert.Assert(c, c2.Ulimits == nil, "resource leaked from build for Ulimits")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
|
|
|
@ -115,8 +115,8 @@ func testPullByDigestNoFallback(c *testing.T) {
|
|||
// pull from the registry using the <name>@<digest> reference
|
||||
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
|
||||
out, _, err := dockerCmdWithError("pull", imageReference)
|
||||
assert.Assert(c, err != nil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
||||
assert.Assert(c, strings.Contains(out, fmt.Sprintf("manifest for %s not found", imageReference)), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
||||
assert.Assert(c, err != nil, "expected non-zero exit status and correct error message when pulling non-existing image")
|
||||
assert.Assert(c, strings.Contains(out, fmt.Sprintf("manifest for %s not found", imageReference)), "expected non-zero exit status and correct error message when pulling non-existing image")
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *testing.T) {
|
||||
|
@ -234,7 +234,7 @@ func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *testing.T) {
|
|||
dockerCmd(c, "pull", imageReference)
|
||||
|
||||
out, _ := dockerCmd(c, "images")
|
||||
assert.Assert(c, !strings.Contains(out, "DIGEST"), check.Commentf("list output should not have contained DIGEST header"))
|
||||
assert.Assert(c, !strings.Contains(out, "DIGEST"), "list output should not have contained DIGEST header")
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
|
||||
|
@ -389,7 +389,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
|||
|
||||
func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) {
|
||||
digest, err := setupImage(c)
|
||||
assert.Assert(c, err == nil, check.Commentf("error setting up image"))
|
||||
assert.Assert(c, err == nil, "error setting up image")
|
||||
|
||||
imageReference := fmt.Sprintf("%s@%s", repoName, digest)
|
||||
|
||||
|
@ -568,14 +568,14 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) {
|
|||
func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
manifestDigest, err := setupImage(c)
|
||||
assert.Assert(c, err == nil, check.Commentf("error setting up image"))
|
||||
assert.Assert(c, err == nil, "error setting up image")
|
||||
|
||||
// Load the target manifest blob.
|
||||
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest)
|
||||
|
||||
var imgManifest schema1.Manifest
|
||||
err = json.Unmarshal(manifestBlob, &imgManifest)
|
||||
assert.Assert(c, err == nil, check.Commentf("unable to decode image manifest from blob"))
|
||||
assert.Assert(c, err == nil, "unable to decode image manifest from blob")
|
||||
|
||||
// Change a layer in the manifest.
|
||||
imgManifest.FSLayers[0] = schema1.FSLayer{
|
||||
|
@ -588,7 +588,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing
|
|||
defer undo()
|
||||
|
||||
alteredManifestBlob, err := json.MarshalIndent(imgManifest, "", " ")
|
||||
assert.Assert(c, err == nil, check.Commentf("unable to encode altered image manifest to JSON"))
|
||||
assert.Assert(c, err == nil, "unable to encode altered image manifest to JSON")
|
||||
|
||||
s.reg.WriteBlobContents(c, manifestDigest, alteredManifestBlob)
|
||||
|
||||
|
@ -641,7 +641,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
|
|||
// Pull from the registry using the <name>@<digest> reference.
|
||||
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
||||
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
||||
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
||||
assert.Assert(c, exitStatus != 0, "expected a non-zero exit status")
|
||||
|
||||
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
||||
assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out))
|
||||
|
@ -684,7 +684,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T)
|
|||
// Pull from the registry using the <name>@<digest> reference.
|
||||
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
||||
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
||||
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
||||
assert.Assert(c, exitStatus != 0, "expected a non-zero exit status")
|
||||
|
||||
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
||||
assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out))
|
||||
|
|
|
@ -246,7 +246,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T)
|
|||
basesizeAfterRestart := getBaseDeviceSize(c, s.d)
|
||||
newBasesize, err := convertBasesize(newBasesizeBytes)
|
||||
assert.Assert(c, err == nil, fmt.Sprintf("Error in converting base device size: %v", err))
|
||||
assert.Equal(c, newBasesize, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
||||
assert.Equal(c, newBasesize, basesizeAfterRestart, "Basesize passed is not equal to Basesize set")
|
||||
s.d.Stop(c)
|
||||
}
|
||||
|
||||
|
@ -435,12 +435,12 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *testing.T) {
|
|||
out = strings.Trim(out, " \r\n'")
|
||||
|
||||
ip := net.ParseIP(out)
|
||||
assert.Assert(c, ip != nil, check.Commentf("Container should have a global IPv6 address"))
|
||||
assert.Assert(c, ip != nil, "Container should have a global IPv6 address")
|
||||
|
||||
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.IPv6Gateway}}", "ipv6test")
|
||||
assert.NilError(c, err, out)
|
||||
|
||||
assert.Equal(c, strings.Trim(out, " \r\n'"), "2001:db8:2::100", check.Commentf("Container should have a global IPv6 gateway"))
|
||||
assert.Equal(c, strings.Trim(out, " \r\n'"), "2001:db8:2::100", "Container should have a global IPv6 gateway")
|
||||
}
|
||||
|
||||
// TestDaemonIPv6FixedCIDRAndMac checks that when the daemon is started with ipv6 fixed CIDR
|
||||
|
@ -478,7 +478,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *testing.T) {
|
||||
assert.Assert(c, s.d.StartWithError("--log-level=bogus") != nil, check.Commentf("Daemon shouldn't start with wrong log level"))
|
||||
assert.Assert(c, s.d.StartWithError("--log-level=bogus") != nil, "Daemon shouldn't start with wrong log level")
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *testing.T) {
|
||||
|
@ -845,7 +845,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
|
|||
defer d.Restart(c)
|
||||
|
||||
out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
|
||||
assert.Assert(c, err != nil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
||||
assert.Assert(c, err != nil, "Running a container must fail with an invalid --ip option")
|
||||
assert.Equal(c, strings.Contains(out, "Error starting userland proxy"), true)
|
||||
|
||||
ifName := "dummy"
|
||||
|
@ -1137,7 +1137,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *testing.T) {
|
|||
assert.NilError(c, err, out)
|
||||
|
||||
out, err = s.d.Cmd("logs", "test")
|
||||
assert.Assert(c, err != nil, check.Commentf("Logs should fail with 'none' driver"))
|
||||
assert.Assert(c, err != nil, "Logs should fail with 'none' driver")
|
||||
expected := `configured logging driver does not support reading`
|
||||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
@ -1631,7 +1631,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *testing.T) {
|
|||
s.d.Restart(c)
|
||||
|
||||
out, err = s.d.Cmd("volume", "rm", "test")
|
||||
assert.Assert(c, err != nil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
||||
assert.Assert(c, err != nil, "should not be able to remove in use volume after daemon restart")
|
||||
assert.Assert(c, strings.Contains(out, "in use"))
|
||||
}
|
||||
|
||||
|
@ -2194,7 +2194,7 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T)
|
|||
// daemon config file
|
||||
daemonConfig := `{ "debug" : false }`
|
||||
configFile, err := ioutil.TempFile("", "test-daemon-discovery-backend-config-reload-config")
|
||||
assert.Assert(c, err == nil, check.Commentf("could not create temp file for config reload"))
|
||||
assert.Assert(c, err == nil, "could not create temp file for config reload")
|
||||
configFilePath := configFile.Name()
|
||||
defer func() {
|
||||
configFile.Close()
|
||||
|
@ -2224,7 +2224,7 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T)
|
|||
assert.NilError(c, err)
|
||||
|
||||
err = s.d.ReloadConfig()
|
||||
assert.Assert(c, err == nil, check.Commentf("error reloading daemon config"))
|
||||
assert.Assert(c, err == nil, "error reloading daemon config")
|
||||
|
||||
out, err := s.d.Cmd("info")
|
||||
assert.NilError(c, err)
|
||||
|
@ -2562,15 +2562,15 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *testing.
|
|||
|
||||
out, err = s.d.Cmd("ps")
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, strings.Contains(out, "top1"), check.Commentf("top1 should be running"))
|
||||
assert.Assert(c, strings.Contains(out, "top2"), check.Commentf("top2 should be running"))
|
||||
assert.Assert(c, strings.Contains(out, "top1"), "top1 should be running")
|
||||
assert.Assert(c, strings.Contains(out, "top2"), "top2 should be running")
|
||||
// now restart daemon gracefully
|
||||
s.d.Restart(c)
|
||||
|
||||
out, err = s.d.Cmd("ps", "-a")
|
||||
assert.NilError(c, err, "out: %v", out)
|
||||
assert.Assert(c, strings.Contains(out, "top1"), check.Commentf("top1 should exist after daemon restarts"))
|
||||
assert.Assert(c, !strings.Contains(out, "top2"), check.Commentf("top2 should be removed after daemon restarts"))
|
||||
assert.Assert(c, strings.Contains(out, "top1"), "top1 should exist after daemon restarts")
|
||||
assert.Assert(c, !strings.Contains(out, "top2"), "top2 should be removed after daemon restarts")
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *testing.T) {
|
||||
|
@ -2710,7 +2710,7 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *testing.T) {
|
|||
|
||||
// Wait for shell command to be completed
|
||||
_, err = s.d.Cmd("exec", "top", "sh", "-c", `for i in $(seq 1 5); do if [ -e /adduser_end ]; then rm -f /adduser_end && break; else sleep 1 && false; fi; done`)
|
||||
assert.Assert(c, err == nil, check.Commentf("Timeout waiting for shell command to be completed"))
|
||||
assert.Assert(c, err == nil, "Timeout waiting for shell command to be completed")
|
||||
|
||||
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
||||
// uid=100(test) gid=101(test) groups=101(test)
|
||||
|
@ -2838,13 +2838,13 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
|
|||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
configPath, err := ioutil.TempDir("", "test-daemon-shm-size-reload-config")
|
||||
assert.Assert(c, err == nil, check.Commentf("could not create temp file for config reload"))
|
||||
assert.Assert(c, err == nil, "could not create temp file for config reload")
|
||||
defer os.RemoveAll(configPath) // clean up
|
||||
configFile := filepath.Join(configPath, "config.json")
|
||||
|
||||
size := 67108864 * 2
|
||||
configData := []byte(fmt.Sprintf(`{"default-shm-size": "%dM"}`, size/1024/1024))
|
||||
assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666) == nil, check.Commentf("could not write temp file for config reload"))
|
||||
assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666) == nil, "could not write temp file for config reload")
|
||||
pattern := regexp.MustCompile(fmt.Sprintf("shm on /dev/shm type tmpfs(.*)size=%dk", size/1024))
|
||||
|
||||
s.d.StartWithBusybox(c, "--config-file", configFile)
|
||||
|
@ -2859,11 +2859,11 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
|
|||
|
||||
size = 67108864 * 3
|
||||
configData = []byte(fmt.Sprintf(`{"default-shm-size": "%dM"}`, size/1024/1024))
|
||||
assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666) == nil, check.Commentf("could not write temp file for config reload"))
|
||||
assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666) == nil, "could not write temp file for config reload")
|
||||
pattern = regexp.MustCompile(fmt.Sprintf("shm on /dev/shm type tmpfs(.*)size=%dk", size/1024))
|
||||
|
||||
err = s.d.ReloadConfig()
|
||||
assert.Assert(c, err == nil, check.Commentf("error reloading daemon config"))
|
||||
assert.Assert(c, err == nil, "error reloading daemon config")
|
||||
|
||||
name = "shm2"
|
||||
out, err = s.d.Cmd("run", "--name", name, "busybox", "mount")
|
||||
|
|
|
@ -285,7 +285,7 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *testing
|
|||
dockerCmd(c, "volume", "create", "test")
|
||||
|
||||
out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
|
||||
assert.Assert(c, err != nil, check.Commentf("volume create exception name already in use with another driver"))
|
||||
assert.Assert(c, err != nil, "volume create exception name already in use with another driver")
|
||||
assert.Assert(c, strings.Contains(out, "must be unique"))
|
||||
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
|
||||
_, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out))
|
||||
|
|
|
@ -63,7 +63,7 @@ func (s *DockerSuite) TestHistoryExistentImage(c *testing.T) {
|
|||
|
||||
func (s *DockerSuite) TestHistoryNonExistentImage(c *testing.T) {
|
||||
_, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
|
||||
assert.Assert(c, err != nil, check.Commentf("history on a non-existent image should fail."))
|
||||
assert.Assert(c, err != nil, "history on a non-existent image should fail.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) {
|
||||
|
|
|
@ -36,7 +36,7 @@ func (s *DockerSuite) TestImportDisplay(c *testing.T) {
|
|||
|
||||
func (s *DockerSuite) TestImportBadURL(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("import", "http://nourl/bad")
|
||||
assert.Assert(c, err != nil, check.Commentf("import was supposed to fail but didn't"))
|
||||
assert.Assert(c, err != nil, "import was supposed to fail but didn't")
|
||||
// Depending on your system you can get either of these errors
|
||||
if !strings.Contains(out, "dial tcp") &&
|
||||
!strings.Contains(out, "ApplyLayer exit status 1 stdout: stderr: archive/tar: invalid tar header") &&
|
||||
|
@ -50,7 +50,7 @@ func (s *DockerSuite) TestImportFile(c *testing.T) {
|
|||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create temporary file"))
|
||||
assert.Assert(c, err == nil, "failed to create temporary file")
|
||||
defer os.Remove(temporaryFile.Name())
|
||||
|
||||
icmd.RunCmd(icmd.Cmd{
|
||||
|
@ -71,7 +71,7 @@ func (s *DockerSuite) TestImportGzipped(c *testing.T) {
|
|||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create temporary file"))
|
||||
assert.Assert(c, err == nil, "failed to create temporary file")
|
||||
defer os.Remove(temporaryFile.Name())
|
||||
|
||||
w := gzip.NewWriter(temporaryFile)
|
||||
|
@ -79,7 +79,7 @@ func (s *DockerSuite) TestImportGzipped(c *testing.T) {
|
|||
Command: []string{dockerBinary, "export", "test-import"},
|
||||
Stdout: w,
|
||||
}).Assert(c, icmd.Success)
|
||||
assert.Assert(c, w.Close() == nil, check.Commentf("failed to close gzip writer"))
|
||||
assert.Assert(c, w.Close() == nil, "failed to close gzip writer")
|
||||
temporaryFile.Close()
|
||||
out, _ := dockerCmd(c, "import", temporaryFile.Name())
|
||||
assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't")
|
||||
|
@ -94,7 +94,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
|||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create temporary file"))
|
||||
assert.Assert(c, err == nil, "failed to create temporary file")
|
||||
defer os.Remove(temporaryFile.Name())
|
||||
|
||||
icmd.RunCmd(icmd.Cmd{
|
||||
|
@ -110,11 +110,11 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
|||
out, _ = dockerCmd(c, "history", image)
|
||||
split := strings.Split(out, "\n")
|
||||
|
||||
assert.Equal(c, len(split), 3, check.Commentf("expected 3 lines from image history"))
|
||||
assert.Equal(c, len(split), 3, "expected 3 lines from image history")
|
||||
r := regexp.MustCompile("[\\s]{2,}")
|
||||
split = r.Split(split[1], -1)
|
||||
|
||||
assert.Equal(c, message, split[3], check.Commentf("didn't get expected value in commit message"))
|
||||
assert.Equal(c, message, split[3], "didn't get expected value in commit message")
|
||||
|
||||
out, _ = dockerCmd(c, "run", "--rm", image, "true")
|
||||
assert.Equal(c, out, "", "command output should've been nothing")
|
||||
|
@ -122,7 +122,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
|||
|
||||
func (s *DockerSuite) TestImportFileNonExistentFile(c *testing.T) {
|
||||
_, _, err := dockerCmdWithError("import", "example.com/myImage.tar")
|
||||
assert.Assert(c, err != nil, check.Commentf("import non-existing file must failed"))
|
||||
assert.Assert(c, err != nil, "import non-existing file must failed")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportWithQuotedChanges(c *testing.T) {
|
||||
|
@ -130,7 +130,7 @@ func (s *DockerSuite) TestImportWithQuotedChanges(c *testing.T) {
|
|||
cli.DockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create temporary file"))
|
||||
assert.Assert(c, err == nil, "failed to create temporary file")
|
||||
defer os.Remove(temporaryFile.Name())
|
||||
|
||||
cli.Docker(cli.Args("export", "test-import"), cli.WithStdout(bufio.NewWriter(temporaryFile))).Assert(c, icmd.Success)
|
||||
|
|
|
@ -62,7 +62,7 @@ func (s *DockerNetworkSuite) TearDownTest(c *testing.T) {
|
|||
func (s *DockerNetworkSuite) SetUpSuite(c *testing.T) {
|
||||
mux := http.NewServeMux()
|
||||
s.server = httptest.NewServer(mux)
|
||||
assert.Assert(c, s.server != nil, check.Commentf("Failed to start an HTTP Server"))
|
||||
assert.Assert(c, s.server != nil, "Failed to start an HTTP Server")
|
||||
setupRemoteNetworkDrivers(c, mux, s.server.URL, dummyNetworkDriver, dummyIPAMDriver)
|
||||
}
|
||||
|
||||
|
@ -1146,7 +1146,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) {
|
|||
dockerCmd(c, "run", "-d", "--name", "container1", "--net=host", "busybox", "top")
|
||||
assert.Assert(c, waitRun("container1") == nil)
|
||||
out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1")
|
||||
assert.Assert(c, err != nil, check.Commentf("Should err out disconnect from host"))
|
||||
assert.Assert(c, err != nil, "Should err out disconnect from host")
|
||||
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetwork.Error()))
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *testing.T) {
|
|||
func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *testing.T) {
|
||||
dockerCmd(c, "create", "--name", "test", "busybox")
|
||||
networks := inspectField(c, "test", "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, "bridge"), check.Commentf("Should return 'bridge' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "bridge"), "Should return 'bridge' network")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *testing.T) {
|
||||
|
@ -1229,8 +1229,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *tes
|
|||
dockerCmd(c, "network", "connect", "test", "foo")
|
||||
dockerCmd(c, "restart", "foo")
|
||||
networks := inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, "bridge"), check.Commentf("Should contain 'bridge' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "bridge"), "Should contain 'bridge' network")
|
||||
assert.Assert(c, strings.Contains(networks, "test"), "Should contain 'test' network")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContainer(c *testing.T) {
|
||||
|
@ -1239,11 +1239,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine
|
|||
dockerCmd(c, "create", "--name=foo", "busybox", "top")
|
||||
dockerCmd(c, "network", "connect", "test", "foo")
|
||||
networks := inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "test"), "Should contain 'test' network")
|
||||
// Restart docker daemon to test the config has persisted to disk
|
||||
s.d.Restart(c)
|
||||
networks = inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "test"), "Should contain 'test' network")
|
||||
// start the container and test if we can ping it from another container in the same network
|
||||
dockerCmd(c, "start", "foo")
|
||||
assert.Assert(c, waitRun("foo") == nil)
|
||||
|
@ -1256,18 +1256,18 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine
|
|||
// Test disconnect
|
||||
dockerCmd(c, "network", "disconnect", "test", "foo")
|
||||
networks = inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), check.Commentf("Should not contain 'test' network"))
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), "Should not contain 'test' network")
|
||||
// Restart docker daemon to test the config has persisted to disk
|
||||
s.d.Restart(c)
|
||||
networks = inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), check.Commentf("Should not contain 'test' network"))
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), "Should not contain 'test' network")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetwork(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "test")
|
||||
dockerCmd(c, "run", "--net=test", "-d", "--name=foo", "busybox", "top")
|
||||
networks := inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
||||
assert.Assert(c, strings.Contains(networks, "test"), "Should contain 'test' network")
|
||||
// Stop container and remove network
|
||||
dockerCmd(c, "stop", "foo")
|
||||
dockerCmd(c, "network", "rm", "test")
|
||||
|
@ -1275,7 +1275,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetw
|
|||
// Test disconnecting stopped container from nonexisting network
|
||||
dockerCmd(c, "network", "disconnect", "-f", "test", "foo")
|
||||
networks = inspectField(c, "foo", "NetworkSettings.Networks")
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), check.Commentf("Should not contain 'test' network"))
|
||||
assert.Assert(c, !strings.Contains(networks, "test"), "Should not contain 'test' network")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
|
||||
|
@ -1487,7 +1487,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *testing.T) {
|
|||
networks := inspectField(c, containerName, "NetworkSettings.Networks")
|
||||
assert.Assert(c, strings.Contains(networks, netWorkName1), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
||||
assert.Assert(c, strings.Contains(networks, netWorkName2), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
||||
assert.Assert(c, !strings.Contains(networks, "bridge"), check.Commentf("Should not contain 'bridge' network"))
|
||||
assert.Assert(c, !strings.Contains(networks, "bridge"), "Should not contain 'bridge' network")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(c *testing.T) {
|
||||
|
|
|
@ -168,7 +168,7 @@ func (ps *DockerPluginSuite) TestPluginSet(c *testing.T) {
|
|||
{Name: "pdev2", Settable: []string{"path"}}, // Device without Path is invalid.
|
||||
}
|
||||
})
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create test plugin"))
|
||||
assert.Assert(c, err == nil, "failed to create test plugin")
|
||||
|
||||
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", name)
|
||||
assert.Equal(c, strings.TrimSpace(env), "[DEBUG=0]")
|
||||
|
@ -338,7 +338,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *testing.T) {
|
|||
})
|
||||
cancel()
|
||||
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create test plugin"))
|
||||
assert.Assert(c, err == nil, "failed to create test plugin")
|
||||
|
||||
// Find ID first
|
||||
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", name)
|
||||
|
@ -397,7 +397,7 @@ func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *testing.T) {
|
|||
err = plugin.Create(ctx, client, name, func(cfg *plugin.Config) {
|
||||
cfg.Description = "test plugin"
|
||||
})
|
||||
assert.Assert(c, err == nil, check.Commentf("failed to create test plugin"))
|
||||
assert.Assert(c, err == nil, "failed to create test plugin")
|
||||
|
||||
out, _ := dockerCmd(c, "plugin", "inspect", "--format", "{{.ID}}", name)
|
||||
id := strings.TrimSpace(out)
|
||||
|
|
|
@ -336,11 +336,11 @@ func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
|
|||
assert.Assert(c, waitRun("c1") == nil)
|
||||
|
||||
_, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
||||
assert.Assert(c, err != nil, check.Commentf("Port mapping on internal network is expected to fail"))
|
||||
assert.Assert(c, err != nil, "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")
|
||||
assert.Assert(c, err == nil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
||||
assert.Assert(c, err == nil, "Port mapping on the new network is expected to succeed")
|
||||
}
|
||||
|
|
|
@ -741,7 +741,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
|||
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1)
|
||||
|
||||
// Making sure onbridgenetwork is on the output
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on network\n"))
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), "Missing the container on network\n")
|
||||
// Filter docker ps on networks bridge and none
|
||||
out, _ = dockerCmd(c, "ps", "--filter", "network=bridge", "--filter", "network=none")
|
||||
containerOut = strings.TrimSpace(string(out))
|
||||
|
@ -755,8 +755,8 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
|||
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2)
|
||||
|
||||
// Making sure onbridgenetwork and onnonenetwork is on the output
|
||||
assert.Assert(c, strings.Contains(containerOut, "onnonenetwork"), check.Commentf("Missing the container on none network\n"))
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on bridge network\n"))
|
||||
assert.Assert(c, strings.Contains(containerOut, "onnonenetwork"), "Missing the container on none network\n")
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), "Missing the container on bridge network\n")
|
||||
nwID, _ := dockerCmd(c, "network", "inspect", "--format", "{{.ID}}", "bridge")
|
||||
|
||||
// Filter by network ID
|
||||
|
@ -780,7 +780,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
|||
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1)
|
||||
|
||||
// Making sure onbridgenetwork is on the output
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on network\n"))
|
||||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), "Missing the container on network\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsByOrder(c *testing.T) {
|
||||
|
|
|
@ -340,10 +340,10 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *testing.T) {
|
|||
// Add to revision store
|
||||
revisionDir := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "revisions", "sha256", hexDigest)
|
||||
err = os.Mkdir(revisionDir, 0755)
|
||||
assert.Assert(c, err == nil, check.Commentf("error creating revision dir"))
|
||||
assert.Assert(c, err == nil, "error creating revision dir")
|
||||
revisionPath := filepath.Join(revisionDir, "link")
|
||||
err = ioutil.WriteFile(revisionPath, []byte(manifestListDigest.String()), 0644)
|
||||
assert.Assert(c, err == nil, check.Commentf("error writing revision link"))
|
||||
assert.Assert(c, err == nil, "error writing revision link")
|
||||
|
||||
// Update tag
|
||||
tagPath := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "tags", "latest", "current", "link")
|
||||
|
|
|
@ -2291,7 +2291,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *testing.T) {
|
|||
|
||||
func (s *DockerSuite) TestRunExposePort(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
|
||||
assert.Assert(c, err != nil, check.Commentf("--expose with an invalid port should error out"))
|
||||
assert.Assert(c, err != nil, "--expose with an invalid port should error out")
|
||||
assert.Assert(c, strings.Contains(out, "invalid range format for --expose"))
|
||||
}
|
||||
|
||||
|
@ -3207,7 +3207,7 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) {
|
|||
testRequires(c, DaemonIsLinux)
|
||||
name := "unique_name"
|
||||
_, _, err := dockerCmdWithError("run", "--name", name, "--link", "nothing:nothing", "busybox")
|
||||
assert.Assert(c, err != nil, check.Commentf("Expected docker run to fail!"))
|
||||
assert.Assert(c, err != nil, "Expected docker run to fail!")
|
||||
|
||||
containerID, err := inspectFieldWithError(name, "Id")
|
||||
assert.Assert(c, err != nil, fmt.Sprintf("Expected not to have this container: %s!", containerID))
|
||||
|
|
|
@ -35,7 +35,7 @@ import (
|
|||
func (s *DockerSuite) TestRunRedirectStdout(c *testing.T) {
|
||||
checkRedirect := func(command string) {
|
||||
_, tty, err := pty.Open()
|
||||
assert.Assert(c, err == nil, check.Commentf("Could not open pty"))
|
||||
assert.Assert(c, err == nil, "Could not open pty")
|
||||
cmd := exec.Command("sh", "-c", command)
|
||||
cmd.Stdin = tty
|
||||
cmd.Stdout = tty
|
||||
|
@ -51,7 +51,7 @@ func (s *DockerSuite) TestRunRedirectStdout(c *testing.T) {
|
|||
case <-time.After(10 * time.Second):
|
||||
c.Fatal("command timeout")
|
||||
case err := <-ch:
|
||||
assert.Assert(c, err == nil, check.Commentf("wait err"))
|
||||
assert.Assert(c, err == nil, "wait err")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
|||
defer f.Close()
|
||||
|
||||
out, _ := dockerCmd(c, "run", "--name", "test-data", "--volume", fmt.Sprintf("%s:/tmp:ro", tmpDir), "busybox:latest", "ls", "/tmp/tmpfs")
|
||||
assert.Assert(c, strings.Contains(out, filepath.Base(f.Name())), check.Commentf("Recursive bind mount test failed. Expected file not found"))
|
||||
assert.Assert(c, strings.Contains(out, filepath.Base(f.Name())), "Recursive bind mount test failed. Expected file not found")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
||||
|
@ -88,9 +88,9 @@ func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
|||
}
|
||||
|
||||
out, _ := dockerCmd(c, "run", "--device", "/dev/snd:/dev/snd", "busybox", "sh", "-c", "ls /dev/snd/")
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "timer"), check.Commentf("expected output /dev/snd/timer"))
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "timer"), "expected output /dev/snd/timer")
|
||||
out, _ = dockerCmd(c, "run", "--device", "/dev/snd:/dev/othersnd", "busybox", "sh", "-c", "ls /dev/othersnd/")
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "seq"), check.Commentf("expected output /dev/othersnd/seq"))
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "seq"), "expected output /dev/othersnd/seq")
|
||||
}
|
||||
|
||||
// TestRunAttachDetach checks attaching and detaching with the default escape sequence.
|
||||
|
@ -136,7 +136,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *testing.T) {
|
|||
}
|
||||
|
||||
running := inspectField(c, name, "State.Running")
|
||||
assert.Equal(c, running, "true", check.Commentf("expected container to still be running"))
|
||||
assert.Equal(c, running, "true", "expected container to still be running")
|
||||
|
||||
out, _ = dockerCmd(c, "events", "--since=0", "--until", daemonUnixTime(c), "-f", "container="+name)
|
||||
// attach and detach event should be monitored
|
||||
|
@ -202,7 +202,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
|||
}
|
||||
|
||||
running := inspectField(c, name, "State.Running")
|
||||
assert.Equal(c, running, "true", check.Commentf("expected container to still be running"))
|
||||
assert.Equal(c, running, "true", "expected container to still be running")
|
||||
}
|
||||
|
||||
// TestRunAttachDetachFromInvalidFlag checks attaching and detaching with the escape sequence specified via flags.
|
||||
|
@ -318,7 +318,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *testing.T) {
|
|||
}
|
||||
|
||||
running := inspectField(c, name, "State.Running")
|
||||
assert.Equal(c, running, "true", check.Commentf("expected container to still be running"))
|
||||
assert.Equal(c, running, "true", "expected container to still be running")
|
||||
}
|
||||
|
||||
// TestRunAttachDetachKeysOverrideConfig checks attaching and detaching with the detach flags, making sure it overrides config file
|
||||
|
@ -401,7 +401,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) {
|
|||
}
|
||||
|
||||
running := inspectField(c, name, "State.Running")
|
||||
assert.Equal(c, running, "true", check.Commentf("expected container to still be running"))
|
||||
assert.Equal(c, running, "true", "expected container to still be running")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing.T) {
|
||||
|
@ -695,11 +695,11 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
|
|||
out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "")
|
||||
expected := "Minimum memory limit can not be less than memory reservation limit"
|
||||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), check.Commentf("run container should fail with invalid memory reservation"))
|
||||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation")
|
||||
out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "")
|
||||
expected = "Minimum memory reservation allowed is 4MB"
|
||||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), check.Commentf("run container should fail with invalid memory reservation"))
|
||||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
||||
|
@ -711,7 +711,7 @@ func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
|||
dockerCmd(c, "stop", containerID)
|
||||
out, _ = dockerCmd(c, "logs", containerID)
|
||||
|
||||
assert.Assert(c, strings.Contains(out, "exit trapped"), check.Commentf("Expected `exit trapped` in the log"))
|
||||
assert.Assert(c, strings.Contains(out, "exit trapped"), "Expected `exit trapped` in the log")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) {
|
||||
|
@ -1386,14 +1386,14 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *testing.T) {
|
|||
|
||||
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23
|
||||
out, _ := dockerCmd(c, "run", "--device", symZero+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), "expected output bb7df04e1b0a2570657527a7e108ae23")
|
||||
// symlink "tmpDir/file" to a file "tmpDir/temp" will result in an error as it is not a device.
|
||||
out, _, err = dockerCmdWithError("run", "--device", symFile+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "not a device node"), check.Commentf("expected output 'not a device node'"))
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "not a device node"), "expected output 'not a device node'")
|
||||
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 (this time check with relative path backed, see #22271)
|
||||
out, _ = dockerCmd(c, "run", "--device", "/dev/symzero:/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
||||
assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), "expected output bb7df04e1b0a2570657527a7e108ae23")
|
||||
}
|
||||
|
||||
// TestRunPIDsLimit makes sure the pids cgroup is set with --pids-limit
|
||||
|
|
|
@ -129,8 +129,8 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
|||
cleanedShortImageID := strings.TrimSpace(out)
|
||||
|
||||
// Make sure IDs are not empty
|
||||
assert.Assert(c, cleanedLongImageID != "", check.Commentf("Id should not be empty."))
|
||||
assert.Assert(c, cleanedShortImageID != "", check.Commentf("Id should not be empty."))
|
||||
assert.Assert(c, cleanedLongImageID != "", "Id should not be empty.")
|
||||
assert.Assert(c, cleanedShortImageID != "", "Id should not be empty.")
|
||||
|
||||
saveCmd := exec.Command(dockerBinary, "save", cleanedShortImageID)
|
||||
tarCmd := exec.Command("tar", "t")
|
||||
|
|
|
@ -63,7 +63,7 @@ func countLogLines(d *daemon.Daemon, name string) func(*testing.T) (interface{},
|
|||
// an array containing emptystring. a valid log line will NEVER be
|
||||
// emptystring because we ask for the timestamp.
|
||||
if result.Stdout() == "" {
|
||||
return 0, check.Commentf("Empty stdout")
|
||||
return 0, "Empty stdout"
|
||||
}
|
||||
lines := strings.Split(strings.TrimSpace(result.Stdout()), "\n")
|
||||
return len(lines), fmt.Sprintf("output, %q", string(result.Stdout()))
|
||||
|
|
|
@ -182,7 +182,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
|
|||
containers := d.ActiveContainers(c)
|
||||
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.Hostname}}", containers[0])
|
||||
assert.NilError(c, err, out)
|
||||
assert.Equal(c, strings.Split(out, "\n")[0], "test-1-"+strings.Split(hostname, "\n")[0], check.Commentf("hostname with templating invalid"))
|
||||
assert.Equal(c, strings.Split(out, "\n")[0], "test-1-"+strings.Split(hostname, "\n")[0], "hostname with templating invalid")
|
||||
}
|
||||
|
||||
// Test case for #24270
|
||||
|
@ -1223,7 +1223,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
|||
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
||||
return certs[0].Subject.OrganizationalUnit[0], nil
|
||||
}
|
||||
return "", check.Commentf("could not get organizational unit from certificate")
|
||||
return "", "could not get organizational unit from certificate"
|
||||
}, checker.Equals, "swarm-worker")
|
||||
|
||||
// by now, it should *never* be locked on restart
|
||||
|
|
|
@ -56,8 +56,8 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
|||
// check that the created directory is owned by remapped uid:gid
|
||||
statNotExists, err := system.Stat(tmpDirNotExists)
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, statNotExists.UID(), uint32(uid), check.Commentf("Created directory not owned by remapped root UID"))
|
||||
assert.Equal(c, statNotExists.GID(), uint32(gid), check.Commentf("Created directory not owned by remapped root GID"))
|
||||
assert.Equal(c, statNotExists.UID(), uint32(uid), "Created directory not owned by remapped root UID")
|
||||
assert.Equal(c, statNotExists.GID(), uint32(gid), "Created directory not owned by remapped root GID")
|
||||
|
||||
pid, err := s.d.Cmd("inspect", "--format={{.State.Pid}}", "userns")
|
||||
assert.Assert(c, err == nil, fmt.Sprintf("Could not inspect running container: out: %q", pid))
|
||||
|
@ -76,8 +76,8 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
|||
// check that the touched file is owned by remapped uid:gid
|
||||
stat, err := system.Stat(filepath.Join(tmpDir, "testfile"))
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, stat.UID(), uint32(uid), check.Commentf("Touched file not owned by remapped root UID"))
|
||||
assert.Equal(c, stat.GID(), uint32(gid), check.Commentf("Touched file not owned by remapped root GID"))
|
||||
assert.Equal(c, stat.UID(), uint32(uid), "Touched file not owned by remapped root UID")
|
||||
assert.Equal(c, stat.GID(), uint32(gid), "Touched file not owned by remapped root GID")
|
||||
|
||||
// use host usernamespace
|
||||
out, err = s.d.Cmd("run", "-d", "--name", "userns_skip", "--userns", "host", "busybox", "sh", "-c", "touch /goofy/testfile; top")
|
||||
|
|
|
@ -37,7 +37,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) {
|
||||
assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run() != nil, check.Commentf("volume inspect should error on non-existent volume"))
|
||||
assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run() != nil, "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)
|
||||
|
@ -134,35 +134,35 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
|||
out, _ := dockerCmd(c, "volume", "ls")
|
||||
|
||||
// No filter, all volumes should show
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), "expected volume 'testisinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), "expected volume 'testisinuse2' in output")
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=false")
|
||||
|
||||
// Explicitly disabling dangling
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), "expected volume 'testisinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), "expected volume 'testisinuse2' in output")
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=true")
|
||||
|
||||
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected"))
|
||||
assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected"))
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1")
|
||||
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected"))
|
||||
assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected"))
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0")
|
||||
// dangling=0 is same as dangling=false case
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), "expected volume 'testisinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), "expected volume 'testisinuse2' in output")
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "name=testisin")
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
||||
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse1\n"), "expected volume 'testisinuse1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), "expected volume 'testisinuse2' in output")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
||||
|
@ -201,11 +201,11 @@ func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
|||
dockerCmd(c, "rm", "-f", "test")
|
||||
|
||||
out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":"+prefix+"/foo", "busybox", "sh", "-c", "cat /foo/bar")
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello", check.Commentf("volume data was removed"))
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello", "volume data was removed")
|
||||
dockerCmd(c, "rm", "test2")
|
||||
|
||||
dockerCmd(c, "volume", "rm", volumeID)
|
||||
assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run() != nil, check.Commentf("volume rm should fail with non-existent volume"))
|
||||
assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run() != nil, "volume rm should fail with non-existent volume")
|
||||
}
|
||||
|
||||
// FIXME(vdemeester) should be a unit test in cli/command/volume package
|
||||
|
@ -316,13 +316,13 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
|||
out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo")
|
||||
|
||||
// filter with label=key
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-2\n"), check.Commentf("expected volume 'testvolcreatelabel-2' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), "expected volume 'testvolcreatelabel-1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-2\n"), "expected volume 'testvolcreatelabel-2' in output")
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=bar1")
|
||||
|
||||
// filter with label=key=value
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
||||
assert.Assert(c, !strings.Contains(out, "testvolcreatelabel-2\n"), check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), "expected volume 'testvolcreatelabel-1' in output")
|
||||
assert.Assert(c, !strings.Contains(out, "testvolcreatelabel-2\n"), "expected volume 'testvolcreatelabel-2 in output")
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=non-exist")
|
||||
outArr := strings.Split(strings.TrimSpace(out), "\n")
|
||||
assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
||||
|
@ -344,8 +344,8 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
|||
|
||||
// filter with driver=local
|
||||
out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local")
|
||||
assert.Assert(c, strings.Contains(out, "testvol-1\n"), check.Commentf("expected volume 'testvol-1' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testvol-2\n"), check.Commentf("expected volume 'testvol-2' in output"))
|
||||
assert.Assert(c, strings.Contains(out, "testvol-1\n"), "expected volume 'testvol-1' in output")
|
||||
assert.Assert(c, strings.Contains(out, "testvol-2\n"), "expected volume 'testvol-2' in output")
|
||||
// filter with driver=invaliddriver
|
||||
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=invaliddriver")
|
||||
outArr := strings.Split(strings.TrimSpace(out), "\n")
|
||||
|
|
|
@ -264,7 +264,7 @@ func daemonTime(c *testing.T) time.Time {
|
|||
assert.NilError(c, err)
|
||||
|
||||
dt, err := time.Parse(time.RFC3339Nano, info.SystemTime)
|
||||
assert.Assert(c, err == nil, check.Commentf("invalid time format in GET /info response"))
|
||||
assert.Assert(c, err == nil, "invalid time format in GET /info response")
|
||||
return dt
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue