sed -E -i 's#\bcheck.Commentf\(([^,]+),(.*)\)#fmt.Sprintf(\1,\2)#g' \
-- "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_create_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_images_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_netmode_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_rmi_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_create_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_start_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_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit a2024a547092109a9c9dd9b224a586a777c4824d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -95,7 +95,7 @@ func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, check.Com
|
| 95 | 95 |
if len(strings.TrimSpace(out)) == 0 {
|
| 96 | 96 |
return 0, nil |
| 97 | 97 |
} |
| 98 |
- return len(strings.Split(strings.TrimSpace(out), "\n")), check.Commentf("output: %q", string(out))
|
|
| 98 |
+ return len(strings.Split(strings.TrimSpace(out), "\n")), fmt.Sprintf("output: %q", string(out))
|
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
// WaitRun waits for a container to be running for 10s |
| ... | ... |
@@ -70,10 +70,10 @@ func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface |
| 70 | 70 |
apiclient := d.NewClientT(c) |
| 71 | 71 |
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) |
| 72 | 72 |
if client.IsErrNotFound(err) {
|
| 73 |
- return false, check.Commentf("%v", err)
|
|
| 73 |
+ return false, fmt.Sprintf("%v", err)
|
|
| 74 | 74 |
} |
| 75 | 75 |
assert.NilError(c, err) |
| 76 |
- return resp.Enabled, check.Commentf("%+v", resp)
|
|
| 76 |
+ return resp.Enabled, fmt.Sprintf("%+v", resp)
|
|
| 77 | 77 |
} |
| 78 | 78 |
} |
| 79 | 79 |
|
| ... | ... |
@@ -83,10 +83,10 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
|
| 83 | 83 |
apiclient := d.NewClientT(c) |
| 84 | 84 |
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) |
| 85 | 85 |
if client.IsErrNotFound(err) {
|
| 86 |
- return false, check.Commentf("%v", err)
|
|
| 86 |
+ return false, fmt.Sprintf("%v", err)
|
|
| 87 | 87 |
} |
| 88 | 88 |
assert.NilError(c, err) |
| 89 |
- return resp.PluginReference, check.Commentf("%+v", resp)
|
|
| 89 |
+ return resp.PluginReference, fmt.Sprintf("%+v", resp)
|
|
| 90 | 90 |
} |
| 91 | 91 |
} |
| 92 | 92 |
|
| ... | ... |
@@ -405,12 +405,12 @@ func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
| 405 | 405 |
// sort by comm[andline] to make sure order stays the same in case of PID rollover |
| 406 | 406 |
top, err := cli.ContainerTop(context.Background(), id, []string{"aux", "--sort=comm"})
|
| 407 | 407 |
assert.NilError(c, err) |
| 408 |
- assert.Equal(c, len(top.Titles), 11, check.Commentf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles))
|
|
| 408 |
+ assert.Equal(c, len(top.Titles), 11, fmt.Sprintf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles))
|
|
| 409 | 409 |
|
| 410 | 410 |
if top.Titles[0] != "USER" || top.Titles[10] != "COMMAND" {
|
| 411 | 411 |
c.Fatalf("expected `USER` at `Titles[0]` and `COMMAND` at Titles[10]: %v", top.Titles)
|
| 412 | 412 |
} |
| 413 |
- assert.Equal(c, len(top.Processes), 2, check.Commentf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 413 |
+ assert.Equal(c, len(top.Processes), 2, fmt.Sprintf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 414 | 414 |
assert.Equal(c, top.Processes[0][10], "/bin/sh -c top") |
| 415 | 415 |
assert.Equal(c, top.Processes[1][10], "top") |
| 416 | 416 |
} |
| ... | ... |
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestContainerAPICommit(c *testing.T) {
|
| 462 | 462 |
assert.NilError(c, err) |
| 463 | 463 |
|
| 464 | 464 |
cmd := inspectField(c, img.ID, "Config.Cmd") |
| 465 |
- assert.Equal(c, cmd, "[/bin/sh -c touch /test]", check.Commentf("got wrong Cmd from commit: %q", cmd))
|
|
| 465 |
+ assert.Equal(c, cmd, "[/bin/sh -c touch /test]", fmt.Sprintf("got wrong Cmd from commit: %q", cmd))
|
|
| 466 | 466 |
|
| 467 | 467 |
// sanity check, make sure the image is what we think it is |
| 468 | 468 |
dockerCmd(c, "run", img.ID, "ls", "/test") |
| ... | ... |
@@ -494,7 +494,7 @@ func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
| 494 | 494 |
assert.Equal(c, label2, "value2") |
| 495 | 495 |
|
| 496 | 496 |
cmd := inspectField(c, img.ID, "Config.Cmd") |
| 497 |
- assert.Equal(c, cmd, "[/bin/sh -c touch /test]", check.Commentf("got wrong Cmd from commit: %q", cmd))
|
|
| 497 |
+ assert.Equal(c, cmd, "[/bin/sh -c touch /test]", fmt.Sprintf("got wrong Cmd from commit: %q", cmd))
|
|
| 498 | 498 |
|
| 499 | 499 |
// sanity check, make sure the image is what we think it is |
| 500 | 500 |
dockerCmd(c, "run", img.ID, "ls", "/test") |
| ... | ... |
@@ -903,7 +903,7 @@ func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
|
| 903 | 903 |
assert.NilError(c, err) |
| 904 | 904 |
|
| 905 | 905 |
state := inspectField(c, name, "State.Running") |
| 906 |
- assert.Equal(c, state, "false", check.Commentf("got wrong State from container %s: %q", name, state))
|
|
| 906 |
+ assert.Equal(c, state, "false", fmt.Sprintf("got wrong State from container %s: %q", name, state))
|
|
| 907 | 907 |
} |
| 908 | 908 |
|
| 909 | 909 |
func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) {
|
| ... | ... |
@@ -1231,7 +1231,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
|
| 1231 | 1231 |
assert.NilError(c, err) |
| 1232 | 1232 |
|
| 1233 | 1233 |
_, err = os.Stat(source) |
| 1234 |
- assert.Assert(c, os.IsNotExist(err), check.Commentf("expected to get ErrNotExist error, got %v", err))
|
|
| 1234 |
+ assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("expected to get ErrNotExist error, got %v", err))
|
|
| 1235 | 1235 |
} |
| 1236 | 1236 |
|
| 1237 | 1237 |
// Regression test for https://github.com/docker/docker/issues/6231 |
| ... | ... |
@@ -124,7 +124,7 @@ func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *testing.T) {
|
| 124 | 124 |
assert.NilError(c, err) |
| 125 | 125 |
|
| 126 | 126 |
b, err := request.ReadBody(body) |
| 127 |
- comment := check.Commentf("response body: %s", b)
|
|
| 127 |
+ comment := fmt.Sprintf("response body: %s", b)
|
|
| 128 | 128 |
assert.NilError(c, err, comment) |
| 129 | 129 |
assert.Equal(c, resp.StatusCode, http.StatusOK, comment) |
| 130 | 130 |
} |
| ... | ... |
@@ -160,7 +160,7 @@ func (s *DockerSuite) TestExecAPIStartWithDetach(c *testing.T) {
|
| 160 | 160 |
assert.NilError(c, err) |
| 161 | 161 |
|
| 162 | 162 |
b, err := request.ReadBody(body) |
| 163 |
- comment := check.Commentf("response body: %s", b)
|
|
| 163 |
+ comment := fmt.Sprintf("response body: %s", b)
|
|
| 164 | 164 |
assert.NilError(c, err, comment) |
| 165 | 165 |
|
| 166 | 166 |
resp, _, err := request.Get("/_ping")
|
| ... | ... |
@@ -19,7 +19,7 @@ func (s *DockerSwarmSuite) TestAPISwarmListNodes(c *testing.T) {
|
| 19 | 19 |
d3 := s.AddDaemon(c, true, false) |
| 20 | 20 |
|
| 21 | 21 |
nodes := d1.ListNodes(c) |
| 22 |
- assert.Equal(c, len(nodes), 3, check.Commentf("nodes: %#v", nodes))
|
|
| 22 |
+ assert.Equal(c, len(nodes), 3, fmt.Sprintf("nodes: %#v", nodes))
|
|
| 23 | 23 |
|
| 24 | 24 |
loop0: |
| 25 | 25 |
for _, n := range nodes {
|
| ... | ... |
@@ -52,7 +52,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *testing.T) {
|
| 52 | 52 |
_ = s.AddDaemon(c, true, false) |
| 53 | 53 |
|
| 54 | 54 |
nodes := d1.ListNodes(c) |
| 55 |
- assert.Equal(c, len(nodes), 3, check.Commentf("nodes: %#v", nodes))
|
|
| 55 |
+ assert.Equal(c, len(nodes), 3, fmt.Sprintf("nodes: %#v", nodes))
|
|
| 56 | 56 |
|
| 57 | 57 |
// Getting the info so we can take the NodeID |
| 58 | 58 |
d2Info := d2.SwarmInfo(c) |
| ... | ... |
@@ -61,7 +61,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *testing.T) {
|
| 61 | 61 |
d1.RemoveNode(c, d2Info.NodeID, true) |
| 62 | 62 |
|
| 63 | 63 |
nodes = d1.ListNodes(c) |
| 64 |
- assert.Equal(c, len(nodes), 2, check.Commentf("nodes: %#v", nodes))
|
|
| 64 |
+ assert.Equal(c, len(nodes), 2, fmt.Sprintf("nodes: %#v", nodes))
|
|
| 65 | 65 |
|
| 66 | 66 |
// Restart the node that was removed |
| 67 | 67 |
d2.RestartNode(c) |
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *testing.T) {
|
| 71 | 71 |
|
| 72 | 72 |
// Make sure the node didn't rejoin |
| 73 | 73 |
nodes = d1.ListNodes(c) |
| 74 |
- assert.Equal(c, len(nodes), 2, check.Commentf("nodes: %#v", nodes))
|
|
| 74 |
+ assert.Equal(c, len(nodes), 2, fmt.Sprintf("nodes: %#v", nodes))
|
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
func (s *DockerSwarmSuite) TestAPISwarmNodeDrainPause(c *testing.T) {
|
| ... | ... |
@@ -226,7 +226,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
|
| 226 | 226 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
| 227 | 227 |
certBytes, err := ioutil.ReadFile(filepath.Join(d2.Folder, "root", "swarm", "certificates", "swarm-node.crt")) |
| 228 | 228 |
if err != nil {
|
| 229 |
- return "", check.Commentf("error: %v", err)
|
|
| 229 |
+ return "", fmt.Sprintf("error: %v", err)
|
|
| 230 | 230 |
} |
| 231 | 231 |
certs, err := helpers.ParseCertificatesPEM(certBytes) |
| 232 | 232 |
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
| ... | ... |
@@ -330,7 +330,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) {
|
| 330 | 330 |
return false |
| 331 | 331 |
}) |
| 332 | 332 |
if n == nil {
|
| 333 |
- return false, check.Commentf("failed to get node: %v", lastErr)
|
|
| 333 |
+ return false, fmt.Sprintf("failed to get node: %v", lastErr)
|
|
| 334 | 334 |
} |
| 335 | 335 |
if n.ManagerStatus.Leader {
|
| 336 | 336 |
leader = d |
| ... | ... |
@@ -343,7 +343,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) {
|
| 343 | 343 |
return false, check.Commentf("no leader elected")
|
| 344 | 344 |
} |
| 345 | 345 |
|
| 346 |
- return true, check.Commentf("elected %v", leader.ID())
|
|
| 346 |
+ return true, fmt.Sprintf("elected %v", leader.ID())
|
|
| 347 | 347 |
} |
| 348 | 348 |
} |
| 349 | 349 |
|
| ... | ... |
@@ -761,7 +761,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 761 | 761 |
} |
| 762 | 762 |
nn := d.GetNode(c, n.ID) |
| 763 | 763 |
n = *nn |
| 764 |
- return n.Status.State == swarm.NodeStateReady, check.Commentf("state of node %s, reported by %s", n.ID, d.NodeID())
|
|
| 764 |
+ return n.Status.State == swarm.NodeStateReady, fmt.Sprintf("state of node %s, reported by %s", n.ID, d.NodeID())
|
|
| 765 | 765 |
} |
| 766 | 766 |
waitAndAssert(c, defaultReconciliationTimeout, waitReady, checker.True) |
| 767 | 767 |
|
| ... | ... |
@@ -771,7 +771,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 771 | 771 |
} |
| 772 | 772 |
nn := d.GetNode(c, n.ID) |
| 773 | 773 |
n = *nn |
| 774 |
- return n.Spec.Availability == swarm.NodeAvailabilityActive, check.Commentf("availability of node %s, reported by %s", n.ID, d.NodeID())
|
|
| 774 |
+ return n.Spec.Availability == swarm.NodeAvailabilityActive, fmt.Sprintf("availability of node %s, reported by %s", n.ID, d.NodeID())
|
|
| 775 | 775 |
} |
| 776 | 776 |
waitAndAssert(c, defaultReconciliationTimeout, waitActive, checker.True) |
| 777 | 777 |
|
| ... | ... |
@@ -52,7 +52,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) {
|
| 52 | 52 |
case err := <-errChan: |
| 53 | 53 |
tty.Close() |
| 54 | 54 |
out, _ := ioutil.ReadAll(pty) |
| 55 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", string(out)))
|
|
| 55 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", string(out)))
|
|
| 56 | 56 |
case <-time.After(attachWait): |
| 57 | 57 |
c.Fatal("timed out without attach returning")
|
| 58 | 58 |
} |
| ... | ... |
@@ -4739,7 +4739,7 @@ func (s *DockerSuite) TestBuildTagEvent(c *testing.T) {
|
| 4739 | 4739 |
} |
| 4740 | 4740 |
} |
| 4741 | 4741 |
|
| 4742 |
- assert.Assert(c, foundTag, check.Commentf("No tag event found:\n%s", out))
|
|
| 4742 |
+ assert.Assert(c, foundTag, fmt.Sprintf("No tag event found:\n%s", out))
|
|
| 4743 | 4743 |
} |
| 4744 | 4744 |
|
| 4745 | 4745 |
// #15780 |
| ... | ... |
@@ -151,8 +151,8 @@ func (s *DockerRegistrySuite) TestRunByDigest(c *testing.T) {
|
| 151 | 151 |
|
| 152 | 152 |
foundRegex := regexp.MustCompile("found=([^\n]+)")
|
| 153 | 153 |
matches := foundRegex.FindStringSubmatch(out) |
| 154 |
- assert.Equal(c, len(matches), 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 155 |
- assert.Equal(c, matches[1], "1", check.Commentf("Expected %q, got %q", "1", matches[1]))
|
|
| 154 |
+ assert.Equal(c, len(matches), 2, fmt.Sprintf("unable to parse digest from pull output: %s", out))
|
|
| 155 |
+ assert.Equal(c, matches[1], "1", fmt.Sprintf("Expected %q, got %q", "1", matches[1]))
|
|
| 156 | 156 |
|
| 157 | 157 |
res := inspectField(c, containerName, "Config.Image") |
| 158 | 158 |
assert.Equal(c, res, imageReference) |
| ... | ... |
@@ -253,7 +253,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
|
| 253 | 253 |
|
| 254 | 254 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 255 | 255 |
re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`) |
| 256 |
- assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 256 |
+ assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out))
|
|
| 257 | 257 |
// setup image2 |
| 258 | 258 |
digest2, err := setupImageWithTag(c, "tag2") |
| 259 | 259 |
//error setting up image |
| ... | ... |
@@ -271,11 +271,11 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
|
| 271 | 271 |
out, _ = dockerCmd(c, "images", "--digests") |
| 272 | 272 |
|
| 273 | 273 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 274 |
- assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 274 |
+ assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out))
|
|
| 275 | 275 |
|
| 276 | 276 |
// make sure repo shown, tag=<none>, digest = $digest2 |
| 277 | 277 |
re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`) |
| 278 |
- assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 278 |
+ assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out))
|
|
| 279 | 279 |
|
| 280 | 280 |
// pull tag1 |
| 281 | 281 |
dockerCmd(c, "pull", repoName+":tag1") |
| ... | ... |
@@ -285,9 +285,9 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
|
| 285 | 285 |
|
| 286 | 286 |
// make sure image 1 has repo, tag, <none> AND repo, <none>, digest |
| 287 | 287 |
reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*tag1\s*` + digest1.String() + `\s`) |
| 288 |
- assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 288 |
+ assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 289 | 289 |
// make sure image 2 has repo, <none>, digest |
| 290 |
- assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 290 |
+ assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out))
|
|
| 291 | 291 |
|
| 292 | 292 |
// pull tag 2 |
| 293 | 293 |
dockerCmd(c, "pull", repoName+":tag2") |
| ... | ... |
@@ -296,22 +296,22 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
|
| 296 | 296 |
out, _ = dockerCmd(c, "images", "--digests") |
| 297 | 297 |
|
| 298 | 298 |
// make sure image 1 has repo, tag, digest |
| 299 |
- assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 299 |
+ assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 300 | 300 |
|
| 301 | 301 |
// make sure image 2 has repo, tag, digest |
| 302 | 302 |
reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*tag2\s*` + digest2.String() + `\s`) |
| 303 |
- assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 303 |
+ assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 304 | 304 |
|
| 305 | 305 |
// list images |
| 306 | 306 |
out, _ = dockerCmd(c, "images", "--digests") |
| 307 | 307 |
|
| 308 | 308 |
// make sure image 1 has repo, tag, digest |
| 309 |
- assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 309 |
+ assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 310 | 310 |
// make sure image 2 has repo, tag, digest |
| 311 |
- assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 311 |
+ assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 312 | 312 |
// make sure busybox has tag, but not digest |
| 313 | 313 |
busyboxRe := regexp.MustCompile(`\s*busybox\s*latest\s*<none>\s`) |
| 314 |
- assert.Assert(c, busyboxRe.MatchString(out), check.Commentf("expected %q: %s", busyboxRe.String(), out))
|
|
| 314 |
+ assert.Assert(c, busyboxRe.MatchString(out), fmt.Sprintf("expected %q: %s", busyboxRe.String(), out))
|
|
| 315 | 315 |
} |
| 316 | 316 |
|
| 317 | 317 |
func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| ... | ... |
@@ -329,7 +329,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| 329 | 329 |
|
| 330 | 330 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 331 | 331 |
re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`) |
| 332 |
- assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 332 |
+ assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out))
|
|
| 333 | 333 |
// setup image2 |
| 334 | 334 |
digest2, err := setupImageWithTag(c, "dangle2") |
| 335 | 335 |
//error setting up image |
| ... | ... |
@@ -347,11 +347,11 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| 347 | 347 |
out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true") |
| 348 | 348 |
|
| 349 | 349 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 350 |
- assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 350 |
+ assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out))
|
|
| 351 | 351 |
|
| 352 | 352 |
// make sure repo shown, tag=<none>, digest = $digest2 |
| 353 | 353 |
re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`) |
| 354 |
- assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 354 |
+ assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out))
|
|
| 355 | 355 |
|
| 356 | 356 |
// pull dangle1 tag |
| 357 | 357 |
dockerCmd(c, "pull", repoName+":dangle1") |
| ... | ... |
@@ -361,9 +361,9 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| 361 | 361 |
|
| 362 | 362 |
// make sure image 1 has repo, tag, <none> AND repo, <none>, digest |
| 363 | 363 |
reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*dangle1\s*` + digest1.String() + `\s`) |
| 364 |
- assert.Assert(c, !reWithDigest1.MatchString(out), check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 364 |
+ assert.Assert(c, !reWithDigest1.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 365 | 365 |
// make sure image 2 has repo, <none>, digest |
| 366 |
- assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 366 |
+ assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out))
|
|
| 367 | 367 |
|
| 368 | 368 |
// pull dangle2 tag |
| 369 | 369 |
dockerCmd(c, "pull", repoName+":dangle2") |
| ... | ... |
@@ -372,19 +372,19 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| 372 | 372 |
out, _ = dockerCmd(c, "images", "--digests") |
| 373 | 373 |
|
| 374 | 374 |
// make sure image 1 has repo, tag, digest |
| 375 |
- assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 375 |
+ assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 376 | 376 |
|
| 377 | 377 |
// make sure image 2 has repo, tag, digest |
| 378 | 378 |
reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*dangle2\s*` + digest2.String() + `\s`) |
| 379 |
- assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 379 |
+ assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 380 | 380 |
|
| 381 | 381 |
// list images, no longer dangling, should not match |
| 382 | 382 |
out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true") |
| 383 | 383 |
|
| 384 | 384 |
// make sure image 1 has repo, tag, digest |
| 385 |
- assert.Assert(c, !reWithDigest1.MatchString(out), check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 385 |
+ assert.Assert(c, !reWithDigest1.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 386 | 386 |
// make sure image 2 has repo, tag, digest |
| 387 |
- assert.Assert(c, !reWithDigest2.MatchString(out), check.Commentf("unexpected %q: %s", reWithDigest2.String(), out))
|
|
| 387 |
+ assert.Assert(c, !reWithDigest2.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest2.String(), out))
|
|
| 388 | 388 |
} |
| 389 | 389 |
|
| 390 | 390 |
func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) {
|
| ... | ... |
@@ -644,7 +644,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
|
| 644 | 644 |
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
| 645 | 645 |
|
| 646 | 646 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 647 |
- assert.Assert(c, strings.Contains(out, expectedErrorMsg), check.Commentf("expected error message in output: %s", out))
|
|
| 647 |
+ assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out))
|
|
| 648 | 648 |
} |
| 649 | 649 |
|
| 650 | 650 |
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when |
| ... | ... |
@@ -687,5 +687,5 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) |
| 687 | 687 |
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
| 688 | 688 |
|
| 689 | 689 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 690 |
- assert.Assert(c, strings.Contains(out, expectedErrorMsg), check.Commentf("expected error message in output: %s", out))
|
|
| 690 |
+ assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out))
|
|
| 691 | 691 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
| 72 | 72 |
chunks := strings.Split(strings.TrimSpace(firstOutput), " ") |
| 73 | 73 |
inode := chunks[0] |
| 74 | 74 |
chunks = strings.SplitAfterN(strings.TrimSpace(firstOutput), " ", 2) |
| 75 |
- assert.Assert(c, strings.Contains(chunks[1], chunks[0]), check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 75 |
+ assert.Assert(c, strings.Contains(chunks[1], chunks[0]), fmt.Sprintf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 76 | 76 |
imageID, _ := dockerCmd(c, "commit", "hardlinks", "hardlinks") |
| 77 | 77 |
imageID = strings.TrimSpace(imageID) |
| 78 | 78 |
|
| ... | ... |
@@ -81,7 +81,7 @@ func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
| 81 | 81 |
chunks = strings.Split(strings.TrimSpace(secondOutput), " ") |
| 82 | 82 |
inode = chunks[0] |
| 83 | 83 |
chunks = strings.SplitAfterN(strings.TrimSpace(secondOutput), " ", 2) |
| 84 |
- assert.Assert(c, strings.Contains(chunks[1], chunks[0]), check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 84 |
+ assert.Assert(c, strings.Contains(chunks[1], chunks[0]), fmt.Sprintf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
func (s *DockerSuite) TestCommitTTY(c *testing.T) {
|
| ... | ... |
@@ -150,7 +150,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *testing.T) {
|
| 150 | 150 |
err := runDockerCp(c, srcPath, dstDir, nil) |
| 151 | 151 |
assert.ErrorContains(c, err, "") |
| 152 | 152 |
|
| 153 |
- assert.Assert(c, isCpDirNotExist(err), check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 153 |
+ assert.Assert(c, isCpDirNotExist(err), fmt.Sprintf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
// C. SRC specifies a file and DST exists as a file. This should overwrite |
| ... | ... |
@@ -195,7 +195,7 @@ func (s *DockerSuite) TestCpFromCaseD(c *testing.T) {
|
| 195 | 195 |
|
| 196 | 196 |
// Ensure that dstPath doesn't exist. |
| 197 | 197 |
_, err := os.Stat(dstPath) |
| 198 |
- assert.Assert(c, os.IsNotExist(err), check.Commentf("did not expect dstPath %q to exist", dstPath))
|
|
| 198 |
+ assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("did not expect dstPath %q to exist", dstPath))
|
|
| 199 | 199 |
|
| 200 | 200 |
assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil) == nil) |
| 201 | 201 |
|
| ... | ... |
@@ -266,7 +266,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *testing.T) {
|
| 266 | 266 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 267 | 267 |
assert.ErrorContains(c, err, "") |
| 268 | 268 |
|
| 269 |
- assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 269 |
+ assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 270 | 270 |
} |
| 271 | 271 |
|
| 272 | 272 |
// G. SRC specifies a directory and DST exists as a directory. This should copy |
| ... | ... |
@@ -358,7 +358,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *testing.T) {
|
| 358 | 358 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 359 | 359 |
assert.ErrorContains(c, err, "") |
| 360 | 360 |
|
| 361 |
- assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 361 |
+ assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 362 | 362 |
} |
| 363 | 363 |
|
| 364 | 364 |
// J. SRC specifies a directory's contents only and DST exists as a directory. |
| ... | ... |
@@ -158,7 +158,7 @@ func (s *DockerSuite) TestCpToCaseB(c *testing.T) {
|
| 158 | 158 |
err := runDockerCp(c, srcPath, dstDir, nil) |
| 159 | 159 |
assert.ErrorContains(c, err, "") |
| 160 | 160 |
|
| 161 |
- assert.Assert(c, isCpDirNotExist(err), check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 161 |
+ assert.Assert(c, isCpDirNotExist(err), fmt.Sprintf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 162 | 162 |
} |
| 163 | 163 |
|
| 164 | 164 |
// C. SRC specifies a file and DST exists as a file. This should overwrite |
| ... | ... |
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestCpToCaseF(c *testing.T) {
|
| 288 | 288 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 289 | 289 |
assert.ErrorContains(c, err, "") |
| 290 | 290 |
|
| 291 |
- assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 291 |
+ assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 292 | 292 |
} |
| 293 | 293 |
|
| 294 | 294 |
// G. SRC specifies a directory and DST exists as a directory. This should copy |
| ... | ... |
@@ -393,7 +393,7 @@ func (s *DockerSuite) TestCpToCaseI(c *testing.T) {
|
| 393 | 393 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 394 | 394 |
assert.ErrorContains(c, err, "") |
| 395 | 395 |
|
| 396 |
- assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 396 |
+ assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 397 | 397 |
} |
| 398 | 398 |
|
| 399 | 399 |
// J. SRC specifies a directory's contents only and DST exists as a directory. |
| ... | ... |
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
|
| 462 | 462 |
err := runDockerCp(c, srcPath, dstPath, nil) |
| 463 | 463 |
assert.ErrorContains(c, err, "") |
| 464 | 464 |
|
| 465 |
- assert.Assert(c, isCpCannotCopyReadOnly(err), check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
|
|
| 465 |
+ assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
|
|
| 466 | 466 |
|
| 467 | 467 |
// Ensure that dstPath doesn't exist. |
| 468 | 468 |
assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil) |
| ... | ... |
@@ -489,7 +489,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
|
| 489 | 489 |
err := runDockerCp(c, srcPath, dstPath, nil) |
| 490 | 490 |
assert.ErrorContains(c, err, "") |
| 491 | 491 |
|
| 492 |
- assert.Assert(c, isCpCannotCopyReadOnly(err), check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
|
|
| 492 |
+ assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
|
|
| 493 | 493 |
|
| 494 | 494 |
// Ensure that dstPath doesn't exist. |
| 495 | 495 |
assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil) |
| ... | ... |
@@ -37,11 +37,11 @@ func (s *DockerSuite) TestCreateArgs(c *testing.T) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
err := json.Unmarshal([]byte(out), &containers) |
| 40 |
- assert.Assert(c, err == nil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 40 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err))
|
|
| 41 | 41 |
assert.Equal(c, len(containers), 1) |
| 42 | 42 |
|
| 43 | 43 |
cont := containers[0] |
| 44 |
- assert.Equal(c, string(cont.Path), "command", check.Commentf("Unexpected container path. Expected command, received: %s", cont.Path))
|
|
| 44 |
+ assert.Equal(c, string(cont.Path), "command", fmt.Sprintf("Unexpected container path. Expected command, received: %s", cont.Path))
|
|
| 45 | 45 |
|
| 46 | 46 |
b := false |
| 47 | 47 |
expected := []string{"arg1", "arg2", "arg with space", "-c", "flags"}
|
| ... | ... |
@@ -96,12 +96,12 @@ func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
err := json.Unmarshal([]byte(out), &containers) |
| 99 |
- assert.Assert(c, err == nil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 99 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err))
|
|
| 100 | 100 |
assert.Equal(c, len(containers), 1) |
| 101 | 101 |
|
| 102 | 102 |
cont := containers[0] |
| 103 |
- assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
|
|
| 104 |
- assert.Assert(c, cont.HostConfig.PublishAllPorts, check.Commentf("Expected PublishAllPorts, got false"))
|
|
| 103 |
+ assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none"))
|
|
| 104 |
+ assert.Assert(c, cont.HostConfig.PublishAllPorts, fmt.Sprintf("Expected PublishAllPorts, got false"))
|
|
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 | 107 |
func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
| ... | ... |
@@ -117,17 +117,17 @@ func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
| 117 | 117 |
} |
| 118 | 118 |
} |
| 119 | 119 |
err := json.Unmarshal([]byte(out), &containers) |
| 120 |
- assert.Assert(c, err == nil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 120 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err))
|
|
| 121 | 121 |
assert.Equal(c, len(containers), 1) |
| 122 | 122 |
|
| 123 | 123 |
cont := containers[0] |
| 124 | 124 |
|
| 125 |
- assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
|
|
| 126 |
- assert.Equal(c, len(cont.HostConfig.PortBindings), 4, check.Commentf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
|
|
| 125 |
+ assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none"))
|
|
| 126 |
+ assert.Equal(c, len(cont.HostConfig.PortBindings), 4, fmt.Sprintf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
|
|
| 127 | 127 |
|
| 128 | 128 |
for k, v := range cont.HostConfig.PortBindings {
|
| 129 |
- assert.Equal(c, len(v), 1, check.Commentf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 130 |
- assert.Equal(c, k.Port(), v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 129 |
+ assert.Equal(c, len(v), 1, fmt.Sprintf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 130 |
+ assert.Equal(c, k.Port(), v[0].HostPort, fmt.Sprintf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 131 | 131 |
|
| 132 | 132 |
} |
| 133 | 133 |
|
| ... | ... |
@@ -147,16 +147,16 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
err := json.Unmarshal([]byte(out), &containers) |
| 150 |
- assert.Assert(c, err == nil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 150 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err))
|
|
| 151 | 151 |
assert.Equal(c, len(containers), 1) |
| 152 | 152 |
|
| 153 | 153 |
cont := containers[0] |
| 154 |
- assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
|
|
| 154 |
+ assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none"))
|
|
| 155 | 155 |
assert.Equal(c, len(cont.HostConfig.PortBindings), 65535) |
| 156 | 156 |
|
| 157 | 157 |
for k, v := range cont.HostConfig.PortBindings {
|
| 158 | 158 |
assert.Equal(c, len(v), 1) |
| 159 |
- assert.Equal(c, k.Port(), v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 159 |
+ assert.Equal(c, k.Port(), v[0].HostPort, fmt.Sprintf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 | 162 |
} |
| ... | ... |
@@ -179,7 +179,7 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) {
|
| 179 | 179 |
dockerCmd(c, "create", "--name", name, "-v", prefix+slash+"foo", "busybox") |
| 180 | 180 |
|
| 181 | 181 |
dir, err := inspectMountSourceField(name, prefix+slash+"foo") |
| 182 |
- assert.Assert(c, err == nil, check.Commentf("Error getting volume host path: %q", err))
|
|
| 182 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error getting volume host path: %q", err))
|
|
| 183 | 183 |
|
| 184 | 184 |
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
|
| 185 | 185 |
c.Fatalf("Volume was not created")
|
| ... | ... |
@@ -131,13 +131,13 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *testing.T) {
|
| 131 | 131 |
var format string |
| 132 | 132 |
for name, shouldRun := range m {
|
| 133 | 133 |
out, err := s.d.Cmd("ps")
|
| 134 |
- assert.Assert(c, err == nil, check.Commentf("run ps: %v", out))
|
|
| 134 |
+ assert.Assert(c, err == nil, fmt.Sprintf("run ps: %v", out))
|
|
| 135 | 135 |
if shouldRun {
|
| 136 | 136 |
format = "%scontainer %q is not running" |
| 137 | 137 |
} else {
|
| 138 | 138 |
format = "%scontainer %q is running" |
| 139 | 139 |
} |
| 140 |
- assert.Equal(c, strings.Contains(out, name), shouldRun, check.Commentf(format, prefix, name)) |
|
| 140 |
+ assert.Equal(c, strings.Contains(out, name), shouldRun, fmt.Sprintf(format, prefix, name)) |
|
| 141 | 141 |
} |
| 142 | 142 |
} |
| 143 | 143 |
|
| ... | ... |
@@ -217,7 +217,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) {
|
| 217 | 217 |
|
| 218 | 218 |
if newBasesizeBytes < oldBasesizeBytes {
|
| 219 | 219 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 220 |
- assert.Assert(c, err != nil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 220 |
+ assert.Assert(c, err != nil, fmt.Sprintf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 221 | 221 |
// 'err != nil' is expected behaviour, no new daemon started, |
| 222 | 222 |
// so no need to stop daemon. |
| 223 | 223 |
if err != nil {
|
| ... | ... |
@@ -241,11 +241,11 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T) |
| 241 | 241 |
} |
| 242 | 242 |
|
| 243 | 243 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 244 |
- assert.Assert(c, err == nil, check.Commentf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 244 |
+ assert.Assert(c, err == nil, fmt.Sprintf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 245 | 245 |
|
| 246 | 246 |
basesizeAfterRestart := getBaseDeviceSize(c, s.d) |
| 247 | 247 |
newBasesize, err := convertBasesize(newBasesizeBytes) |
| 248 |
- assert.Assert(c, err == nil, check.Commentf("Error in converting base device size: %v", err))
|
|
| 248 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Error in converting base device size: %v", err))
|
|
| 249 | 249 |
assert.Equal(c, newBasesize, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
| 250 | 250 |
s.d.Stop(c) |
| 251 | 251 |
} |
| ... | ... |
@@ -680,7 +680,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *testing.T) {
|
| 680 | 680 |
|
| 681 | 681 |
containerIP := d.FindContainerIP(c, "test") |
| 682 | 682 |
ip = net.ParseIP(containerIP) |
| 683 |
- assert.Equal(c, bridgeIPNet.Contains(ip), true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 683 |
+ assert.Equal(c, bridgeIPNet.Contains(ip), true, fmt.Sprintf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 684 | 684 |
deleteInterface(c, defaultNetworkBridge) |
| 685 | 685 |
} |
| 686 | 686 |
|
| ... | ... |
@@ -784,7 +784,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *testing.T) {
|
| 784 | 784 |
expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
|
| 785 | 785 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 786 | 786 |
assert.NilError(c, err, out) |
| 787 |
- assert.Equal(c, strings.Contains(out, expectedMessage), true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 787 |
+ assert.Equal(c, strings.Contains(out, expectedMessage), true, fmt.Sprintf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 788 | 788 |
deleteInterface(c, defaultNetworkBridge) |
| 789 | 789 |
} |
| 790 | 790 |
|
| ... | ... |
@@ -804,7 +804,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *testing.T) {
|
| 804 | 804 |
expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
|
| 805 | 805 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 806 | 806 |
assert.NilError(c, err, out) |
| 807 |
- assert.Equal(c, strings.Contains(out, expectedMessage), true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 807 |
+ assert.Equal(c, strings.Contains(out, expectedMessage), true, fmt.Sprintf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 808 | 808 |
deleteInterface(c, defaultNetworkBridge) |
| 809 | 809 |
} |
| 810 | 810 |
|
| ... | ... |
@@ -859,7 +859,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
|
| 859 | 859 |
result.Assert(c, icmd.Success) |
| 860 | 860 |
regex := fmt.Sprintf("DNAT.*%s.*dpt:8000", ip.String())
|
| 861 | 861 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 862 |
- assert.Equal(c, matched, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 862 |
+ assert.Equal(c, matched, true, fmt.Sprintf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 863 | 863 |
} |
| 864 | 864 |
|
| 865 | 865 |
func (s *DockerDaemonSuite) TestDaemonICCPing(c *testing.T) {
|
| ... | ... |
@@ -879,7 +879,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *testing.T) {
|
| 879 | 879 |
result.Assert(c, icmd.Success) |
| 880 | 880 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 881 | 881 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 882 |
- assert.Equal(c, matched, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 882 |
+ assert.Equal(c, matched, true, fmt.Sprintf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 883 | 883 |
// Pinging another container must fail with --icc=false |
| 884 | 884 |
pingContainers(c, d, true) |
| 885 | 885 |
|
| ... | ... |
@@ -912,7 +912,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *testing.T) {
|
| 912 | 912 |
result.Assert(c, icmd.Success) |
| 913 | 913 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 914 | 914 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 915 |
- assert.Equal(c, matched, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 915 |
+ assert.Equal(c, matched, true, fmt.Sprintf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 916 | 916 |
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
| 917 | 917 |
assert.NilError(c, err, out) |
| 918 | 918 |
|
| ... | ... |
@@ -1151,7 +1151,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *te |
| 1151 | 1151 |
RUN echo foo`), |
| 1152 | 1152 |
build.WithoutCache, |
| 1153 | 1153 |
) |
| 1154 |
- comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
|
| 1154 |
+ comment := fmt.Sprintf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
|
| 1155 | 1155 |
assert.Assert(c, result.Error == nil, comment) |
| 1156 | 1156 |
assert.Equal(c, result.ExitCode, 0, comment) |
| 1157 | 1157 |
assert.Assert(c, strings.Contains(result.Combined(), "foo"), comment) |
| ... | ... |
@@ -1750,7 +1750,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T |
| 1750 | 1750 |
break |
| 1751 | 1751 |
} |
| 1752 | 1752 |
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
|
| 1753 |
- assert.Assert(c, err == nil, check.Commentf("%s", ip))
|
|
| 1753 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", ip))
|
|
| 1754 | 1754 |
|
| 1755 | 1755 |
assert.Assert(c, ip != bridgeIP) |
| 1756 | 1756 |
cont++ |
| ... | ... |
@@ -1780,7 +1780,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
|
| 1780 | 1780 |
|
| 1781 | 1781 |
// pull a repository large enough to overfill the mounted filesystem |
| 1782 | 1782 |
pullOut, err := s.d.Cmd("pull", "debian:stretch")
|
| 1783 |
- assert.Assert(c, err != nil, check.Commentf("%s", pullOut))
|
|
| 1783 |
+ assert.Assert(c, err != nil, fmt.Sprintf("%s", pullOut))
|
|
| 1784 | 1784 |
assert.Assert(c, strings.Contains(pullOut, "no space left on device")) |
| 1785 | 1785 |
} |
| 1786 | 1786 |
|
| ... | ... |
@@ -1855,7 +1855,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) {
|
| 1855 | 1855 |
out, err := s.d.Cmd("run", "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
| 1856 | 1856 |
assert.NilError(c, err) |
| 1857 | 1857 |
cgroupPaths := ParseCgroupPaths(string(out)) |
| 1858 |
- assert.Assert(c, len(cgroupPaths) != 0, check.Commentf("unexpected output - %q", string(out)))
|
|
| 1858 |
+ assert.Assert(c, len(cgroupPaths) != 0, fmt.Sprintf("unexpected output - %q", string(out)))
|
|
| 1859 | 1859 |
out, err = s.d.Cmd("inspect", "-f", "{{.Id}}", name)
|
| 1860 | 1860 |
assert.NilError(c, err) |
| 1861 | 1861 |
id := strings.TrimSpace(string(out)) |
| ... | ... |
@@ -1867,7 +1867,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) {
|
| 1867 | 1867 |
break |
| 1868 | 1868 |
} |
| 1869 | 1869 |
} |
| 1870 |
- assert.Assert(c, found, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
|
|
| 1870 |
+ assert.Assert(c, found, fmt.Sprintf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
|
|
| 1871 | 1871 |
} |
| 1872 | 1872 |
|
| 1873 | 1873 |
func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
|
| ... | ... |
@@ -1890,7 +1890,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
|
| 1890 | 1890 |
assert.NilError(c, err, out) |
| 1891 | 1891 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 1892 | 1892 |
assert.NilError(c, err, out) |
| 1893 |
- assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, check.Commentf("%s", out))
|
|
| 1893 |
+ assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, fmt.Sprintf("%s", out))
|
|
| 1894 | 1894 |
} |
| 1895 | 1895 |
|
| 1896 | 1896 |
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {
|
| ... | ... |
@@ -2007,7 +2007,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) {
|
| 2007 | 2007 |
// the following check for mounts being cleared is pointless. |
| 2008 | 2008 |
skipMountCheck := false |
| 2009 | 2009 |
mountOut, err := ioutil.ReadFile("/proc/self/mountinfo")
|
| 2010 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", mountOut))
|
|
| 2010 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", mountOut))
|
|
| 2011 | 2011 |
if !strings.Contains(string(mountOut), id) {
|
| 2012 | 2012 |
skipMountCheck = true |
| 2013 | 2013 |
} |
| ... | ... |
@@ -2032,8 +2032,8 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) {
|
| 2032 | 2032 |
} |
| 2033 | 2033 |
// Now, container mounts should be gone. |
| 2034 | 2034 |
mountOut, err = ioutil.ReadFile("/proc/self/mountinfo")
|
| 2035 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", mountOut))
|
|
| 2036 |
- comment := check.Commentf("%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, s.d.Root, mountOut)
|
|
| 2035 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", mountOut))
|
|
| 2036 |
+ comment := fmt.Sprintf("%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, s.d.Root, mountOut)
|
|
| 2037 | 2037 |
assert.Equal(c, strings.Contains(string(mountOut), id), false, comment) |
| 2038 | 2038 |
} |
| 2039 | 2039 |
|
| ... | ... |
@@ -2363,7 +2363,7 @@ func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *testing.T) |
| 2363 | 2363 |
RUN cat /etc/hosts`), |
| 2364 | 2364 |
build.WithoutCache, |
| 2365 | 2365 |
) |
| 2366 |
- comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
|
| 2366 |
+ comment := fmt.Sprintf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
|
| 2367 | 2367 |
assert.Assert(c, result.Error == nil, comment) |
| 2368 | 2368 |
assert.Equal(c, result.ExitCode, 0, comment) |
| 2369 | 2369 |
} |
| ... | ... |
@@ -2376,11 +2376,11 @@ func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *testing.T) {
|
| 2376 | 2376 |
|
| 2377 | 2377 |
expectedOutput := "nameserver 1.2.3.4" |
| 2378 | 2378 |
out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "/etc/resolv.conf")
|
| 2379 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2379 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2380 | 2380 |
expectedOutput = "search example.com" |
| 2381 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2381 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2382 | 2382 |
expectedOutput = "options timeout:3" |
| 2383 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2383 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2384 | 2384 |
} |
| 2385 | 2385 |
|
| 2386 | 2386 |
func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| ... | ... |
@@ -2555,10 +2555,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *testing. |
| 2555 | 2555 |
|
| 2556 | 2556 |
// top1 will exist after daemon restarts |
| 2557 | 2557 |
out, err := s.d.Cmd("run", "-d", "--name", "top1", "busybox:latest", "top")
|
| 2558 |
- assert.Assert(c, err == nil, check.Commentf("run top1: %v", out))
|
|
| 2558 |
+ assert.Assert(c, err == nil, fmt.Sprintf("run top1: %v", out))
|
|
| 2559 | 2559 |
// top2 will be removed after daemon restarts |
| 2560 | 2560 |
out, err = s.d.Cmd("run", "-d", "--rm", "--name", "top2", "busybox:latest", "top")
|
| 2561 |
- assert.Assert(c, err == nil, check.Commentf("run top2: %v", out))
|
|
| 2561 |
+ assert.Assert(c, err == nil, fmt.Sprintf("run top2: %v", out))
|
|
| 2562 | 2562 |
|
| 2563 | 2563 |
out, err = s.d.Cmd("ps")
|
| 2564 | 2564 |
assert.NilError(c, err) |
| ... | ... |
@@ -2714,14 +2714,14 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *testing.T) {
|
| 2714 | 2714 |
|
| 2715 | 2715 |
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2716 | 2716 |
// uid=100(test) gid=101(test) groups=101(test) |
| 2717 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", out1))
|
|
| 2717 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out1))
|
|
| 2718 | 2718 |
|
| 2719 | 2719 |
// restart daemon. |
| 2720 | 2720 |
s.d.Restart(c, "--live-restore") |
| 2721 | 2721 |
|
| 2722 | 2722 |
out2, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2723 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", out2))
|
|
| 2724 |
- assert.Equal(c, out2, out1, check.Commentf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2723 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out2))
|
|
| 2724 |
+ assert.Equal(c, out2, out1, fmt.Sprintf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2725 | 2725 |
|
| 2726 | 2726 |
out, err = s.d.Cmd("stop", "top")
|
| 2727 | 2727 |
assert.NilError(c, err, "Output: %s", out) |
| ... | ... |
@@ -2773,7 +2773,7 @@ func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *testing.T) {
|
| 2773 | 2773 |
StartedAt time.Time |
| 2774 | 2774 |
} |
| 2775 | 2775 |
out, err = s.d.Cmd("inspect", "-f", "{{json .State}}", id)
|
| 2776 |
- assert.Assert(c, err == nil, check.Commentf("output: %s", out))
|
|
| 2776 |
+ assert.Assert(c, err == nil, fmt.Sprintf("output: %s", out))
|
|
| 2777 | 2777 |
|
| 2778 | 2778 |
var origState state |
| 2779 | 2779 |
err = json.Unmarshal([]byte(strings.TrimSpace(out)), &origState) |
| ... | ... |
@@ -2799,7 +2799,7 @@ func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *testing.T) {
|
| 2799 | 2799 |
} |
| 2800 | 2800 |
|
| 2801 | 2801 |
out, err := s.d.Cmd("inspect", "-f", "{{json .State}}", id)
|
| 2802 |
- assert.Assert(c, err == nil, check.Commentf("output: %s", out))
|
|
| 2802 |
+ assert.Assert(c, err == nil, fmt.Sprintf("output: %s", out))
|
|
| 2803 | 2803 |
|
| 2804 | 2804 |
var newState state |
| 2805 | 2805 |
err = json.Unmarshal([]byte(strings.TrimSpace(out)), &newState) |
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *testing.T) |
| 304 | 304 |
p := hostVolumePath("external-volume-test")
|
| 305 | 305 |
_, err = os.Lstat(p) |
| 306 | 306 |
assert.ErrorContains(c, err, "") |
| 307 |
- assert.Assert(c, os.IsNotExist(err), check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
|
|
| 307 |
+ assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("Expected volume path in host to not exist: %s, %v\n", p, err))
|
|
| 308 | 308 |
|
| 309 | 309 |
assert.Equal(c, s.ec.activations, 1) |
| 310 | 310 |
assert.Equal(c, s.ec.creations, 1) |
| ... | ... |
@@ -449,7 +449,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c |
| 449 | 449 |
} |
| 450 | 450 |
out := inspectFieldJSON(c, "testing", "Mounts") |
| 451 | 451 |
assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts) == nil) |
| 452 |
- assert.Equal(c, len(mounts), 1, check.Commentf("%s", out))
|
|
| 452 |
+ assert.Equal(c, len(mounts), 1, fmt.Sprintf("%s", out))
|
|
| 453 | 453 |
assert.Equal(c, mounts[0].Name, "foo") |
| 454 | 454 |
assert.Equal(c, mounts[0].Driver, volumePluginName) |
| 455 | 455 |
} |
| ... | ... |
@@ -458,10 +458,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *testing.T) {
|
| 458 | 458 |
dockerCmd(c, "volume", "create", "-d", volumePluginName, "abc3") |
| 459 | 459 |
out, _ := dockerCmd(c, "volume", "ls") |
| 460 | 460 |
ls := strings.Split(strings.TrimSpace(out), "\n") |
| 461 |
- assert.Equal(c, len(ls), 2, check.Commentf("\n%s", out))
|
|
| 461 |
+ assert.Equal(c, len(ls), 2, fmt.Sprintf("\n%s", out))
|
|
| 462 | 462 |
|
| 463 | 463 |
vol := strings.Fields(ls[len(ls)-1]) |
| 464 |
- assert.Equal(c, len(vol), 2, check.Commentf("%v", vol))
|
|
| 464 |
+ assert.Equal(c, len(vol), 2, fmt.Sprintf("%v", vol))
|
|
| 465 | 465 |
assert.Equal(c, vol[0], volumePluginName) |
| 466 | 466 |
assert.Equal(c, vol[1], "abc3") |
| 467 | 467 |
|
| ... | ... |
@@ -484,8 +484,8 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *testing.T) {
|
| 484 | 484 |
|
| 485 | 485 |
assert.Assert(c, json.Unmarshal([]byte(out), &st) == nil) |
| 486 | 486 |
assert.Equal(c, len(st), 1) |
| 487 |
- assert.Equal(c, len(st[0].Status), 1, check.Commentf("%v", st[0]))
|
|
| 488 |
- assert.Equal(c, st[0].Status["Hello"], "world", check.Commentf("%v", st[0].Status))
|
|
| 487 |
+ assert.Equal(c, len(st[0].Status), 1, fmt.Sprintf("%v", st[0]))
|
|
| 488 |
+ assert.Equal(c, st[0].Status["Hello"], "world", fmt.Sprintf("%v", st[0].Status))
|
|
| 489 | 489 |
} |
| 490 | 490 |
|
| 491 | 491 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c *testing.T) {
|
| ... | ... |
@@ -605,9 +605,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c |
| 605 | 605 |
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
|
| 606 | 606 |
|
| 607 | 607 |
out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
|
| 608 |
- assert.Equal(c, s.ec.unmounts, 0, check.Commentf("%s", out))
|
|
| 608 |
+ assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
|
|
| 609 | 609 |
out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
|
| 610 |
- assert.Equal(c, s.ec.unmounts, 0, check.Commentf("%s", out))
|
|
| 610 |
+ assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
|
|
| 611 | 611 |
} |
| 612 | 612 |
|
| 613 | 613 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) {
|
| ... | ... |
@@ -615,12 +615,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testi |
| 615 | 615 |
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
|
| 616 | 616 |
|
| 617 | 617 |
out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
|
| 618 |
- assert.Equal(c, s.ec.mounts, 1, check.Commentf("%s", out))
|
|
| 618 |
+ assert.Equal(c, s.ec.mounts, 1, fmt.Sprintf("%s", out))
|
|
| 619 | 619 |
|
| 620 | 620 |
out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
|
| 621 |
- assert.Equal(c, s.ec.mounts, 2, check.Commentf("%s", out))
|
|
| 622 |
- assert.Equal(c, s.ec.unmounts, 1, check.Commentf("%s", out))
|
|
| 621 |
+ assert.Equal(c, s.ec.mounts, 2, fmt.Sprintf("%s", out))
|
|
| 622 |
+ assert.Equal(c, s.ec.unmounts, 1, fmt.Sprintf("%s", out))
|
|
| 623 | 623 |
|
| 624 | 624 |
out, _ = s.d.Cmd("kill", "test")
|
| 625 |
- assert.Equal(c, s.ec.unmounts, 2, check.Commentf("%s", out))
|
|
| 625 |
+ assert.Equal(c, s.ec.unmounts, 2, fmt.Sprintf("%s", out))
|
|
| 626 | 626 |
} |
| ... | ... |
@@ -99,7 +99,7 @@ func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) {
|
| 99 | 99 |
sizeString := lines[i][startIndex:endIndex] |
| 100 | 100 |
|
| 101 | 101 |
_, err := strconv.Atoi(strings.TrimSpace(sizeString)) |
| 102 |
- assert.Assert(c, err == nil, check.Commentf("The size '%s' was not an Integer", sizeString))
|
|
| 102 |
+ assert.Assert(c, err == nil, fmt.Sprintf("The size '%s' was not an Integer", sizeString))
|
|
| 103 | 103 |
} |
| 104 | 104 |
} |
| 105 | 105 |
|
| ... | ... |
@@ -121,6 +121,6 @@ func (s *DockerSuite) TestHistoryHumanOptionTrue(c *testing.T) {
|
| 121 | 121 |
humanSizeRegexRaw+ |
| 122 | 122 |
"$", |
| 123 | 123 |
|
| 124 |
- strings.TrimSpace(sizeString)), check.Commentf("The size '%s' was not in human format", sizeString))
|
|
| 124 |
+ strings.TrimSpace(sizeString)), fmt.Sprintf("The size '%s' was not in human format", sizeString))
|
|
| 125 | 125 |
} |
| 126 | 126 |
} |
| ... | ... |
@@ -62,9 +62,9 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
| 62 | 62 |
|
| 63 | 63 |
out, _ := dockerCmd(c, "images", "-q", "--no-trunc") |
| 64 | 64 |
imgs := strings.Split(out, "\n") |
| 65 |
- assert.Equal(c, imgs[0], id3, check.Commentf("First image must be %s, got %s", id3, imgs[0]))
|
|
| 66 |
- assert.Equal(c, imgs[1], id2, check.Commentf("First image must be %s, got %s", id2, imgs[1]))
|
|
| 67 |
- assert.Equal(c, imgs[2], id1, check.Commentf("First image must be %s, got %s", id1, imgs[2]))
|
|
| 65 |
+ assert.Equal(c, imgs[0], id3, fmt.Sprintf("First image must be %s, got %s", id3, imgs[0]))
|
|
| 66 |
+ assert.Equal(c, imgs[1], id2, fmt.Sprintf("First image must be %s, got %s", id2, imgs[1]))
|
|
| 67 |
+ assert.Equal(c, imgs[2], id1, fmt.Sprintf("First image must be %s, got %s", id1, imgs[2]))
|
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
| ... | ... |
@@ -139,34 +139,34 @@ LABEL number=3`)) |
| 139 | 139 |
expected := []string{imageID3, imageID2}
|
| 140 | 140 |
|
| 141 | 141 |
out, _ := dockerCmd(c, "images", "-f", "since=image:1", "image") |
| 142 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 142 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 143 | 143 |
|
| 144 | 144 |
out, _ = dockerCmd(c, "images", "-f", "since="+imageID1, "image") |
| 145 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 145 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 146 | 146 |
|
| 147 | 147 |
expected = []string{imageID3}
|
| 148 | 148 |
|
| 149 | 149 |
out, _ = dockerCmd(c, "images", "-f", "since=image:2", "image") |
| 150 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 150 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 151 | 151 |
|
| 152 | 152 |
out, _ = dockerCmd(c, "images", "-f", "since="+imageID2, "image") |
| 153 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 153 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 154 | 154 |
|
| 155 | 155 |
expected = []string{imageID2, imageID1}
|
| 156 | 156 |
|
| 157 | 157 |
out, _ = dockerCmd(c, "images", "-f", "before=image:3", "image") |
| 158 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 158 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 159 | 159 |
|
| 160 | 160 |
out, _ = dockerCmd(c, "images", "-f", "before="+imageID3, "image") |
| 161 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 161 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 162 | 162 |
|
| 163 | 163 |
expected = []string{imageID1}
|
| 164 | 164 |
|
| 165 | 165 |
out, _ = dockerCmd(c, "images", "-f", "before=image:2", "image") |
| 166 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 166 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 167 | 167 |
|
| 168 | 168 |
out, _ = dockerCmd(c, "images", "-f", "before="+imageID2, "image") |
| 169 |
- assert.Equal(c, assertImageList(out, expected), true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 169 |
+ assert.Equal(c, assertImageList(out, expected), true, fmt.Sprintf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 170 | 170 |
} |
| 171 | 171 |
|
| 172 | 172 |
func assertImageList(out string, expected []string) bool {
|
| ... | ... |
@@ -53,7 +53,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
for _, linePrefix := range stringsToCheck {
|
| 56 |
- assert.Assert(c, strings.Contains(out, linePrefix), check.Commentf("couldn't find string %v in output", linePrefix))
|
|
| 56 |
+ assert.Assert(c, strings.Contains(out, linePrefix), fmt.Sprintf("couldn't find string %v in output", linePrefix))
|
|
| 57 | 57 |
} |
| 58 | 58 |
} |
| 59 | 59 |
|
| ... | ... |
@@ -119,8 +119,8 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
|
| 119 | 119 |
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") |
| 120 | 120 |
|
| 121 | 121 |
out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
|
| 122 |
- assert.Assert(c, err != nil, check.Commentf("%d", exitCode))
|
|
| 123 |
- assert.Equal(c, exitCode, 1, check.Commentf("%s", err))
|
|
| 122 |
+ assert.Assert(c, err != nil, fmt.Sprintf("%d", exitCode))
|
|
| 123 |
+ assert.Equal(c, exitCode, 1, fmt.Sprintf("%s", err))
|
|
| 124 | 124 |
assert.Assert(c, strings.Contains(out, "not a valid value for --type")) |
| 125 | 125 |
} |
| 126 | 126 |
|
| ... | ... |
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) {
|
| 130 | 130 |
out := inspectField(c, imageTest, "Size") |
| 131 | 131 |
|
| 132 | 132 |
size, err := strconv.Atoi(out) |
| 133 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect size of the image: %s, %v", out, err))
|
|
| 133 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect size of the image: %s, %v", out, err))
|
|
| 134 | 134 |
|
| 135 | 135 |
//now see if the size turns out to be the same |
| 136 | 136 |
formatStr := fmt.Sprintf("--format={{eq .Size %d}}", size)
|
| ... | ... |
@@ -152,7 +152,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) {
|
| 152 | 152 |
out = inspectField(c, id, "State.ExitCode") |
| 153 | 153 |
|
| 154 | 154 |
exitCode, err := strconv.Atoi(out) |
| 155 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect exitcode of the container: %s, %v", out, err))
|
|
| 155 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect exitcode of the container: %s, %v", out, err))
|
|
| 156 | 156 |
|
| 157 | 157 |
//now get the exit code to verify |
| 158 | 158 |
formatStr := fmt.Sprintf("--format={{eq .State.ExitCode %d}}", exitCode)
|
| ... | ... |
@@ -172,12 +172,12 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) {
|
| 172 | 172 |
deviceID := inspectField(c, imageTest, "GraphDriver.Data.DeviceId") |
| 173 | 173 |
|
| 174 | 174 |
_, err := strconv.Atoi(deviceID) |
| 175 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 175 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 176 | 176 |
|
| 177 | 177 |
deviceSize := inspectField(c, imageTest, "GraphDriver.Data.DeviceSize") |
| 178 | 178 |
|
| 179 | 179 |
_, err = strconv.ParseUint(deviceSize, 10, 64) |
| 180 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 180 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
|
| ... | ... |
@@ -197,12 +197,12 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
|
| 197 | 197 |
assert.Assert(c, imageDeviceID != deviceID) |
| 198 | 198 |
|
| 199 | 199 |
_, err := strconv.Atoi(deviceID) |
| 200 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 200 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 201 | 201 |
|
| 202 | 202 |
deviceSize := inspectField(c, out, "GraphDriver.Data.DeviceSize") |
| 203 | 203 |
|
| 204 | 204 |
_, err = strconv.ParseUint(deviceSize, 10, 64) |
| 205 |
- assert.Assert(c, err == nil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 205 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
|
| ... | ... |
@@ -289,10 +289,10 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) {
|
| 289 | 289 |
out := inspectFieldJSON(c, "test", "HostConfig.LogConfig") |
| 290 | 290 |
|
| 291 | 291 |
err := json.NewDecoder(strings.NewReader(out)).Decode(&logConfig) |
| 292 |
- assert.Assert(c, err == nil, check.Commentf("%v", out))
|
|
| 292 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%v", out))
|
|
| 293 | 293 |
|
| 294 | 294 |
assert.Equal(c, logConfig.Type, "json-file") |
| 295 |
- assert.Equal(c, logConfig.Config["max-file"], "42", check.Commentf("%v", logConfig))
|
|
| 295 |
+ assert.Equal(c, logConfig.Config["max-file"], "42", fmt.Sprintf("%v", logConfig))
|
|
| 296 | 296 |
} |
| 297 | 297 |
|
| 298 | 298 |
func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
| 304 | 304 |
|
| 305 | 305 |
formatStr := "--format={{.SizeRw}},{{.SizeRootFs}}"
|
| 306 | 306 |
out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox") |
| 307 |
- assert.Equal(c, strings.TrimSpace(out), "<nil>,<nil>", check.Commentf("Expected not to display size info: %s", out))
|
|
| 307 |
+ assert.Equal(c, strings.TrimSpace(out), "<nil>,<nil>", fmt.Sprintf("Expected not to display size info: %s", out))
|
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
| ... | ... |
@@ -19,7 +19,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *testing.T) {
|
| 19 | 19 |
_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
|
| 20 | 20 |
|
| 21 | 21 |
// run ping failed with error |
| 22 |
- assert.Equal(c, exitCode, 1, check.Commentf("error: %v", err))
|
|
| 22 |
+ assert.Equal(c, exitCode, 1, fmt.Sprintf("error: %v", err))
|
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
// Test for appropriate error when calling --link with an invalid target container |
| ... | ... |
@@ -28,7 +28,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) {
|
| 28 | 28 |
out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
|
| 29 | 29 |
|
| 30 | 30 |
// an invalid container target should produce an error |
| 31 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 31 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 32 | 32 |
// an invalid container target should produce an error |
| 33 | 33 |
// note: convert the output to lowercase first as the error string |
| 34 | 34 |
// capitalization was changed after API version 1.32 |
| ... | ... |
@@ -170,7 +170,7 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) {
|
| 170 | 170 |
getIP := func(hosts []byte, hostname string) string {
|
| 171 | 171 |
re := regexp.MustCompile(fmt.Sprintf(`(\S*)\t%s`, regexp.QuoteMeta(hostname))) |
| 172 | 172 |
matches := re.FindSubmatch(hosts) |
| 173 |
- assert.Assert(c, matches != nil, check.Commentf("Hostname %s have no matches in hosts", hostname))
|
|
| 173 |
+ assert.Assert(c, matches != nil, fmt.Sprintf("Hostname %s have no matches in hosts", hostname))
|
|
| 174 | 174 |
return string(matches[1]) |
| 175 | 175 |
} |
| 176 | 176 |
ip := getIP(content, "one") |
| ... | ... |
@@ -221,7 +221,7 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
| 221 | 221 |
out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
|
| 222 | 222 |
|
| 223 | 223 |
// Running container linking to a container with --net host should have failed |
| 224 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 224 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 225 | 225 |
// Running container linking to a container with --net host should have failed |
| 226 | 226 |
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error())) |
| 227 | 227 |
} |
| ... | ... |
@@ -20,7 +20,7 @@ const stringCheckPS = "PID USER" |
| 20 | 20 |
// stop the tests. |
| 21 | 21 |
func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
|
| 22 | 22 |
out, status, err := dockerCmdWithError(args...) |
| 23 |
- assert.Assert(c, err != nil, check.Commentf("%v", out))
|
|
| 23 |
+ assert.Assert(c, err != nil, fmt.Sprintf("%v", out))
|
|
| 24 | 24 |
return out, status |
| 25 | 25 |
} |
| 26 | 26 |
|
| ... | ... |
@@ -358,7 +358,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *testing.T) {
|
| 358 | 358 |
|
| 359 | 359 |
out, _ = dockerCmd(c, "network", "ls", "-f", "label=nonexistent") |
| 360 | 360 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 361 |
- assert.Equal(c, len(outArr), 1, check.Commentf("%s\n", out))
|
|
| 361 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("%s\n", out))
|
|
| 362 | 362 |
|
| 363 | 363 |
out, _ = dockerCmd(c, "network", "ls", "-f", "driver=null") |
| 364 | 364 |
assertNwList(c, out, []string{"none"})
|
| ... | ... |
@@ -414,7 +414,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
|
| 414 | 414 |
// contains active container, its deletion should fail. |
| 415 | 415 |
out, _, err := dockerCmdWithError("network", "rm", "testDelMulti0", "testDelMulti1", "testDelMulti2")
|
| 416 | 416 |
// err should not be nil due to deleting testDelMulti2 failed. |
| 417 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 417 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 418 | 418 |
// testDelMulti2 should fail due to network has active endpoints |
| 419 | 419 |
assert.Assert(c, strings.Contains(out, "has active endpoints")) |
| 420 | 420 |
assertNwNotAvailable(c, "testDelMulti0") |
| ... | ... |
@@ -823,14 +823,14 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 823 | 823 |
// verify first container's etc/hosts file has not changed after spawning the second named container |
| 824 | 824 |
hostsPost, err := s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 825 | 825 |
assert.NilError(c, err) |
| 826 |
- assert.Equal(c, string(hosts), string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 826 |
+ assert.Equal(c, string(hosts), string(hostsPost), fmt.Sprintf("Unexpected %s change on second container creation", hostsFile))
|
|
| 827 | 827 |
// stop container 2 and verify first container's etc/hosts has not changed |
| 828 | 828 |
_, err = s.d.Cmd("stop", cid2)
|
| 829 | 829 |
assert.NilError(c, err) |
| 830 | 830 |
|
| 831 | 831 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 832 | 832 |
assert.NilError(c, err) |
| 833 |
- assert.Equal(c, string(hosts), string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 833 |
+ assert.Equal(c, string(hosts), string(hostsPost), fmt.Sprintf("Unexpected %s change on second container creation", hostsFile))
|
|
| 834 | 834 |
// but discovery is on when connecting to non default bridge network |
| 835 | 835 |
network := "anotherbridge" |
| 836 | 836 |
out, err = s.d.Cmd("network", "create", network)
|
| ... | ... |
@@ -845,7 +845,7 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 845 | 845 |
|
| 846 | 846 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 847 | 847 |
assert.NilError(c, err) |
| 848 |
- assert.Equal(c, string(hosts), string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile))
|
|
| 848 |
+ assert.Equal(c, string(hosts), string(hostsPost), fmt.Sprintf("Unexpected %s change on second network connection", hostsFile))
|
|
| 849 | 849 |
} |
| 850 | 850 |
|
| 851 | 851 |
func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *testing.T) {
|
| ... | ... |
@@ -868,7 +868,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *testing.T) {
|
| 868 | 868 |
|
| 869 | 869 |
// verify first container etc/hosts file has not changed |
| 870 | 870 |
hosts1post := readContainerFileWithExec(c, cid1, hostsFile) |
| 871 |
- assert.Equal(c, string(hosts1), string(hosts1post), check.Commentf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 871 |
+ assert.Equal(c, string(hosts1), string(hosts1post), fmt.Sprintf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 872 | 872 |
// Connect the 2nd container to a new network and verify the |
| 873 | 873 |
// first container /etc/hosts file still hasn't changed. |
| 874 | 874 |
dockerCmd(c, "network", "create", "-d", "bridge", cstmBridgeNw1) |
| ... | ... |
@@ -878,7 +878,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *testing.T) {
|
| 878 | 878 |
|
| 879 | 879 |
hosts2 := readContainerFileWithExec(c, cid2, hostsFile) |
| 880 | 880 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 881 |
- assert.Equal(c, string(hosts1), string(hosts1post), check.Commentf("Unexpected %s change on container connect", hostsFile))
|
|
| 881 |
+ assert.Equal(c, string(hosts1), string(hosts1post), fmt.Sprintf("Unexpected %s change on container connect", hostsFile))
|
|
| 882 | 882 |
// start a named container |
| 883 | 883 |
cName := "AnyName" |
| 884 | 884 |
out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "--name", cName, "busybox", "top") |
| ... | ... |
@@ -891,9 +891,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *testing.T) {
|
| 891 | 891 |
// Stop named container and verify first two containers' etc/hosts file hasn't changed |
| 892 | 892 |
dockerCmd(c, "stop", cid3) |
| 893 | 893 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 894 |
- assert.Equal(c, string(hosts1), string(hosts1post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 894 |
+ assert.Equal(c, string(hosts1), string(hosts1post), fmt.Sprintf("Unexpected %s change on name container creation", hostsFile))
|
|
| 895 | 895 |
hosts2post := readContainerFileWithExec(c, cid2, hostsFile) |
| 896 |
- assert.Equal(c, string(hosts2), string(hosts2post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 896 |
+ assert.Equal(c, string(hosts2), string(hosts2post), fmt.Sprintf("Unexpected %s change on name container creation", hostsFile))
|
|
| 897 | 897 |
// verify that container 1 and 2 can't ping the named container now |
| 898 | 898 |
_, _, err := dockerCmdWithError("exec", cid1, "ping", "-c", "1", cName)
|
| 899 | 899 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -1309,7 +1309,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
|
| 1309 | 1309 |
|
| 1310 | 1310 |
// Still it should fail to connect to the default network with a specified IP (whatever ip) |
| 1311 | 1311 |
out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0")
|
| 1312 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1312 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1313 | 1313 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) |
| 1314 | 1314 |
} |
| 1315 | 1315 |
|
| ... | ... |
@@ -1347,10 +1347,10 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1347 | 1347 |
assertNwIsAvailable(c, "n0") |
| 1348 | 1348 |
|
| 1349 | 1349 |
out, _, err := dockerCmdWithError("run", "-d", "--ip", "172.28.99.88", "--net", "n0", "busybox", "top")
|
| 1350 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1350 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1351 | 1351 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) |
| 1352 | 1352 |
out, _, err = dockerCmdWithError("run", "-d", "--ip6", "2001:db8:1234::9988", "--net", "n0", "busybox", "top")
|
| 1353 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1353 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1354 | 1354 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) |
| 1355 | 1355 |
dockerCmd(c, "network", "rm", "n0") |
| 1356 | 1356 |
assertNwNotAvailable(c, "n0") |
| ... | ... |
@@ -1358,7 +1358,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1358 | 1358 |
|
| 1359 | 1359 |
func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) {
|
| 1360 | 1360 |
out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1361 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1361 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1362 | 1362 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) |
| 1363 | 1363 |
} |
| 1364 | 1364 |
|
| ... | ... |
@@ -1485,8 +1485,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *testing.T) {
|
| 1485 | 1485 |
dockerCmd(c, "start", containerName) |
| 1486 | 1486 |
assert.Assert(c, waitRun(containerName) == nil) |
| 1487 | 1487 |
networks := inspectField(c, containerName, "NetworkSettings.Networks") |
| 1488 |
- assert.Assert(c, strings.Contains(networks, netWorkName1), check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1489 |
- assert.Assert(c, strings.Contains(networks, netWorkName2), check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1488 |
+ assert.Assert(c, strings.Contains(networks, netWorkName1), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1489 |
+ assert.Assert(c, strings.Contains(networks, netWorkName2), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1490 | 1490 |
assert.Assert(c, !strings.Contains(networks, "bridge"), check.Commentf("Should not contain 'bridge' network"))
|
| 1491 | 1491 |
} |
| 1492 | 1492 |
|
| ... | ... |
@@ -1549,11 +1549,11 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) |
| 1549 | 1549 |
|
| 1550 | 1550 |
// verify the alias option is rejected when running on predefined network |
| 1551 | 1551 |
out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top")
|
| 1552 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1552 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1553 | 1553 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
| 1554 | 1554 |
// verify the alias option is rejected when connecting to predefined network |
| 1555 | 1555 |
out, _, err = dockerCmdWithError("network", "connect", "--alias=any", "bridge", "first")
|
| 1556 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 1556 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 1557 | 1557 |
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
| 1558 | 1558 |
} |
| 1559 | 1559 |
|
| ... | ... |
@@ -1705,13 +1705,13 @@ func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *testing.T) |
| 1705 | 1705 |
func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *testing.T) {
|
| 1706 | 1706 |
dockerCmd(c, "network", "create", "user") |
| 1707 | 1707 |
output, status := dockerCmd(c, "run", "--rm", "--network=user", "--network-alias=foo", "busybox", "true") |
| 1708 |
- assert.Equal(c, status, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1708 |
+ assert.Equal(c, status, 0, fmt.Sprintf("unexpected status code %d (%s)", status, output))
|
|
| 1709 | 1709 |
|
| 1710 | 1710 |
output, status, _ = dockerCmdWithError("run", "--rm", "--net=user", "--network=user", "busybox", "true")
|
| 1711 |
- assert.Equal(c, status, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1711 |
+ assert.Equal(c, status, 0, fmt.Sprintf("unexpected status code %d (%s)", status, output))
|
|
| 1712 | 1712 |
|
| 1713 | 1713 |
output, status, _ = dockerCmdWithError("run", "--rm", "--network=user", "--net-alias=foo", "--network-alias=bar", "busybox", "true")
|
| 1714 |
- assert.Equal(c, status, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1714 |
+ assert.Equal(c, status, 0, fmt.Sprintf("unexpected status code %d (%s)", status, output))
|
|
| 1715 | 1715 |
} |
| 1716 | 1716 |
|
| 1717 | 1717 |
func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *testing.T) {
|
| ... | ... |
@@ -429,7 +429,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
| 429 | 429 |
|
| 430 | 430 |
// make sure "v2" does not exists |
| 431 | 431 |
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2")) |
| 432 |
- assert.Assert(c, os.IsNotExist(err), check.Commentf("%s", out))
|
|
| 432 |
+ assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("%s", out))
|
|
| 433 | 433 |
|
| 434 | 434 |
dockerCmd(c, "plugin", "disable", "-f", plugin) |
| 435 | 435 |
dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2) |
| ... | ... |
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestPortList(c *testing.T) {
|
| 105 | 105 |
"-p", "9090-9092:80", |
| 106 | 106 |
"busybox", "top") |
| 107 | 107 |
// Exhausted port range did not return an error |
| 108 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 108 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 109 | 109 |
|
| 110 | 110 |
for i := 0; i < 3; i++ {
|
| 111 | 111 |
dockerCmd(c, "rm", "-f", IDs[i]) |
| ... | ... |
@@ -121,7 +121,7 @@ func (s *DockerSuite) TestPortList(c *testing.T) {
|
| 121 | 121 |
"-p", invalidRange, |
| 122 | 122 |
"busybox", "top") |
| 123 | 123 |
// Port range should have returned an error |
| 124 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 124 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
// test host range:container range spec. |
| ... | ... |
@@ -235,9 +235,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
| 235 | 235 |
expBndRegx2 := regexp.MustCompile(`0.0.0.0:\d\d\d\d\d->` + unpPort2) |
| 236 | 236 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 237 | 237 |
// Cannot find expected port binding port (0.0.0.0:xxxxx->unpPort1) in docker ps output |
| 238 |
- assert.Equal(c, expBndRegx1.MatchString(out), true, check.Commentf("out: %s; unpPort1: %s", out, unpPort1))
|
|
| 238 |
+ assert.Equal(c, expBndRegx1.MatchString(out), true, fmt.Sprintf("out: %s; unpPort1: %s", out, unpPort1))
|
|
| 239 | 239 |
// Cannot find expected port binding port (0.0.0.0:xxxxx->unpPort2) in docker ps output |
| 240 |
- assert.Equal(c, expBndRegx2.MatchString(out), true, check.Commentf("out: %s; unpPort2: %s", out, unpPort2))
|
|
| 240 |
+ assert.Equal(c, expBndRegx2.MatchString(out), true, fmt.Sprintf("out: %s; unpPort2: %s", out, unpPort2))
|
|
| 241 | 241 |
|
| 242 | 242 |
// Run the container specifying explicit port bindings for the exposed ports |
| 243 | 243 |
offset := 10000 |
| ... | ... |
@@ -300,7 +300,7 @@ func (s *DockerSuite) TestPortHostBinding(c *testing.T) {
|
| 300 | 300 |
|
| 301 | 301 |
out, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "9876")
|
| 302 | 302 |
// Port is still bound after the Container is removed |
| 303 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 303 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 304 | 304 |
} |
| 305 | 305 |
|
| 306 | 306 |
func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
|
| ... | ... |
@@ -312,7 +312,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
|
| 312 | 312 |
out, _ = dockerCmd(c, "port", firstID, "80") |
| 313 | 313 |
|
| 314 | 314 |
_, exposedPort, err := net.SplitHostPort(out) |
| 315 |
- assert.Assert(c, err == nil, check.Commentf("out: %s", out))
|
|
| 315 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %s", out))
|
|
| 316 | 316 |
|
| 317 | 317 |
dockerCmd(c, "run", "--net=host", "busybox", |
| 318 | 318 |
"nc", "localhost", strings.TrimSpace(exposedPort)) |
| ... | ... |
@@ -322,7 +322,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
|
| 322 | 322 |
out, _, err = dockerCmdWithError("run", "--net=host", "busybox",
|
| 323 | 323 |
"nc", "localhost", strings.TrimSpace(exposedPort)) |
| 324 | 324 |
// Port is still bound after the Container is removed |
| 325 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 325 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 | 328 |
func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
|
| ... | ... |
@@ -45,79 +45,79 @@ func (s *DockerSuite) TestPsListContainersBase(c *testing.T) {
|
| 45 | 45 |
|
| 46 | 46 |
// all |
| 47 | 47 |
out, _ = dockerCmd(c, "ps", "-a") |
| 48 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, thirdID, secondID, firstID}), true, check.Commentf("ALL: Container list is not in the correct order: \n%s", out))
|
|
| 48 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, thirdID, secondID, firstID}), true, fmt.Sprintf("ALL: Container list is not in the correct order: \n%s", out))
|
|
| 49 | 49 |
|
| 50 | 50 |
// running |
| 51 | 51 |
out, _ = dockerCmd(c, "ps") |
| 52 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, secondID, firstID}), true, check.Commentf("RUNNING: Container list is not in the correct order: \n%s", out))
|
|
| 52 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, secondID, firstID}), true, fmt.Sprintf("RUNNING: Container list is not in the correct order: \n%s", out))
|
|
| 53 | 53 |
|
| 54 | 54 |
// limit |
| 55 | 55 |
out, _ = dockerCmd(c, "ps", "-n=2", "-a") |
| 56 | 56 |
expected := []string{fourthID, thirdID}
|
| 57 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 57 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 58 | 58 |
|
| 59 | 59 |
out, _ = dockerCmd(c, "ps", "-n=2") |
| 60 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 60 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 61 | 61 |
|
| 62 | 62 |
// filter since |
| 63 | 63 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-a") |
| 64 | 64 |
expected = []string{fourthID, thirdID, secondID}
|
| 65 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 65 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 66 | 66 |
|
| 67 | 67 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID) |
| 68 | 68 |
expected = []string{fourthID, secondID}
|
| 69 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 69 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 70 | 70 |
|
| 71 | 71 |
out, _ = dockerCmd(c, "ps", "-f", "since="+thirdID) |
| 72 | 72 |
expected = []string{fourthID}
|
| 73 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 73 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 74 | 74 |
|
| 75 | 75 |
// filter before |
| 76 | 76 |
out, _ = dockerCmd(c, "ps", "-f", "before="+fourthID, "-a") |
| 77 | 77 |
expected = []string{thirdID, secondID, firstID}
|
| 78 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 78 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 79 | 79 |
|
| 80 | 80 |
out, _ = dockerCmd(c, "ps", "-f", "before="+fourthID) |
| 81 | 81 |
expected = []string{secondID, firstID}
|
| 82 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 82 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 83 | 83 |
|
| 84 | 84 |
out, _ = dockerCmd(c, "ps", "-f", "before="+thirdID) |
| 85 | 85 |
expected = []string{secondID, firstID}
|
| 86 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 86 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 87 | 87 |
|
| 88 | 88 |
// filter since & before |
| 89 | 89 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-f", "before="+fourthID, "-a") |
| 90 | 90 |
expected = []string{thirdID, secondID}
|
| 91 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 91 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 92 | 92 |
|
| 93 | 93 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-f", "before="+fourthID) |
| 94 | 94 |
expected = []string{secondID}
|
| 95 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 95 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 96 | 96 |
|
| 97 | 97 |
// filter since & limit |
| 98 | 98 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-n=2", "-a") |
| 99 | 99 |
expected = []string{fourthID, thirdID}
|
| 100 | 100 |
|
| 101 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 101 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 102 | 102 |
|
| 103 | 103 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-n=2") |
| 104 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 104 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 105 | 105 |
|
| 106 | 106 |
// filter before & limit |
| 107 | 107 |
out, _ = dockerCmd(c, "ps", "-f", "before="+fourthID, "-n=1", "-a") |
| 108 | 108 |
expected = []string{thirdID}
|
| 109 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 109 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 110 | 110 |
|
| 111 | 111 |
out, _ = dockerCmd(c, "ps", "-f", "before="+fourthID, "-n=1") |
| 112 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 112 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 113 | 113 |
|
| 114 | 114 |
// filter since & filter before & limit |
| 115 | 115 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-f", "before="+fourthID, "-n=1", "-a") |
| 116 | 116 |
expected = []string{thirdID}
|
| 117 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 117 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 118 | 118 |
|
| 119 | 119 |
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-f", "before="+fourthID, "-n=1") |
| 120 |
- assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, check.Commentf("SINCE filter, BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 120 |
+ assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 121 | 121 |
|
| 122 | 122 |
} |
| 123 | 123 |
|
| ... | ... |
@@ -173,10 +173,10 @@ func (s *DockerSuite) TestPsListContainersSize(c *testing.T) {
|
| 173 | 173 |
sizeIndex := strings.Index(lines[0], "SIZE") |
| 174 | 174 |
idIndex := strings.Index(lines[0], "CONTAINER ID") |
| 175 | 175 |
foundID := lines[1][idIndex : idIndex+12] |
| 176 |
- assert.Equal(c, foundID, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
|
| 176 |
+ assert.Equal(c, foundID, id[:12], fmt.Sprintf("Expected id %s, got %s", id[:12], foundID))
|
|
| 177 | 177 |
expectedSize := fmt.Sprintf("%dB", 2+baseBytes)
|
| 178 | 178 |
foundSize := lines[1][sizeIndex:] |
| 179 |
- assert.Assert(c, strings.Contains(foundSize, expectedSize), check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 179 |
+ assert.Assert(c, strings.Contains(foundSize, expectedSize), fmt.Sprintf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
| ... | ... |
@@ -236,7 +236,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
| 236 | 236 |
|
| 237 | 237 |
out = cli.DockerCmd(c, "ps", "-q", "-l", "--no-trunc", "--filter=health=none").Combined() |
| 238 | 238 |
containerOut := strings.TrimSpace(out) |
| 239 |
- assert.Equal(c, containerOut, containerID, check.Commentf("Expected id %s, got %s for legacy none filter, output: %q", containerID, containerOut, out))
|
|
| 239 |
+ assert.Equal(c, containerOut, containerID, fmt.Sprintf("Expected id %s, got %s for legacy none filter, output: %q", containerID, containerOut, out))
|
|
| 240 | 240 |
|
| 241 | 241 |
// Test no health check specified explicitly |
| 242 | 242 |
out = runSleepingContainer(c, "--name=none", "--no-healthcheck") |
| ... | ... |
@@ -246,7 +246,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
| 246 | 246 |
|
| 247 | 247 |
out = cli.DockerCmd(c, "ps", "-q", "-l", "--no-trunc", "--filter=health=none").Combined() |
| 248 | 248 |
containerOut = strings.TrimSpace(out) |
| 249 |
- assert.Equal(c, containerOut, containerID, check.Commentf("Expected id %s, got %s for none filter, output: %q", containerID, containerOut, out))
|
|
| 249 |
+ assert.Equal(c, containerOut, containerID, fmt.Sprintf("Expected id %s, got %s for none filter, output: %q", containerID, containerOut, out))
|
|
| 250 | 250 |
|
| 251 | 251 |
// Test failing health check |
| 252 | 252 |
out = runSleepingContainer(c, "--name=failing_container", "--health-cmd=exit 1", "--health-interval=1s") |
| ... | ... |
@@ -256,7 +256,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
| 256 | 256 |
|
| 257 | 257 |
out = cli.DockerCmd(c, "ps", "-q", "--no-trunc", "--filter=health=unhealthy").Combined() |
| 258 | 258 |
containerOut = strings.TrimSpace(out) |
| 259 |
- assert.Equal(c, containerOut, containerID, check.Commentf("Expected containerID %s, got %s for unhealthy filter, output: %q", containerID, containerOut, out))
|
|
| 259 |
+ assert.Equal(c, containerOut, containerID, fmt.Sprintf("Expected containerID %s, got %s for unhealthy filter, output: %q", containerID, containerOut, out))
|
|
| 260 | 260 |
|
| 261 | 261 |
// Check passing healthcheck |
| 262 | 262 |
out = runSleepingContainer(c, "--name=passing_container", "--health-cmd=exit 0", "--health-interval=1s") |
| ... | ... |
@@ -266,7 +266,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
| 266 | 266 |
|
| 267 | 267 |
out = cli.DockerCmd(c, "ps", "-q", "--no-trunc", "--filter=health=healthy").Combined() |
| 268 | 268 |
containerOut = strings.TrimSpace(RemoveOutputForExistingElements(out, existingContainers)) |
| 269 |
- assert.Equal(c, containerOut, containerID, check.Commentf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out))
|
|
| 269 |
+ assert.Equal(c, containerOut, containerID, fmt.Sprintf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out))
|
|
| 270 | 270 |
} |
| 271 | 271 |
|
| 272 | 272 |
func (s *DockerSuite) TestPsListContainersFilterID(c *testing.T) {
|
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *testing.T) {
|
| 280 | 280 |
// filter containers by id |
| 281 | 281 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--filter=id="+firstID) |
| 282 | 282 |
containerOut := strings.TrimSpace(out) |
| 283 |
- assert.Equal(c, containerOut, firstID[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out))
|
|
| 283 |
+ assert.Equal(c, containerOut, firstID[:12], fmt.Sprintf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out))
|
|
| 284 | 284 |
} |
| 285 | 285 |
|
| 286 | 286 |
func (s *DockerSuite) TestPsListContainersFilterName(c *testing.T) {
|
| ... | ... |
@@ -294,7 +294,7 @@ func (s *DockerSuite) TestPsListContainersFilterName(c *testing.T) {
|
| 294 | 294 |
// filter containers by name |
| 295 | 295 |
out, _ := dockerCmd(c, "ps", "-a", "-q", "--filter=name=a_name_to_match") |
| 296 | 296 |
containerOut := strings.TrimSpace(out) |
| 297 |
- assert.Equal(c, containerOut, id[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", id[:12], containerOut, out))
|
|
| 297 |
+ assert.Equal(c, containerOut, id[:12], fmt.Sprintf("Expected id %s, got %s for exited filter, output: %q", id[:12], containerOut, out))
|
|
| 298 | 298 |
} |
| 299 | 299 |
|
| 300 | 300 |
// Test for the ancestor filter for ps. |
| ... | ... |
@@ -386,7 +386,7 @@ func checkPsAncestorFilterOutput(c *testing.T, out string, filterName string, ex |
| 386 | 386 |
sort.Strings(actualIDs) |
| 387 | 387 |
sort.Strings(expectedIDs) |
| 388 | 388 |
|
| 389 |
- assert.Equal(c, len(actualIDs), len(expectedIDs), check.Commentf("Expected filtered container(s) for %s ancestor filter to be %v:%v, got %v:%v", filterName, len(expectedIDs), expectedIDs, len(actualIDs), actualIDs))
|
|
| 389 |
+ assert.Equal(c, len(actualIDs), len(expectedIDs), fmt.Sprintf("Expected filtered container(s) for %s ancestor filter to be %v:%v, got %v:%v", filterName, len(expectedIDs), expectedIDs, len(actualIDs), actualIDs))
|
|
| 390 | 390 |
if len(expectedIDs) > 0 {
|
| 391 | 391 |
same := true |
| 392 | 392 |
for i := range expectedIDs {
|
| ... | ... |
@@ -396,7 +396,7 @@ func checkPsAncestorFilterOutput(c *testing.T, out string, filterName string, ex |
| 396 | 396 |
break |
| 397 | 397 |
} |
| 398 | 398 |
} |
| 399 |
- assert.Equal(c, same, true, check.Commentf("Expected filtered container(s) for %s ancestor filter to be %v, got %v", filterName, expectedIDs, actualIDs))
|
|
| 399 |
+ assert.Equal(c, same, true, fmt.Sprintf("Expected filtered container(s) for %s ancestor filter to be %v, got %v", filterName, expectedIDs, actualIDs))
|
|
| 400 | 400 |
} |
| 401 | 401 |
} |
| 402 | 402 |
|
| ... | ... |
@@ -416,17 +416,17 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *testing.T) {
|
| 416 | 416 |
// filter containers by exact match |
| 417 | 417 |
out, _ := dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match=me") |
| 418 | 418 |
containerOut := strings.TrimSpace(out) |
| 419 |
- assert.Equal(c, containerOut, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 419 |
+ assert.Equal(c, containerOut, firstID, fmt.Sprintf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 420 | 420 |
|
| 421 | 421 |
// filter containers by two labels |
| 422 | 422 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match=me", "--filter=label=second=tag") |
| 423 | 423 |
containerOut = strings.TrimSpace(out) |
| 424 |
- assert.Equal(c, containerOut, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 424 |
+ assert.Equal(c, containerOut, firstID, fmt.Sprintf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 425 | 425 |
|
| 426 | 426 |
// filter containers by two labels, but expect not found because of AND behavior |
| 427 | 427 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match=me", "--filter=label=second=tag-no") |
| 428 | 428 |
containerOut = strings.TrimSpace(out) |
| 429 |
- assert.Equal(c, containerOut, "", check.Commentf("Expected nothing, got %s for exited filter, output: %q", containerOut, out))
|
|
| 429 |
+ assert.Equal(c, containerOut, "", fmt.Sprintf("Expected nothing, got %s for exited filter, output: %q", containerOut, out))
|
|
| 430 | 430 |
|
| 431 | 431 |
// filter containers by exact key |
| 432 | 432 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match") |
| ... | ... |
@@ -443,11 +443,11 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) {
|
| 443 | 443 |
secondZero, _ := dockerCmd(c, "run", "-d", "busybox", "true") |
| 444 | 444 |
|
| 445 | 445 |
out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false")
|
| 446 |
- assert.Assert(c, err != nil, check.Commentf("Should fail. out: %s", out))
|
|
| 446 |
+ assert.Assert(c, err != nil, fmt.Sprintf("Should fail. out: %s", out))
|
|
| 447 | 447 |
firstNonZero := getIDByName(c, "nonzero1") |
| 448 | 448 |
|
| 449 | 449 |
out, _, err = dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false")
|
| 450 |
- assert.Assert(c, err != nil, check.Commentf("Should fail. out: %s", out))
|
|
| 450 |
+ assert.Assert(c, err != nil, fmt.Sprintf("Should fail. out: %s", out))
|
|
| 451 | 451 |
secondNonZero := getIDByName(c, "nonzero2") |
| 452 | 452 |
|
| 453 | 453 |
// filter containers by exited=0 |
| ... | ... |
@@ -498,11 +498,11 @@ func (s *DockerSuite) TestPsRightTagName(c *testing.T) {
|
| 498 | 498 |
f := strings.Fields(line) |
| 499 | 499 |
switch f[0] {
|
| 500 | 500 |
case id1: |
| 501 |
- assert.Equal(c, f[1], "busybox", check.Commentf("Expected %s tag for id %s, got %s", "busybox", id1, f[1]))
|
|
| 501 |
+ assert.Equal(c, f[1], "busybox", fmt.Sprintf("Expected %s tag for id %s, got %s", "busybox", id1, f[1]))
|
|
| 502 | 502 |
case id2: |
| 503 |
- assert.Equal(c, f[1], tag, check.Commentf("Expected %s tag for id %s, got %s", tag, id2, f[1]))
|
|
| 503 |
+ assert.Equal(c, f[1], tag, fmt.Sprintf("Expected %s tag for id %s, got %s", tag, id2, f[1]))
|
|
| 504 | 504 |
case id3: |
| 505 |
- assert.Equal(c, f[1], imageID, check.Commentf("Expected %s imageID for id %s, got %s", tag, id3, f[1]))
|
|
| 505 |
+ assert.Equal(c, f[1], imageID, fmt.Sprintf("Expected %s imageID for id %s, got %s", tag, id3, f[1]))
|
|
| 506 | 506 |
default: |
| 507 | 507 |
c.Fatalf("Unexpected id %s, expected %s and %s and %s", f[0], id1, id2, id3)
|
| 508 | 508 |
} |
| ... | ... |
@@ -517,7 +517,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
| 517 | 517 |
|
| 518 | 518 |
// Make sure it DOESN'T show up w/o a '-a' for normal 'ps' |
| 519 | 519 |
out, _ = dockerCmd(c, "ps", "-q") |
| 520 |
- assert.Assert(c, !strings.Contains(out, shortCID), check.Commentf("Should have not seen '%s' in ps output:\n%s", shortCID, out))
|
|
| 520 |
+ assert.Assert(c, !strings.Contains(out, shortCID), fmt.Sprintf("Should have not seen '%s' in ps output:\n%s", shortCID, out))
|
|
| 521 | 521 |
// Make sure it DOES show up as 'Created' for 'ps -a' |
| 522 | 522 |
out, _ = dockerCmd(c, "ps", "-a") |
| 523 | 523 |
|
| ... | ... |
@@ -527,10 +527,10 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
| 527 | 527 |
continue |
| 528 | 528 |
} |
| 529 | 529 |
hits++ |
| 530 |
- assert.Assert(c, strings.Contains(line, "Created"), check.Commentf("Missing 'Created' on '%s'", line))
|
|
| 530 |
+ assert.Assert(c, strings.Contains(line, "Created"), fmt.Sprintf("Missing 'Created' on '%s'", line))
|
|
| 531 | 531 |
} |
| 532 | 532 |
|
| 533 |
- assert.Equal(c, hits, 1, check.Commentf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out))
|
|
| 533 |
+ assert.Equal(c, hits, 1, fmt.Sprintf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out))
|
|
| 534 | 534 |
|
| 535 | 535 |
// filter containers by 'create' - note, no -a needed |
| 536 | 536 |
out, _ = dockerCmd(c, "ps", "-q", "-f", "status=created") |
| ... | ... |
@@ -596,14 +596,14 @@ func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {
|
| 596 | 596 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
| 597 | 597 |
expected := "0.0.0.0:5000->5000/tcp" |
| 598 | 598 |
fields := strings.Fields(lines[1]) |
| 599 |
- assert.Equal(c, fields[len(fields)-2], expected, check.Commentf("Expected: %v, got: %v", expected, fields[len(fields)-2]))
|
|
| 599 |
+ assert.Equal(c, fields[len(fields)-2], expected, fmt.Sprintf("Expected: %v, got: %v", expected, fields[len(fields)-2]))
|
|
| 600 | 600 |
|
| 601 | 601 |
dockerCmd(c, "kill", "foo") |
| 602 | 602 |
dockerCmd(c, "wait", "foo") |
| 603 | 603 |
out, _ = dockerCmd(c, "ps", "-l") |
| 604 | 604 |
lines = strings.Split(strings.TrimSpace(string(out)), "\n") |
| 605 | 605 |
fields = strings.Fields(lines[1]) |
| 606 |
- assert.Assert(c, fields[len(fields)-2] != expected, check.Commentf("Should not got %v", expected))
|
|
| 606 |
+ assert.Assert(c, fields[len(fields)-2] != expected, fmt.Sprintf("Should not got %v", expected))
|
|
| 607 | 607 |
} |
| 608 | 608 |
|
| 609 | 609 |
func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
|
| ... | ... |
@@ -355,7 +355,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *testing.T) {
|
| 355 | 355 |
|
| 356 | 356 |
// The pull output includes "Digest: <digest>", so find that |
| 357 | 357 |
matches := digestRegex.FindStringSubmatch(out) |
| 358 |
- assert.Equal(c, len(matches), 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 358 |
+ assert.Equal(c, len(matches), 2, fmt.Sprintf("unable to parse digest from pull output: %s", out))
|
|
| 359 | 359 |
pullDigest := matches[1] |
| 360 | 360 |
|
| 361 | 361 |
// Make sure the pushed and pull digests match |
| ... | ... |
@@ -27,7 +27,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) {
|
| 27 | 27 |
// Container is using image, should not be able to rmi |
| 28 | 28 |
assert.ErrorContains(c, err, "") |
| 29 | 29 |
// Container is using image, error message should contain errSubstr |
| 30 |
- assert.Assert(c, strings.Contains(out, errSubstr), check.Commentf("Container: %q", cleanedContainerID))
|
|
| 30 |
+ assert.Assert(c, strings.Contains(out, errSubstr), fmt.Sprintf("Container: %q", cleanedContainerID))
|
|
| 31 | 31 |
// make sure it didn't delete the busybox name |
| 32 | 32 |
images, _ := dockerCmd(c, "images") |
| 33 | 33 |
// The name 'busybox' should not have been removed from images |
| ... | ... |
@@ -41,23 +41,23 @@ func (s *DockerSuite) TestRmiTag(c *testing.T) {
|
| 41 | 41 |
dockerCmd(c, "tag", "busybox", "utest:5000/docker:tag3") |
| 42 | 42 |
{
|
| 43 | 43 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 44 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+3, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 44 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+3, fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 45 | 45 |
} |
| 46 | 46 |
dockerCmd(c, "rmi", "utest/docker:tag2") |
| 47 | 47 |
{
|
| 48 | 48 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 49 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+2, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 49 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+2, fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 50 | 50 |
} |
| 51 | 51 |
dockerCmd(c, "rmi", "utest:5000/docker:tag3") |
| 52 | 52 |
{
|
| 53 | 53 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 54 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+1, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 54 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+1, fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 55 | 55 |
|
| 56 | 56 |
} |
| 57 | 57 |
dockerCmd(c, "rmi", "utest:tag1") |
| 58 | 58 |
{
|
| 59 | 59 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 60 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n"), check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 60 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n"), fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 61 | 61 |
|
| 62 | 62 |
} |
| 63 | 63 |
} |
| ... | ... |
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) {
|
| 80 | 80 |
|
| 81 | 81 |
imagesAfter := cli.DockerCmd(c, "images", "-a").Combined() |
| 82 | 82 |
// tag busybox to create 2 more images with same imageID |
| 83 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+2, check.Commentf("docker images shows: %q\n", imagesAfter))
|
|
| 83 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+2, fmt.Sprintf("docker images shows: %q\n", imagesAfter))
|
|
| 84 | 84 |
|
| 85 | 85 |
imgID := inspectField(c, "busybox-one:tag1", "Id") |
| 86 | 86 |
|
| ... | ... |
@@ -100,7 +100,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) {
|
| 100 | 100 |
|
| 101 | 101 |
imagesAfter = cli.DockerCmd(c, "images", "-a").Combined() |
| 102 | 102 |
// rmi -f failed, image still exists |
| 103 |
- assert.Assert(c, !strings.Contains(imagesAfter, imgID[:12]), check.Commentf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter))
|
|
| 103 |
+ assert.Assert(c, !strings.Contains(imagesAfter, imgID[:12]), fmt.Sprintf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter))
|
|
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) {
|
| ... | ... |
@@ -122,7 +122,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) {
|
| 122 | 122 |
cli.DockerCmd(c, "tag", "busybox-test", "utest:5000/docker:tag4") |
| 123 | 123 |
{
|
| 124 | 124 |
imagesAfter := cli.DockerCmd(c, "images", "-a").Combined() |
| 125 |
- assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+4, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 125 |
+ assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+4, fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 126 | 126 |
} |
| 127 | 127 |
imgID := inspectField(c, "busybox-test", "Id") |
| 128 | 128 |
|
| ... | ... |
@@ -210,7 +210,7 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
| 210 | 210 |
assert.Assert(c, !strings.Contains(out, "Untagged: "+tag1)) |
| 211 | 211 |
// Check built image still exists |
| 212 | 212 |
images, _ := dockerCmd(c, "images", "-a") |
| 213 |
- assert.Assert(c, strings.Contains(images, imageName), check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
| 213 |
+ assert.Assert(c, strings.Contains(images, imageName), fmt.Sprintf("Built image missing %q; Images: %q", imageName, images))
|
|
| 214 | 214 |
} |
| 215 | 215 |
|
| 216 | 216 |
func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
| ... | ... |
@@ -218,9 +218,9 @@ func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
| 218 | 218 |
// Should have failed to delete ' ' image |
| 219 | 219 |
assert.ErrorContains(c, err, "") |
| 220 | 220 |
// Wrong error message generated |
| 221 |
- assert.Assert(c, !strings.Contains(out, "no such id"), check.Commentf("out: %s", out))
|
|
| 221 |
+ assert.Assert(c, !strings.Contains(out, "no such id"), fmt.Sprintf("out: %s", out))
|
|
| 222 | 222 |
// Expected error message not generated |
| 223 |
- assert.Assert(c, strings.Contains(out, "image name cannot be blank"), check.Commentf("out: %s", out))
|
|
| 223 |
+ assert.Assert(c, strings.Contains(out, "image name cannot be blank"), fmt.Sprintf("out: %s", out))
|
|
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
| ... | ... |
@@ -245,7 +245,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
| 245 | 245 |
out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
|
| 246 | 246 |
// The image of the running container should not be removed. |
| 247 | 247 |
assert.ErrorContains(c, err, "") |
| 248 |
- assert.Assert(c, strings.Contains(out, "image is being used by running container"), check.Commentf("out: %s", out))
|
|
| 248 |
+ assert.Assert(c, strings.Contains(out, "image is being used by running container"), fmt.Sprintf("out: %s", out))
|
|
| 249 | 249 |
} |
| 250 | 250 |
|
| 251 | 251 |
// #13422 |
| ... | ... |
@@ -272,7 +272,7 @@ RUN echo 2 #layer2 |
| 272 | 272 |
// See if the "tmp2" can be untagged. |
| 273 | 273 |
out, _ = dockerCmd(c, "rmi", newTag) |
| 274 | 274 |
// Expected 1 untagged entry |
| 275 |
- assert.Equal(c, strings.Count(out, "Untagged: "), 1, check.Commentf("out: %s", out))
|
|
| 275 |
+ assert.Equal(c, strings.Count(out, "Untagged: "), 1, fmt.Sprintf("out: %s", out))
|
|
| 276 | 276 |
|
| 277 | 277 |
// Now let's add the tag again and create a container based on it. |
| 278 | 278 |
dockerCmd(c, "tag", idToTag, newTag) |
| ... | ... |
@@ -3210,8 +3210,8 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) {
|
| 3210 | 3210 |
assert.Assert(c, err != nil, check.Commentf("Expected docker run to fail!"))
|
| 3211 | 3211 |
|
| 3212 | 3212 |
containerID, err := inspectFieldWithError(name, "Id") |
| 3213 |
- assert.Assert(c, err != nil, check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3214 |
- assert.Equal(c, containerID, "", check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3213 |
+ assert.Assert(c, err != nil, fmt.Sprintf("Expected not to have this container: %s!", containerID))
|
|
| 3214 |
+ assert.Equal(c, containerID, "", fmt.Sprintf("Expected not to have this container: %s!", containerID))
|
|
| 3215 | 3215 |
} |
| 3216 | 3216 |
|
| 3217 | 3217 |
func (s *DockerSuite) TestRunNamedVolume(c *testing.T) {
|
| ... | ... |
@@ -3946,14 +3946,14 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) {
|
| 3946 | 3946 |
// We will need the following `inspect` to diagnose the issue if test fails (#21247) |
| 3947 | 3947 |
out1, err1 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "test")
|
| 3948 | 3948 |
out2, err2 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "fail")
|
| 3949 |
- assert.Assert(c, err != nil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
|
|
| 3949 |
+ assert.Assert(c, err != nil, fmt.Sprintf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
|
|
| 3950 | 3950 |
// check for windows error as well |
| 3951 | 3951 |
// TODO Windows Post TP5. Fix the error message string |
| 3952 | 3952 |
assert.Assert(c, strings.Contains(string(out), "port is already allocated") || |
| 3953 | 3953 |
strings.Contains(string(out), "were not connected because a duplicate name exists") || |
| 3954 | 3954 |
strings.Contains(string(out), "The specified port already exists") || |
| 3955 | 3955 |
strings.Contains(string(out), "HNS failed with error : Failed to create endpoint") || |
| 3956 |
- strings.Contains(string(out), "HNS failed with error : The object already exists"), checker.Equals, true, check.Commentf("Output: %s", out))
|
|
| 3956 |
+ strings.Contains(string(out), "HNS failed with error : The object already exists"), checker.Equals, true, fmt.Sprintf("Output: %s", out))
|
|
| 3957 | 3957 |
dockerCmd(c, "rm", "-f", "test") |
| 3958 | 3958 |
|
| 3959 | 3959 |
// NGoroutines is not updated right away, so we need to wait before failing |
| ... | ... |
@@ -4032,9 +4032,9 @@ func (s *DockerSuite) TestRunDNSInHostMode(c *testing.T) {
|
| 4032 | 4032 |
expectedOutput2 := "search example.com" |
| 4033 | 4033 |
expectedOutput3 := "options timeout:3" |
| 4034 | 4034 |
out := cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--dns-search=example.com", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "/etc/resolv.conf").Combined() |
| 4035 |
- assert.Assert(c, strings.Contains(out, expectedOutput1), check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4036 |
- assert.Assert(c, strings.Contains(out, expectedOutput2), check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4037 |
- assert.Assert(c, strings.Contains(out, expectedOutput3), check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4035 |
+ assert.Assert(c, strings.Contains(out, expectedOutput1), fmt.Sprintf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4036 |
+ assert.Assert(c, strings.Contains(out, expectedOutput2), fmt.Sprintf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4037 |
+ assert.Assert(c, strings.Contains(out, expectedOutput3), fmt.Sprintf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4038 | 4038 |
} |
| 4039 | 4039 |
|
| 4040 | 4040 |
// Test case for #21976 |
| ... | ... |
@@ -4043,14 +4043,14 @@ func (s *DockerSuite) TestRunAddHostInHostMode(c *testing.T) {
|
| 4043 | 4043 |
|
| 4044 | 4044 |
expectedOutput := "1.2.3.4\textra" |
| 4045 | 4045 |
out, _ := dockerCmd(c, "run", "--add-host=extra:1.2.3.4", "--net=host", "busybox", "cat", "/etc/hosts") |
| 4046 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4046 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4047 | 4047 |
} |
| 4048 | 4048 |
|
| 4049 | 4049 |
func (s *DockerSuite) TestRunRmAndWait(c *testing.T) {
|
| 4050 | 4050 |
dockerCmd(c, "run", "--name=test", "--rm", "-d", "busybox", "sh", "-c", "sleep 3;exit 2") |
| 4051 | 4051 |
|
| 4052 | 4052 |
out, code, err := dockerCmdWithError("wait", "test")
|
| 4053 |
- assert.Assert(c, err == nil, check.Commentf("out: %s; exit code: %d", out, code))
|
|
| 4053 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %s; exit code: %d", out, code))
|
|
| 4054 | 4054 |
assert.Equal(c, out, "2\n", "exit code: %d", code) |
| 4055 | 4055 |
assert.Equal(c, code, 0) |
| 4056 | 4056 |
} |
| ... | ... |
@@ -4136,7 +4136,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) {
|
| 4136 | 4136 |
|
| 4137 | 4137 |
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
|
| 4138 | 4138 |
assert.ErrorContains(c, err, "") |
| 4139 |
- assert.Assert(c, strings.Contains(out, "failed to initialize logging driver"), check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4139 |
+ assert.Assert(c, strings.Contains(out, "failed to initialize logging driver"), fmt.Sprintf("error should be about logging driver, got output %s", out))
|
|
| 4140 | 4140 |
// NGoroutines is not updated right away, so we need to wait before failing |
| 4141 | 4141 |
assert.Assert(c, waitForGoroutines(nroutines) == nil) |
| 4142 | 4142 |
} |
| ... | ... |
@@ -4156,8 +4156,8 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *testing.T) {
|
| 4156 | 4156 |
} |
| 4157 | 4157 |
for _, attempt := range attempts {
|
| 4158 | 4158 |
_, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true")
|
| 4159 |
- assert.Assert(c, err != nil, check.Commentf("%s expected non-nil err", attempt.value))
|
|
| 4160 |
- assert.Assert(c, strings.Contains(err.Error(), attempt.expectedError), check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4159 |
+ assert.Assert(c, err != nil, fmt.Sprintf("%s expected non-nil err", attempt.value))
|
|
| 4160 |
+ assert.Assert(c, strings.Contains(err.Error(), attempt.expectedError), fmt.Sprintf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4161 | 4161 |
} |
| 4162 | 4162 |
} |
| 4163 | 4163 |
|
| ... | ... |
@@ -4488,11 +4488,11 @@ func (s *DockerSuite) TestRunMount(c *testing.T) {
|
| 4488 | 4488 |
_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
|
| 4489 | 4489 |
append(opts, []string{"busybox", "top"}...)...)...)
|
| 4490 | 4490 |
if testCase.valid {
|
| 4491 |
- assert.Assert(c, err == nil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4492 |
- assert.Assert(c, testCase.fn(cName) == nil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4491 |
+ assert.Assert(c, err == nil, fmt.Sprintf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4492 |
+ assert.Assert(c, testCase.fn(cName) == nil, fmt.Sprintf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4493 | 4493 |
dockerCmd(c, "rm", "-f", cName) |
| 4494 | 4494 |
} else {
|
| 4495 |
- assert.Assert(c, err != nil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4495 |
+ assert.Assert(c, err != nil, fmt.Sprintf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4496 | 4496 |
} |
| 4497 | 4497 |
} |
| 4498 | 4498 |
} |
| ... | ... |
@@ -70,8 +70,8 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
| 70 | 70 |
|
| 71 | 71 |
// Create a temporary tmpfs mount. |
| 72 | 72 |
tmpfsDir := filepath.Join(tmpDir, "tmpfs") |
| 73 |
- assert.Assert(c, os.MkdirAll(tmpfsDir, 0777) == nil, check.Commentf("failed to mkdir at %s", tmpfsDir))
|
|
| 74 |
- assert.Assert(c, mount.Mount("tmpfs", tmpfsDir, "tmpfs", "") == nil, check.Commentf("failed to create a tmpfs mount at %s", tmpfsDir))
|
|
| 73 |
+ assert.Assert(c, os.MkdirAll(tmpfsDir, 0777) == nil, fmt.Sprintf("failed to mkdir at %s", tmpfsDir))
|
|
| 74 |
+ assert.Assert(c, mount.Mount("tmpfs", tmpfsDir, "tmpfs", "") == nil, fmt.Sprintf("failed to create a tmpfs mount at %s", tmpfsDir))
|
|
| 75 | 75 |
|
| 76 | 76 |
f, err := ioutil.TempFile(tmpfsDir, "touch-me") |
| 77 | 77 |
assert.NilError(c, err) |
| ... | ... |
@@ -672,10 +672,10 @@ func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) {
|
| 672 | 672 |
out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
| 673 | 673 |
assert.ErrorContains(c, err, "") |
| 674 | 674 |
expected := "Valid memory swappiness range is 0-100" |
| 675 |
- assert.Assert(c, strings.Contains(out, expected), check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 675 |
+ assert.Assert(c, strings.Contains(out, expected), fmt.Sprintf("Expected output to contain %q, not %q", out, expected))
|
|
| 676 | 676 |
out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true")
|
| 677 | 677 |
assert.ErrorContains(c, err, "") |
| 678 |
- assert.Assert(c, strings.Contains(out, expected), check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 678 |
+ assert.Assert(c, strings.Contains(out, expected), fmt.Sprintf("Expected output to contain %q, not %q", out, expected))
|
|
| 679 | 679 |
} |
| 680 | 680 |
|
| 681 | 681 |
func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) {
|
| ... | ... |
@@ -137,13 +137,13 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
| 137 | 137 |
|
| 138 | 138 |
var err error |
| 139 | 139 |
tarCmd.Stdin, err = saveCmd.StdoutPipe() |
| 140 |
- assert.Assert(c, err == nil, check.Commentf("cannot set stdout pipe for tar: %v", err))
|
|
| 140 |
+ assert.Assert(c, err == nil, fmt.Sprintf("cannot set stdout pipe for tar: %v", err))
|
|
| 141 | 141 |
grepCmd := exec.Command("grep", cleanedLongImageID)
|
| 142 | 142 |
grepCmd.Stdin, err = tarCmd.StdoutPipe() |
| 143 |
- assert.Assert(c, err == nil, check.Commentf("cannot set stdout pipe for grep: %v", err))
|
|
| 143 |
+ assert.Assert(c, err == nil, fmt.Sprintf("cannot set stdout pipe for grep: %v", err))
|
|
| 144 | 144 |
|
| 145 |
- assert.Assert(c, tarCmd.Start() == nil, check.Commentf("tar failed with error: %v", err))
|
|
| 146 |
- assert.Assert(c, saveCmd.Start() == nil, check.Commentf("docker save failed with error: %v", err))
|
|
| 145 |
+ assert.Assert(c, tarCmd.Start() == nil, fmt.Sprintf("tar failed with error: %v", err))
|
|
| 146 |
+ assert.Assert(c, saveCmd.Start() == nil, fmt.Sprintf("docker save failed with error: %v", err))
|
|
| 147 | 147 |
defer func() {
|
| 148 | 148 |
saveCmd.Wait() |
| 149 | 149 |
tarCmd.Wait() |
| ... | ... |
@@ -152,7 +152,7 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
| 152 | 152 |
|
| 153 | 153 |
out, _, err = runCommandWithOutput(grepCmd) |
| 154 | 154 |
|
| 155 |
- assert.Assert(c, err == nil, check.Commentf("failed to save repo with image ID: %s, %v", out, err))
|
|
| 155 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to save repo with image ID: %s, %v", out, err))
|
|
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
// save a repo and try to load it using flags |
| ... | ... |
@@ -264,7 +264,7 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *testing.T) {
|
| 264 | 264 |
|
| 265 | 265 |
name := "save-directory-permissions" |
| 266 | 266 |
tmpDir, err := ioutil.TempDir("", "save-layers-with-directories")
|
| 267 |
- assert.Assert(c, err == nil, check.Commentf("failed to create temporary directory: %s", err))
|
|
| 267 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to create temporary directory: %s", err))
|
|
| 268 | 268 |
extractionDirectory := filepath.Join(tmpDir, "image-extraction-dir") |
| 269 | 269 |
os.Mkdir(extractionDirectory, 0777) |
| 270 | 270 |
|
| ... | ... |
@@ -76,7 +76,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *testing.T) {
|
| 76 | 76 |
}, |
| 77 | 77 |
Data: []byte("TESTINGDATA"),
|
| 78 | 78 |
}) |
| 79 |
- assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
|
|
| 79 |
+ assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id))
|
|
| 80 | 80 |
|
| 81 | 81 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
|
| 82 | 82 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -118,7 +118,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi |
| 118 | 118 |
}, |
| 119 | 119 |
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
|
| 120 | 120 |
}) |
| 121 |
- assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
|
|
| 121 |
+ assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id))
|
|
| 122 | 122 |
|
| 123 | 123 |
secretFlags = append(secretFlags, "--secret", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
| 124 | 124 |
} |
| ... | ... |
@@ -174,7 +174,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing |
| 174 | 174 |
}, |
| 175 | 175 |
Data: []byte("TESTINGDATA"),
|
| 176 | 176 |
}) |
| 177 |
- assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
|
|
| 177 |
+ assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id))
|
|
| 178 | 178 |
|
| 179 | 179 |
serviceName := "svc" |
| 180 | 180 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
|
| ... | ... |
@@ -224,7 +224,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *testing.T) {
|
| 224 | 224 |
}, |
| 225 | 225 |
Data: []byte("TESTINGDATA"),
|
| 226 | 226 |
}) |
| 227 |
- assert.Assert(c, id != "", check.Commentf("configs: %s", id))
|
|
| 227 |
+ assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id))
|
|
| 228 | 228 |
|
| 229 | 229 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
|
| 230 | 230 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -265,7 +265,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi |
| 265 | 265 |
}, |
| 266 | 266 |
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
|
| 267 | 267 |
}) |
| 268 |
- assert.Assert(c, id != "", check.Commentf("configs: %s", id))
|
|
| 268 |
+ assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id))
|
|
| 269 | 269 |
|
| 270 | 270 |
configFlags = append(configFlags, "--config", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
| 271 | 271 |
} |
| ... | ... |
@@ -321,7 +321,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing |
| 321 | 321 |
}, |
| 322 | 322 |
Data: []byte("TESTINGDATA"),
|
| 323 | 323 |
}) |
| 324 |
- assert.Assert(c, id != "", check.Commentf("configs: %s", id))
|
|
| 324 |
+ assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id))
|
|
| 325 | 325 |
|
| 326 | 326 |
serviceName := "svc" |
| 327 | 327 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")
|
| ... | ... |
@@ -66,7 +66,7 @@ func countLogLines(d *daemon.Daemon, name string) func(*testing.T) (interface{},
|
| 66 | 66 |
return 0, check.Commentf("Empty stdout")
|
| 67 | 67 |
} |
| 68 | 68 |
lines := strings.Split(strings.TrimSpace(result.Stdout()), "\n") |
| 69 |
- return len(lines), check.Commentf("output, %q", string(result.Stdout()))
|
|
| 69 |
+ return len(lines), fmt.Sprintf("output, %q", string(result.Stdout()))
|
|
| 70 | 70 |
} |
| 71 | 71 |
} |
| 72 | 72 |
|
| ... | ... |
@@ -21,7 +21,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) {
|
| 21 | 21 |
// Expect this to fail because the above container is stopped, this is what we want |
| 22 | 22 |
out, _, err := dockerCmdWithError("run", "--name", "test2", "--link", "test:test", "busybox")
|
| 23 | 23 |
// err shouldn't be nil because container test2 try to link to stopped container |
| 24 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 24 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 25 | 25 |
|
| 26 | 26 |
ch := make(chan error) |
| 27 | 27 |
go func() {
|
| ... | ... |
@@ -79,7 +79,7 @@ func (s *DockerSuite) TestStartRecordError(c *testing.T) {
|
| 79 | 79 |
// Expect this to fail and records error because of ports conflict |
| 80 | 80 |
out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top")
|
| 81 | 81 |
// err shouldn't be nil because docker run will fail |
| 82 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 82 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 83 | 83 |
|
| 84 | 84 |
stateErr = inspectField(c, "test2", "State.Error") |
| 85 | 85 |
assert.Assert(c, strings.Contains(stateErr, "port is already allocated")) |
| ... | ... |
@@ -101,7 +101,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *testing.T) {
|
| 101 | 101 |
|
| 102 | 102 |
out, _, err := dockerCmdWithError("start", "testing")
|
| 103 | 103 |
// an error should have been shown that you cannot start paused container |
| 104 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 104 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 105 | 105 |
// an error should have been shown that you cannot start paused container |
| 106 | 106 |
assert.Assert(c, strings.Contains(strings.ToLower(out), "cannot start a paused container, try unpause instead")) |
| 107 | 107 |
} |
| ... | ... |
@@ -129,7 +129,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) {
|
| 129 | 129 |
expErr := "failed to start containers: [child_first]" |
| 130 | 130 |
out, _, err := dockerCmdWithError("start", "child_first", "parent", "child_second")
|
| 131 | 131 |
// err shouldn't be nil because start will fail |
| 132 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 132 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 133 | 133 |
// output does not correspond to what was expected |
| 134 | 134 |
if !(strings.Contains(out, expOut) || strings.Contains(err.Error(), expErr)) {
|
| 135 | 135 |
c.Fatalf("Expected out: %v with err: %v but got out: %v with err: %v", expOut, expErr, out, err)
|
| ... | ... |
@@ -157,7 +157,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) {
|
| 157 | 157 |
for _, option := range []string{"-a", "-i", "-ai"} {
|
| 158 | 158 |
out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3")
|
| 159 | 159 |
// err shouldn't be nil because start will fail |
| 160 |
- assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
|
| 160 |
+ assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out))
|
|
| 161 | 161 |
// output does not correspond to what was expected |
| 162 | 162 |
assert.Assert(c, strings.Contains(out, "you cannot start and attach multiple containers at once")) |
| 163 | 163 |
} |
| ... | ... |
@@ -192,9 +192,9 @@ func (s *DockerSuite) TestStartReturnCorrectExitCode(c *testing.T) {
|
| 192 | 192 |
|
| 193 | 193 |
out, exitCode, err := dockerCmdWithError("start", "-a", "withRestart")
|
| 194 | 194 |
assert.ErrorContains(c, err, "") |
| 195 |
- assert.Equal(c, exitCode, 11, check.Commentf("out: %s", out))
|
|
| 195 |
+ assert.Equal(c, exitCode, 11, fmt.Sprintf("out: %s", out))
|
|
| 196 | 196 |
|
| 197 | 197 |
out, exitCode, err = dockerCmdWithError("start", "-a", "withRm")
|
| 198 | 198 |
assert.ErrorContains(c, err, "") |
| 199 |
- assert.Equal(c, exitCode, 12, check.Commentf("out: %s", out))
|
|
| 199 |
+ assert.Equal(c, exitCode, 12, fmt.Sprintf("out: %s", out))
|
|
| 200 | 200 |
} |
| ... | ... |
@@ -171,7 +171,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
|
| 171 | 171 |
func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
|
| 172 | 172 |
d := s.AddDaemon(c, true, true) |
| 173 | 173 |
hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
|
| 174 |
- assert.Assert(c, err == nil, check.Commentf("%s", hostname))
|
|
| 174 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", hostname))
|
|
| 175 | 175 |
|
| 176 | 176 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
|
| 177 | 177 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -607,14 +607,14 @@ func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *testing.T) {
|
| 607 | 607 |
out, err = d.Cmd("ps", "-a", "-q", "--filter=is-task=false")
|
| 608 | 608 |
assert.NilError(c, err, out) |
| 609 | 609 |
psOut := strings.TrimSpace(out) |
| 610 |
- assert.Equal(c, psOut, bareID, check.Commentf("Expected id %s, got %s for is-task label, output %q", bareID, psOut, out))
|
|
| 610 |
+ assert.Equal(c, psOut, bareID, fmt.Sprintf("Expected id %s, got %s for is-task label, output %q", bareID, psOut, out))
|
|
| 611 | 611 |
|
| 612 | 612 |
// Filter tasks |
| 613 | 613 |
out, err = d.Cmd("ps", "-a", "-q", "--filter=is-task=true")
|
| 614 | 614 |
assert.NilError(c, err, out) |
| 615 | 615 |
lines := strings.Split(strings.Trim(out, "\n "), "\n") |
| 616 | 616 |
assert.Equal(c, len(lines), 1) |
| 617 |
- assert.Assert(c, lines[0] != bareID, check.Commentf("Expected not %s, but got it for is-task label, output %q", bareID, out))
|
|
| 617 |
+ assert.Assert(c, lines[0] != bareID, fmt.Sprintf("Expected not %s, but got it for is-task label, output %q", bareID, out))
|
|
| 618 | 618 |
} |
| 619 | 619 |
|
| 620 | 620 |
const globalNetworkPlugin = "global-network-plugin" |
| ... | ... |
@@ -847,7 +847,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) {
|
| 847 | 847 |
|
| 848 | 848 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 849 | 849 |
assert.NilError(c, err, out) |
| 850 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 850 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 851 | 851 |
// Remove service |
| 852 | 852 |
out, err = d.Cmd("service", "rm", name)
|
| 853 | 853 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -869,7 +869,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) {
|
| 869 | 869 |
|
| 870 | 870 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 871 | 871 |
assert.NilError(c, err, out) |
| 872 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 872 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 873 | 873 |
} |
| 874 | 874 |
|
| 875 | 875 |
func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *testing.T) {
|
| ... | ... |
@@ -956,9 +956,9 @@ func (s *DockerSwarmSuite) TestDNSConfig(c *testing.T) {
|
| 956 | 956 |
expectedOutput3 := "options timeout:3" |
| 957 | 957 |
out, err = d.Cmd("exec", id, "cat", "/etc/resolv.conf")
|
| 958 | 958 |
assert.NilError(c, err, out) |
| 959 |
- assert.Assert(c, strings.Contains(out, expectedOutput1), check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 960 |
- assert.Assert(c, strings.Contains(out, expectedOutput2), check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 961 |
- assert.Assert(c, strings.Contains(out, expectedOutput3), check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 959 |
+ assert.Assert(c, strings.Contains(out, expectedOutput1), fmt.Sprintf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 960 |
+ assert.Assert(c, strings.Contains(out, expectedOutput2), fmt.Sprintf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 961 |
+ assert.Assert(c, strings.Contains(out, expectedOutput3), fmt.Sprintf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 962 | 962 |
} |
| 963 | 963 |
|
| 964 | 964 |
func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *testing.T) {
|
| ... | ... |
@@ -1045,7 +1045,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
|
| 1045 | 1045 |
d := s.AddDaemon(c, false, false) |
| 1046 | 1046 |
|
| 1047 | 1047 |
outs, err := d.Cmd("swarm", "init", "--autolock")
|
| 1048 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1048 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1049 | 1049 |
unlockKey := getUnlockKey(d, c, outs) |
| 1050 | 1050 |
|
| 1051 | 1051 |
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) |
| ... | ... |
@@ -1070,15 +1070,15 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
|
| 1070 | 1070 |
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) |
| 1071 | 1071 |
|
| 1072 | 1072 |
outs, err = d.Cmd("node", "ls")
|
| 1073 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1073 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1074 | 1074 |
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
| 1075 | 1075 |
outs, err = d.Cmd("swarm", "update", "--autolock=false")
|
| 1076 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1076 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1077 | 1077 |
|
| 1078 | 1078 |
checkSwarmLockedToUnlocked(c, d) |
| 1079 | 1079 |
|
| 1080 | 1080 |
outs, err = d.Cmd("node", "ls")
|
| 1081 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1081 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1082 | 1082 |
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
| 1083 | 1083 |
} |
| 1084 | 1084 |
|
| ... | ... |
@@ -1086,7 +1086,7 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
|
| 1086 | 1086 |
d := s.AddDaemon(c, false, false) |
| 1087 | 1087 |
|
| 1088 | 1088 |
outs, err := d.Cmd("swarm", "init", "--autolock")
|
| 1089 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1089 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1090 | 1090 |
|
| 1091 | 1091 |
// It starts off locked |
| 1092 | 1092 |
d.RestartNode(c) |
| ... | ... |
@@ -1101,13 +1101,13 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
|
| 1101 | 1101 |
assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked.")) |
| 1102 | 1102 |
// It is OK for user to leave a locked swarm with --force |
| 1103 | 1103 |
outs, err = d.Cmd("swarm", "leave", "--force")
|
| 1104 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1104 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1105 | 1105 |
|
| 1106 | 1106 |
info = d.SwarmInfo(c) |
| 1107 | 1107 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive) |
| 1108 | 1108 |
|
| 1109 | 1109 |
outs, err = d.Cmd("swarm", "init")
|
| 1110 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1110 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1111 | 1111 |
|
| 1112 | 1112 |
info = d.SwarmInfo(c) |
| 1113 | 1113 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) |
| ... | ... |
@@ -1127,7 +1127,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) {
|
| 1127 | 1127 |
|
| 1128 | 1128 |
// enable autolock |
| 1129 | 1129 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1130 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1130 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1131 | 1131 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1132 | 1132 |
|
| 1133 | 1133 |
// The ones that got the cluster update should be set to locked |
| ... | ... |
@@ -1149,7 +1149,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) {
|
| 1149 | 1149 |
|
| 1150 | 1150 |
// leave it locked, and set the cluster to no longer autolock |
| 1151 | 1151 |
outs, err = d1.Cmd("swarm", "update", "--autolock=false")
|
| 1152 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1152 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1153 | 1153 |
|
| 1154 | 1154 |
// the ones that got the update are now set to unlocked |
| 1155 | 1155 |
for _, d := range []*daemon.Daemon{d1, d3} {
|
| ... | ... |
@@ -1179,7 +1179,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1179 | 1179 |
|
| 1180 | 1180 |
// enable autolock |
| 1181 | 1181 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1182 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1182 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1183 | 1183 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1184 | 1184 |
|
| 1185 | 1185 |
// joined workers start off unlocked |
| ... | ... |
@@ -1217,7 +1217,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1217 | 1217 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
| 1218 | 1218 |
certBytes, err := ioutil.ReadFile(filepath.Join(d3.Folder, "root", "swarm", "certificates", "swarm-node.crt")) |
| 1219 | 1219 |
if err != nil {
|
| 1220 |
- return "", check.Commentf("error: %v", err)
|
|
| 1220 |
+ return "", fmt.Sprintf("error: %v", err)
|
|
| 1221 | 1221 |
} |
| 1222 | 1222 |
certs, err := helpers.ParseCertificatesPEM(certBytes) |
| 1223 | 1223 |
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
| ... | ... |
@@ -1235,13 +1235,13 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) {
|
| 1235 | 1235 |
d := s.AddDaemon(c, true, true) |
| 1236 | 1236 |
|
| 1237 | 1237 |
outs, err := d.Cmd("swarm", "update", "--autolock")
|
| 1238 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1238 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1239 | 1239 |
unlockKey := getUnlockKey(d, c, outs) |
| 1240 | 1240 |
|
| 1241 | 1241 |
// Rotate multiple times |
| 1242 | 1242 |
for i := 0; i != 3; i++ {
|
| 1243 | 1243 |
outs, err = d.Cmd("swarm", "unlock-key", "-q", "--rotate")
|
| 1244 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1244 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1245 | 1245 |
// Strip \n |
| 1246 | 1246 |
newUnlockKey := outs[:len(outs)-1] |
| 1247 | 1247 |
assert.Assert(c, newUnlockKey != "") |
| ... | ... |
@@ -1322,13 +1322,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
| 1322 | 1322 |
d3 := s.AddDaemon(c, true, true) |
| 1323 | 1323 |
|
| 1324 | 1324 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1325 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1325 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1326 | 1326 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1327 | 1327 |
|
| 1328 | 1328 |
// Rotate multiple times |
| 1329 | 1329 |
for i := 0; i != 3; i++ {
|
| 1330 | 1330 |
outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
|
| 1331 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1331 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1332 | 1332 |
// Strip \n |
| 1333 | 1333 |
newUnlockKey := outs[:len(outs)-1] |
| 1334 | 1334 |
assert.Assert(c, newUnlockKey != "") |
| ... | ... |
@@ -1387,7 +1387,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
| 1387 | 1387 |
continue |
| 1388 | 1388 |
} |
| 1389 | 1389 |
} |
| 1390 |
- assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
|
| 1390 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", outs))
|
|
| 1391 | 1391 |
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
| 1392 | 1392 |
break |
| 1393 | 1393 |
} |
| ... | ... |
@@ -1403,7 +1403,7 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) {
|
| 1403 | 1403 |
for i := 0; i < 2; i++ {
|
| 1404 | 1404 |
// set to lock |
| 1405 | 1405 |
outs, err := d.Cmd("swarm", "update", "--autolock")
|
| 1406 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1406 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1407 | 1407 |
assert.Assert(c, strings.Contains(outs, "docker swarm unlock")) |
| 1408 | 1408 |
unlockKey := getUnlockKey(d, c, outs) |
| 1409 | 1409 |
|
| ... | ... |
@@ -1416,7 +1416,7 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) {
|
| 1416 | 1416 |
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) |
| 1417 | 1417 |
|
| 1418 | 1418 |
outs, err = d.Cmd("swarm", "update", "--autolock=false")
|
| 1419 |
- assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
|
| 1419 |
+ assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs))
|
|
| 1420 | 1420 |
|
| 1421 | 1421 |
checkSwarmLockedToUnlocked(c, d) |
| 1422 | 1422 |
} |
| ... | ... |
@@ -1442,7 +1442,7 @@ func (s *DockerSwarmSuite) TestExtraHosts(c *testing.T) {
|
| 1442 | 1442 |
expectedOutput := "1.2.3.4\texample.com" |
| 1443 | 1443 |
out, err = d.Cmd("exec", id, "cat", "/etc/hosts")
|
| 1444 | 1444 |
assert.NilError(c, err, out) |
| 1445 |
- assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1445 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1446 | 1446 |
} |
| 1447 | 1447 |
|
| 1448 | 1448 |
func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *testing.T) {
|
| ... | ... |
@@ -1952,7 +1952,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *testing.T) {
|
| 1952 | 1952 |
}, |
| 1953 | 1953 |
Data: []byte("TESTINGDATA"),
|
| 1954 | 1954 |
}) |
| 1955 |
- assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
|
|
| 1955 |
+ assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id))
|
|
| 1956 | 1956 |
|
| 1957 | 1957 |
waitForEvent(c, d, "0", "-f scope=swarm", "secret create "+id, defaultRetryCount) |
| 1958 | 1958 |
|
| ... | ... |
@@ -1972,7 +1972,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
|
| 1972 | 1972 |
}, |
| 1973 | 1973 |
Data: []byte("TESTINGDATA"),
|
| 1974 | 1974 |
}) |
| 1975 |
- assert.Assert(c, id != "", check.Commentf("configs: %s", id))
|
|
| 1975 |
+ assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id))
|
|
| 1976 | 1976 |
|
| 1977 | 1977 |
waitForEvent(c, d, "0", "-f scope=swarm", "config create "+id, defaultRetryCount) |
| 1978 | 1978 |
|
| ... | ... |
@@ -1984,7 +1984,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
|
| 1984 | 1984 |
|
| 1985 | 1985 |
func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string {
|
| 1986 | 1986 |
unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
|
| 1987 |
- assert.Assert(c, err == nil, check.Commentf("%s", unlockKey))
|
|
| 1987 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%s", unlockKey))
|
|
| 1988 | 1988 |
unlockKey = strings.TrimSuffix(unlockKey, "\n") |
| 1989 | 1989 |
|
| 1990 | 1990 |
// Check that "docker swarm init --autolock" or "docker swarm update --autolock" |
| ... | ... |
@@ -38,7 +38,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
| 38 | 38 |
|
| 39 | 39 |
// we need to find the uid and gid of the remapped root from the daemon's root dir info |
| 40 | 40 |
uidgid := strings.Split(filepath.Base(s.d.Root), ".") |
| 41 |
- assert.Equal(c, len(uidgid), 2, check.Commentf("Should have gotten uid/gid strings from root dirname: %s", filepath.Base(s.d.Root)))
|
|
| 41 |
+ assert.Equal(c, len(uidgid), 2, fmt.Sprintf("Should have gotten uid/gid strings from root dirname: %s", filepath.Base(s.d.Root)))
|
|
| 42 | 42 |
uid, err := strconv.Atoi(uidgid[0]) |
| 43 | 43 |
assert.NilError(c, err, "Can't parse uid") |
| 44 | 44 |
gid, err := strconv.Atoi(uidgid[1]) |
| ... | ... |
@@ -60,7 +60,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
| 60 | 60 |
assert.Equal(c, statNotExists.GID(), uint32(gid), check.Commentf("Created directory not owned by remapped root GID"))
|
| 61 | 61 |
|
| 62 | 62 |
pid, err := s.d.Cmd("inspect", "--format={{.State.Pid}}", "userns")
|
| 63 |
- assert.Assert(c, err == nil, check.Commentf("Could not inspect running container: out: %q", pid))
|
|
| 63 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Could not inspect running container: out: %q", pid))
|
|
| 64 | 64 |
// check the uid and gid maps for the PID to ensure root is remapped |
| 65 | 65 |
// (cmd = cat /proc/<pid>/uid_map | grep -E '0\s+9999\s+1') |
| 66 | 66 |
_, err = RunCommandPipelineWithOutput( |
| ... | ... |
@@ -81,7 +81,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
| 81 | 81 |
|
| 82 | 82 |
// use host usernamespace |
| 83 | 83 |
out, err = s.d.Cmd("run", "-d", "--name", "userns_skip", "--userns", "host", "busybox", "sh", "-c", "touch /goofy/testfile; top")
|
| 84 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", out))
|
|
| 84 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out))
|
|
| 85 | 85 |
user = s.findUser(c, "userns_skip") |
| 86 | 86 |
// userns are skipped, user is root |
| 87 | 87 |
assert.Equal(c, user, "root") |
| ... | ... |
@@ -90,7 +90,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
| 90 | 90 |
// findUser finds the uid or name of the user of the first process that runs in a container |
| 91 | 91 |
func (s *DockerDaemonSuite) findUser(c *testing.T, container string) string {
|
| 92 | 92 |
out, err := s.d.Cmd("top", container)
|
| 93 |
- assert.Assert(c, err == nil, check.Commentf("Output: %s", out))
|
|
| 93 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out))
|
|
| 94 | 94 |
rows := strings.Split(out, "\n") |
| 95 | 95 |
if len(rows) < 2 {
|
| 96 | 96 |
// No process rows founds |
| ... | ... |
@@ -147,13 +147,13 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
| 147 | 147 |
|
| 148 | 148 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output |
| 149 | 149 |
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 150 |
- assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 151 |
- assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 150 |
+ assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected"))
|
|
| 151 |
+ assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected"))
|
|
| 152 | 152 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1") |
| 153 | 153 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1 |
| 154 | 154 |
assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 155 |
- assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 156 |
- assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 155 |
+ assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected"))
|
|
| 156 |
+ assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected"))
|
|
| 157 | 157 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0") |
| 158 | 158 |
// dangling=0 is same as dangling=false case |
| 159 | 159 |
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| ... | ... |
@@ -236,8 +236,8 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
| 236 | 236 |
name := strings.TrimSpace(out) |
| 237 | 237 |
|
| 238 | 238 |
out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name)
|
| 239 |
- assert.Assert(c, err != nil, check.Commentf("Output: %s", out))
|
|
| 240 |
- assert.Equal(c, exitCode, 1, check.Commentf("Output: %s", out))
|
|
| 239 |
+ assert.Assert(c, err != nil, fmt.Sprintf("Output: %s", out))
|
|
| 240 |
+ assert.Equal(c, exitCode, 1, fmt.Sprintf("Output: %s", out))
|
|
| 241 | 241 |
assert.Assert(c, strings.Contains(out, "Template parsing error")) |
| 242 | 242 |
} |
| 243 | 243 |
|
| ... | ... |
@@ -325,11 +325,11 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
| 325 | 325 |
assert.Assert(c, !strings.Contains(out, "testvolcreatelabel-2\n"), check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
| 326 | 326 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=non-exist") |
| 327 | 327 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 328 |
- assert.Equal(c, len(outArr), 1, check.Commentf("\n%s", out))
|
|
| 328 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
|
| 329 | 329 |
|
| 330 | 330 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=non-exist") |
| 331 | 331 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 332 |
- assert.Equal(c, len(outArr), 1, check.Commentf("\n%s", out))
|
|
| 332 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
|
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
| ... | ... |
@@ -349,17 +349,17 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
| 349 | 349 |
// filter with driver=invaliddriver |
| 350 | 350 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=invaliddriver") |
| 351 | 351 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 352 |
- assert.Equal(c, len(outArr), 1, check.Commentf("\n%s", out))
|
|
| 352 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
|
| 353 | 353 |
|
| 354 | 354 |
// filter with driver=loca |
| 355 | 355 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=loca") |
| 356 | 356 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 357 |
- assert.Equal(c, len(outArr), 1, check.Commentf("\n%s", out))
|
|
| 357 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
|
| 358 | 358 |
|
| 359 | 359 |
// filter with driver= |
| 360 | 360 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=") |
| 361 | 361 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 362 |
- assert.Equal(c, len(outArr), 1, check.Commentf("\n%s", out))
|
|
| 362 |
+ assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
|
| 363 | 363 |
} |
| 364 | 364 |
|
| 365 | 365 |
func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *testing.T) {
|
| ... | ... |
@@ -475,7 +475,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
|
| 475 | 475 |
assert.Assert(c, strings.Contains(strings.TrimSpace(out), data1)) |
| 476 | 476 |
assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) |
| 477 | 477 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-d", "busybox", "top")
|
| 478 |
- assert.Assert(c, err == nil, check.Commentf("Out: %s", out))
|
|
| 478 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Out: %s", out))
|
|
| 479 | 479 |
|
| 480 | 480 |
// Only the second volume will be referenced, this is backward compatible |
| 481 | 481 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
|
| ... | ... |
@@ -517,7 +517,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T |
| 517 | 517 |
assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) |
| 518 | 518 |
// /tmp/data is automatically created, because we are not using the modern mount API here |
| 519 | 519 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-v", "/tmp/data:/tmp/data", "-d", "busybox", "top")
|
| 520 |
- assert.Assert(c, err == nil, check.Commentf("Out: %s", out))
|
|
| 520 |
+ assert.Assert(c, err == nil, fmt.Sprintf("Out: %s", out))
|
|
| 521 | 521 |
|
| 522 | 522 |
// No volume will be referenced (mount is /tmp/data), this is backward compatible |
| 523 | 523 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
|
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerHubPullSuite) TearDownTest(c *testing.T) {
|
| 71 | 71 |
// output. The function fails the test when the command returns an error. |
| 72 | 72 |
func (s *DockerHubPullSuite) Cmd(c *testing.T, name string, arg ...string) string {
|
| 73 | 73 |
out, err := s.CmdWithError(name, arg...) |
| 74 |
- assert.Assert(c, err == nil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
|
|
| 74 |
+ assert.Assert(c, err == nil, fmt.Sprintf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
|
|
| 75 | 75 |
return out |
| 76 | 76 |
} |
| 77 | 77 |
|
| ... | ... |
@@ -78,7 +78,7 @@ func inspectFieldAndUnmarshall(c *testing.T, name, field string, output interfac |
| 78 | 78 |
str := inspectFieldJSON(c, name, field) |
| 79 | 79 |
err := json.Unmarshal([]byte(str), output) |
| 80 | 80 |
if c != nil {
|
| 81 |
- assert.Assert(c, err == nil, check.Commentf("failed to unmarshal: %v", err))
|
|
| 81 |
+ assert.Assert(c, err == nil, fmt.Sprintf("failed to unmarshal: %v", err))
|
|
| 82 | 82 |
} |
| 83 | 83 |
} |
| 84 | 84 |
|
| ... | ... |
@@ -455,7 +455,7 @@ func reducedCheck(r reducer, funcs ...checkF) checkF {
|
| 455 | 455 |
comments = append(comments, comment.CheckCommentString()) |
| 456 | 456 |
} |
| 457 | 457 |
} |
| 458 |
- return r(values...), check.Commentf("%v", strings.Join(comments, ", "))
|
|
| 458 |
+ return r(values...), fmt.Sprintf("%v", strings.Join(comments, ", "))
|
|
| 459 | 459 |
} |
| 460 | 460 |
} |
| 461 | 461 |
|