sed -E -i 's#\bc\.Assert\(#assert.Assert(c, #g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_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_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_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_prune_unix_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_health_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" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 1f69c6254011bf654080d7e85465f43354a33910)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -53,7 +53,7 @@ func (s *DockerSuite) TestContainerAPIGetAll(c *check.C) {
|
| 53 | 53 |
assert.NilError(c, err) |
| 54 | 54 |
assert.Equal(c, len(containers), startCount+1) |
| 55 | 55 |
actual := containers[0].Names[0] |
| 56 |
- c.Assert(actual, checker.Equals, "/"+name) |
|
| 56 |
+ assert.Assert(c, actual, checker.Equals, "/"+name) |
|
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
// regression test for empty json field being omitted #13691 |
| ... | ... |
@@ -121,7 +121,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *check.C) {
|
| 121 | 121 |
break |
| 122 | 122 |
} |
| 123 | 123 |
} |
| 124 |
- c.Assert(found, checker.True, check.Commentf("The created test file has not been found in the exported image"))
|
|
| 124 |
+ assert.Assert(c, found, checker.True, check.Commentf("The created test file has not been found in the exported image"))
|
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
func (s *DockerSuite) TestContainerAPIGetChanges(c *check.C) {
|
| ... | ... |
@@ -144,7 +144,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *check.C) {
|
| 144 | 144 |
success = true |
| 145 | 145 |
} |
| 146 | 146 |
} |
| 147 |
- c.Assert(success, checker.True, check.Commentf("/etc/passwd has been removed but is not present in the diff"))
|
|
| 147 |
+ assert.Assert(c, success, checker.True, check.Commentf("/etc/passwd has been removed but is not present in the diff"))
|
|
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 | 150 |
func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
| ... | ... |
@@ -215,12 +215,12 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
| 215 | 215 |
|
| 216 | 216 |
// Now remove without `-f` and make sure we are still pulling stats |
| 217 | 217 |
_, _, err = dockerCmdWithError("rm", id)
|
| 218 |
- c.Assert(err, checker.Not(checker.IsNil), check.Commentf("rm should have failed but didn't"))
|
|
| 218 |
+ assert.Assert(c, err, checker.Not(checker.IsNil), check.Commentf("rm should have failed but didn't"))
|
|
| 219 | 219 |
_, err = buf.ReadTimeout(b, 2*time.Second) |
| 220 | 220 |
assert.NilError(c, err) |
| 221 | 221 |
|
| 222 | 222 |
dockerCmd(c, "rm", "-f", id) |
| 223 |
- c.Assert(<-chErr, checker.IsNil) |
|
| 223 |
+ assert.Assert(c, <-chErr, checker.IsNil) |
|
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
// ChannelBuffer holds a chan of byte array that can be populate in a goroutine. |
| ... | ... |
@@ -389,7 +389,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *check.C) {
|
| 389 | 389 |
assert.NilError(c, err) |
| 390 | 390 |
|
| 391 | 391 |
pausedContainers = getPaused(c) |
| 392 |
- c.Assert(pausedContainers, checker.HasLen, 0, check.Commentf("There should be no paused container."))
|
|
| 392 |
+ assert.Assert(c, pausedContainers, checker.HasLen, 0, check.Commentf("There should be no paused container."))
|
|
| 393 | 393 |
} |
| 394 | 394 |
|
| 395 | 395 |
func (s *DockerSuite) TestContainerAPITop(c *check.C) {
|
| ... | ... |
@@ -405,14 +405,14 @@ func (s *DockerSuite) TestContainerAPITop(c *check.C) {
|
| 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 |
- c.Assert(top.Titles, checker.HasLen, 11, check.Commentf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles))
|
|
| 408 |
+ assert.Assert(c, top.Titles, checker.HasLen, 11, check.Commentf("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 |
- c.Assert(top.Processes, checker.HasLen, 2, check.Commentf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 414 |
- c.Assert(top.Processes[0][10], checker.Equals, "/bin/sh -c top") |
|
| 415 |
- c.Assert(top.Processes[1][10], checker.Equals, "top") |
|
| 413 |
+ assert.Assert(c, top.Processes, checker.HasLen, 2, check.Commentf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 414 |
+ assert.Assert(c, top.Processes[0][10], checker.Equals, "/bin/sh -c top") |
|
| 415 |
+ assert.Assert(c, top.Processes[1][10], checker.Equals, "top") |
|
| 416 | 416 |
} |
| 417 | 417 |
|
| 418 | 418 |
func (s *DockerSuite) TestContainerAPITopWindows(c *check.C) {
|
| ... | ... |
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestContainerAPICommit(c *check.C) {
|
| 462 | 462 |
assert.NilError(c, err) |
| 463 | 463 |
|
| 464 | 464 |
cmd := inspectField(c, img.ID, "Config.Cmd") |
| 465 |
- c.Assert(cmd, checker.Equals, "[/bin/sh -c touch /test]", check.Commentf("got wrong Cmd from commit: %q", cmd))
|
|
| 465 |
+ assert.Assert(c, cmd, checker.Equals, "[/bin/sh -c touch /test]", check.Commentf("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") |
| ... | ... |
@@ -488,13 +488,13 @@ func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *check.C) {
|
| 488 | 488 |
assert.NilError(c, err) |
| 489 | 489 |
|
| 490 | 490 |
label1 := inspectFieldMap(c, img.ID, "Config.Labels", "key1") |
| 491 |
- c.Assert(label1, checker.Equals, "value1") |
|
| 491 |
+ assert.Assert(c, label1, checker.Equals, "value1") |
|
| 492 | 492 |
|
| 493 | 493 |
label2 := inspectFieldMap(c, img.ID, "Config.Labels", "key2") |
| 494 |
- c.Assert(label2, checker.Equals, "value2") |
|
| 494 |
+ assert.Assert(c, label2, checker.Equals, "value2") |
|
| 495 | 495 |
|
| 496 | 496 |
cmd := inspectField(c, img.ID, "Config.Cmd") |
| 497 |
- c.Assert(cmd, checker.Equals, "[/bin/sh -c touch /test]", check.Commentf("got wrong Cmd from commit: %q", cmd))
|
|
| 497 |
+ assert.Assert(c, cmd, checker.Equals, "[/bin/sh -c touch /test]", check.Commentf("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") |
| ... | ... |
@@ -577,10 +577,10 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *check.C) {
|
| 577 | 577 |
_, err = cli.ContainerCreate(context.Background(), &config, &containertypes.HostConfig{}, &networkingConfig, "")
|
| 578 | 578 |
msg := err.Error() |
| 579 | 579 |
// network name order in error message is not deterministic |
| 580 |
- c.Assert(msg, checker.Contains, "Container cannot be connected to network endpoints") |
|
| 581 |
- c.Assert(msg, checker.Contains, "net1") |
|
| 582 |
- c.Assert(msg, checker.Contains, "net2") |
|
| 583 |
- c.Assert(msg, checker.Contains, "net3") |
|
| 580 |
+ assert.Assert(c, msg, checker.Contains, "Container cannot be connected to network endpoints") |
|
| 581 |
+ assert.Assert(c, msg, checker.Contains, "net1") |
|
| 582 |
+ assert.Assert(c, msg, checker.Contains, "net2") |
|
| 583 |
+ assert.Assert(c, msg, checker.Contains, "net3") |
|
| 584 | 584 |
} |
| 585 | 585 |
|
| 586 | 586 |
func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *check.C) {
|
| ... | ... |
@@ -615,7 +615,7 @@ func UtilCreateNetworkMode(c *check.C, networkMode containertypes.NetworkMode) {
|
| 615 | 615 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 616 | 616 |
assert.NilError(c, err) |
| 617 | 617 |
|
| 618 |
- c.Assert(containerJSON.HostConfig.NetworkMode, checker.Equals, containertypes.NetworkMode(networkMode), check.Commentf("Mismatched NetworkMode"))
|
|
| 618 |
+ assert.Assert(c, containerJSON.HostConfig.NetworkMode, checker.Equals, containertypes.NetworkMode(networkMode), check.Commentf("Mismatched NetworkMode"))
|
|
| 619 | 619 |
} |
| 620 | 620 |
|
| 621 | 621 |
func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *check.C) {
|
| ... | ... |
@@ -646,7 +646,7 @@ func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *check.C) {
|
| 646 | 646 |
assert.Equal(c, out, "512") |
| 647 | 647 |
|
| 648 | 648 |
outCpuset := inspectField(c, containerJSON.ID, "HostConfig.CpusetCpus") |
| 649 |
- c.Assert(outCpuset, checker.Equals, "0") |
|
| 649 |
+ assert.Assert(c, outCpuset, checker.Equals, "0") |
|
| 650 | 650 |
} |
| 651 | 651 |
|
| 652 | 652 |
func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) {
|
| ... | ... |
@@ -656,7 +656,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) {
|
| 656 | 656 |
|
| 657 | 657 |
create := func(ct string) (*http.Response, io.ReadCloser, error) {
|
| 658 | 658 |
jsonData := bytes.NewBuffer(nil) |
| 659 |
- c.Assert(json.NewEncoder(jsonData).Encode(config), checker.IsNil) |
|
| 659 |
+ assert.Assert(c, json.NewEncoder(jsonData).Encode(config), checker.IsNil) |
|
| 660 | 660 |
return request.Post("/containers/create", request.RawContent(ioutil.NopCloser(jsonData)), request.ContentType(ct))
|
| 661 | 661 |
} |
| 662 | 662 |
|
| ... | ... |
@@ -668,7 +668,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) {
|
| 668 | 668 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 669 | 669 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 670 | 670 |
} else {
|
| 671 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 671 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 672 | 672 |
} |
| 673 | 673 |
body.Close() |
| 674 | 674 |
|
| ... | ... |
@@ -678,7 +678,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) {
|
| 678 | 678 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 679 | 679 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 680 | 680 |
} else {
|
| 681 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 681 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 682 | 682 |
} |
| 683 | 683 |
body.Close() |
| 684 | 684 |
|
| ... | ... |
@@ -708,12 +708,12 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *check.C) {
|
| 708 | 708 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 709 | 709 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 710 | 710 |
} else {
|
| 711 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 711 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 712 | 712 |
} |
| 713 | 713 |
|
| 714 | 714 |
b, err := request.ReadBody(body) |
| 715 | 715 |
assert.NilError(c, err) |
| 716 |
- c.Assert(string(b[:]), checker.Contains, "invalid port") |
|
| 716 |
+ assert.Assert(c, string(b[:]), checker.Contains, "invalid port") |
|
| 717 | 717 |
} |
| 718 | 718 |
|
| 719 | 719 |
func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *check.C) {
|
| ... | ... |
@@ -732,12 +732,12 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *check.C) |
| 732 | 732 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 733 | 733 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 734 | 734 |
} else {
|
| 735 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 735 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 736 | 736 |
} |
| 737 | 737 |
|
| 738 | 738 |
b, err := request.ReadBody(body) |
| 739 | 739 |
assert.NilError(c, err) |
| 740 |
- c.Assert(string(b[:]), checker.Contains, "invalid restart policy") |
|
| 740 |
+ assert.Assert(c, string(b[:]), checker.Contains, "invalid restart policy") |
|
| 741 | 741 |
} |
| 742 | 742 |
|
| 743 | 743 |
func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *check.C) {
|
| ... | ... |
@@ -756,12 +756,12 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *check.C) {
|
| 756 | 756 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 757 | 757 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 758 | 758 |
} else {
|
| 759 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 759 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 760 | 760 |
} |
| 761 | 761 |
|
| 762 | 762 |
b, err := request.ReadBody(body) |
| 763 | 763 |
assert.NilError(c, err) |
| 764 |
- c.Assert(string(b[:]), checker.Contains, "maximum retry count cannot be used with restart policy") |
|
| 764 |
+ assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be used with restart policy") |
|
| 765 | 765 |
} |
| 766 | 766 |
|
| 767 | 767 |
func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *check.C) {
|
| ... | ... |
@@ -780,12 +780,12 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *check.C |
| 780 | 780 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 781 | 781 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 782 | 782 |
} else {
|
| 783 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 783 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 784 | 784 |
} |
| 785 | 785 |
|
| 786 | 786 |
b, err := request.ReadBody(body) |
| 787 | 787 |
assert.NilError(c, err) |
| 788 |
- c.Assert(string(b[:]), checker.Contains, "maximum retry count cannot be negative") |
|
| 788 |
+ assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be negative") |
|
| 789 | 789 |
} |
| 790 | 790 |
|
| 791 | 791 |
func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *check.C) {
|
| ... | ... |
@@ -840,14 +840,14 @@ func (s *DockerSuite) TestContainerAPIPostCreateNull(c *check.C) {
|
| 840 | 840 |
ID string |
| 841 | 841 |
} |
| 842 | 842 |
var container createResp |
| 843 |
- c.Assert(json.Unmarshal(b, &container), checker.IsNil) |
|
| 843 |
+ assert.Assert(c, json.Unmarshal(b, &container), checker.IsNil) |
|
| 844 | 844 |
out := inspectField(c, container.ID, "HostConfig.CpusetCpus") |
| 845 | 845 |
assert.Equal(c, out, "") |
| 846 | 846 |
|
| 847 | 847 |
outMemory := inspectField(c, container.ID, "HostConfig.Memory") |
| 848 |
- c.Assert(outMemory, checker.Equals, "0") |
|
| 848 |
+ assert.Assert(c, outMemory, checker.Equals, "0") |
|
| 849 | 849 |
outMemorySwap := inspectField(c, container.ID, "HostConfig.MemorySwap") |
| 850 |
- c.Assert(outMemorySwap, checker.Equals, "0") |
|
| 850 |
+ assert.Assert(c, outMemorySwap, checker.Equals, "0") |
|
| 851 | 851 |
} |
| 852 | 852 |
|
| 853 | 853 |
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
| ... | ... |
@@ -864,14 +864,14 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
| 864 | 864 |
res, body, err := request.Post("/containers/create", request.RawString(config), request.JSON)
|
| 865 | 865 |
assert.NilError(c, err) |
| 866 | 866 |
b, err2 := request.ReadBody(body) |
| 867 |
- c.Assert(err2, checker.IsNil) |
|
| 867 |
+ assert.Assert(c, err2, checker.IsNil) |
|
| 868 | 868 |
|
| 869 | 869 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 870 | 870 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 871 | 871 |
} else {
|
| 872 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 872 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 873 | 873 |
} |
| 874 |
- c.Assert(string(b), checker.Contains, "Minimum memory limit allowed is 4MB") |
|
| 874 |
+ assert.Assert(c, string(b), checker.Contains, "Minimum memory limit allowed is 4MB") |
|
| 875 | 875 |
} |
| 876 | 876 |
|
| 877 | 877 |
func (s *DockerSuite) TestContainerAPIRename(c *check.C) {
|
| ... | ... |
@@ -888,7 +888,7 @@ func (s *DockerSuite) TestContainerAPIRename(c *check.C) {
|
| 888 | 888 |
assert.NilError(c, err) |
| 889 | 889 |
|
| 890 | 890 |
name := inspectField(c, containerID, "Name") |
| 891 |
- c.Assert(name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container"))
|
|
| 891 |
+ assert.Assert(c, name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container"))
|
|
| 892 | 892 |
} |
| 893 | 893 |
|
| 894 | 894 |
func (s *DockerSuite) TestContainerAPIKill(c *check.C) {
|
| ... | ... |
@@ -903,7 +903,7 @@ func (s *DockerSuite) TestContainerAPIKill(c *check.C) {
|
| 903 | 903 |
assert.NilError(c, err) |
| 904 | 904 |
|
| 905 | 905 |
state := inspectField(c, name, "State.Running") |
| 906 |
- c.Assert(state, checker.Equals, "false", check.Commentf("got wrong State from container %s: %q", name, state))
|
|
| 906 |
+ assert.Assert(c, state, checker.Equals, "false", check.Commentf("got wrong State from container %s: %q", name, state))
|
|
| 907 | 907 |
} |
| 908 | 908 |
|
| 909 | 909 |
func (s *DockerSuite) TestContainerAPIRestart(c *check.C) {
|
| ... | ... |
@@ -917,7 +917,7 @@ func (s *DockerSuite) TestContainerAPIRestart(c *check.C) {
|
| 917 | 917 |
err = cli.ContainerRestart(context.Background(), name, &timeout) |
| 918 | 918 |
assert.NilError(c, err) |
| 919 | 919 |
|
| 920 |
- c.Assert(waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil)
|
|
| 920 |
+ assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil)
|
|
| 921 | 921 |
} |
| 922 | 922 |
|
| 923 | 923 |
func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *check.C) {
|
| ... | ... |
@@ -933,7 +933,7 @@ func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *check.C) {
|
| 933 | 933 |
err = cli.ContainerRestart(context.Background(), name, nil) |
| 934 | 934 |
assert.NilError(c, err) |
| 935 | 935 |
|
| 936 |
- c.Assert(waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil)
|
|
| 936 |
+ assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil)
|
|
| 937 | 937 |
} |
| 938 | 938 |
|
| 939 | 939 |
func (s *DockerSuite) TestContainerAPIStart(c *check.C) {
|
| ... | ... |
@@ -973,7 +973,7 @@ func (s *DockerSuite) TestContainerAPIStop(c *check.C) {
|
| 973 | 973 |
|
| 974 | 974 |
err = cli.ContainerStop(context.Background(), name, &timeout) |
| 975 | 975 |
assert.NilError(c, err) |
| 976 |
- c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 976 |
+ assert.Assert(c, waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 977 | 977 |
|
| 978 | 978 |
// second call to start should give 304 |
| 979 | 979 |
// maybe add ContainerStartWithRaw to test it |
| ... | ... |
@@ -1000,7 +1000,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *check.C) {
|
| 1000 | 1000 |
case err = <-errC: |
| 1001 | 1001 |
assert.NilError(c, err) |
| 1002 | 1002 |
case waitres := <-waitresC: |
| 1003 |
- c.Assert(waitres.StatusCode, checker.Equals, int64(0)) |
|
| 1003 |
+ assert.Assert(c, waitres.StatusCode, checker.Equals, int64(0)) |
|
| 1004 | 1004 |
} |
| 1005 | 1005 |
} |
| 1006 | 1006 |
|
| ... | ... |
@@ -1044,7 +1044,7 @@ func (s *DockerSuite) TestContainerAPICopyPre124(c *check.C) {
|
| 1044 | 1044 |
break |
| 1045 | 1045 |
} |
| 1046 | 1046 |
} |
| 1047 |
- c.Assert(found, checker.True) |
|
| 1047 |
+ assert.Assert(c, found, checker.True) |
|
| 1048 | 1048 |
} |
| 1049 | 1049 |
|
| 1050 | 1050 |
func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *check.C) {
|
| ... | ... |
@@ -1061,11 +1061,11 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *check.C) {
|
| 1061 | 1061 |
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
|
| 1062 | 1062 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 1063 | 1063 |
} else {
|
| 1064 |
- c.Assert(res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 1064 |
+ assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK) |
|
| 1065 | 1065 |
} |
| 1066 | 1066 |
b, err := request.ReadBody(body) |
| 1067 | 1067 |
assert.NilError(c, err) |
| 1068 |
- c.Assert(string(b), checker.Matches, "Path cannot be empty\n") |
|
| 1068 |
+ assert.Assert(c, string(b), checker.Matches, "Path cannot be empty\n") |
|
| 1069 | 1069 |
} |
| 1070 | 1070 |
|
| 1071 | 1071 |
func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *check.C) {
|
| ... | ... |
@@ -1086,7 +1086,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *check.C) |
| 1086 | 1086 |
} |
| 1087 | 1087 |
b, err := request.ReadBody(body) |
| 1088 | 1088 |
assert.NilError(c, err) |
| 1089 |
- c.Assert(string(b), checker.Matches, "Could not find the file /notexist in container "+name+"\n") |
|
| 1089 |
+ assert.Assert(c, string(b), checker.Matches, "Could not find the file /notexist in container "+name+"\n") |
|
| 1090 | 1090 |
} |
| 1091 | 1091 |
|
| 1092 | 1092 |
func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *check.C) {
|
| ... | ... |
@@ -1153,10 +1153,10 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *check.C) {
|
| 1153 | 1153 |
out, _ = dockerCmd(c, "run", "--link", "tlink1:tlink1", "--name", "tlink2", "-d", "busybox", "top") |
| 1154 | 1154 |
|
| 1155 | 1155 |
id2 := strings.TrimSpace(out) |
| 1156 |
- c.Assert(waitRun(id2), checker.IsNil) |
|
| 1156 |
+ assert.Assert(c, waitRun(id2), checker.IsNil) |
|
| 1157 | 1157 |
|
| 1158 | 1158 |
links := inspectFieldJSON(c, id2, "HostConfig.Links") |
| 1159 |
- c.Assert(links, checker.Equals, "[\"/tlink1:/tlink2/tlink1\"]", check.Commentf("expected to have links between containers"))
|
|
| 1159 |
+ assert.Assert(c, links, checker.Equals, "[\"/tlink1:/tlink2/tlink1\"]", check.Commentf("expected to have links between containers"))
|
|
| 1160 | 1160 |
|
| 1161 | 1161 |
removeOptions := types.ContainerRemoveOptions{
|
| 1162 | 1162 |
RemoveLinks: true, |
| ... | ... |
@@ -1170,7 +1170,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *check.C) {
|
| 1170 | 1170 |
assert.NilError(c, err) |
| 1171 | 1171 |
|
| 1172 | 1172 |
linksPostRm := inspectFieldJSON(c, id2, "HostConfig.Links") |
| 1173 |
- c.Assert(linksPostRm, checker.Equals, "null", check.Commentf("call to api deleteContainer links should have removed the specified links"))
|
|
| 1173 |
+ assert.Assert(c, linksPostRm, checker.Equals, "null", check.Commentf("call to api deleteContainer links should have removed the specified links"))
|
|
| 1174 | 1174 |
} |
| 1175 | 1175 |
|
| 1176 | 1176 |
func (s *DockerSuite) TestContainerAPIDeleteConflict(c *check.C) {
|
| ... | ... |
@@ -1219,7 +1219,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) {
|
| 1219 | 1219 |
assert.NilError(c, err) |
| 1220 | 1220 |
|
| 1221 | 1221 |
_, err = os.Stat(source) |
| 1222 |
- c.Assert(os.IsNotExist(err), checker.True, check.Commentf("expected to get ErrNotExist error, got %v", err))
|
|
| 1222 |
+ assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("expected to get ErrNotExist error, got %v", err))
|
|
| 1223 | 1223 |
} |
| 1224 | 1224 |
|
| 1225 | 1225 |
// Regression test for https://github.com/docker/docker/issues/6231 |
| ... | ... |
@@ -1238,7 +1238,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *check.C) {
|
| 1238 | 1238 |
req.ContentLength = -1 |
| 1239 | 1239 |
return nil |
| 1240 | 1240 |
})) |
| 1241 |
- c.Assert(err, checker.IsNil, check.Commentf("error creating container with chunked encoding"))
|
|
| 1241 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error creating container with chunked encoding"))
|
|
| 1242 | 1242 |
defer resp.Body.Close() |
| 1243 | 1243 |
assert.Equal(c, resp.StatusCode, http.StatusCreated) |
| 1244 | 1244 |
} |
| ... | ... |
@@ -1247,7 +1247,7 @@ func (s *DockerSuite) TestContainerAPIPostContainerStop(c *check.C) {
|
| 1247 | 1247 |
out := runSleepingContainer(c) |
| 1248 | 1248 |
|
| 1249 | 1249 |
containerID := strings.TrimSpace(out) |
| 1250 |
- c.Assert(waitRun(containerID), checker.IsNil) |
|
| 1250 |
+ assert.Assert(c, waitRun(containerID), checker.IsNil) |
|
| 1251 | 1251 |
|
| 1252 | 1252 |
cli, err := client.NewClientWithOpts(client.FromEnv) |
| 1253 | 1253 |
assert.NilError(c, err) |
| ... | ... |
@@ -1255,7 +1255,7 @@ func (s *DockerSuite) TestContainerAPIPostContainerStop(c *check.C) {
|
| 1255 | 1255 |
|
| 1256 | 1256 |
err = cli.ContainerStop(context.Background(), containerID, nil) |
| 1257 | 1257 |
assert.NilError(c, err) |
| 1258 |
- c.Assert(waitInspect(containerID, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 1258 |
+ assert.Assert(c, waitInspect(containerID, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 1259 | 1259 |
} |
| 1260 | 1260 |
|
| 1261 | 1261 |
// #14170 |
| ... | ... |
@@ -1457,7 +1457,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check. |
| 1457 | 1457 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1458 | 1458 |
assert.NilError(c, err) |
| 1459 | 1459 |
|
| 1460 |
- c.Assert(containerJSON.HostConfig.ShmSize, check.Equals, defaultSHMSize) |
|
| 1460 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, defaultSHMSize) |
|
| 1461 | 1461 |
|
| 1462 | 1462 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1463 | 1463 |
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`) |
| ... | ... |
@@ -1484,7 +1484,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
|
| 1484 | 1484 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1485 | 1485 |
assert.NilError(c, err) |
| 1486 | 1486 |
|
| 1487 |
- c.Assert(containerJSON.HostConfig.ShmSize, check.Equals, int64(67108864)) |
|
| 1487 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, int64(67108864)) |
|
| 1488 | 1488 |
|
| 1489 | 1489 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1490 | 1490 |
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`) |
| ... | ... |
@@ -1515,7 +1515,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
|
| 1515 | 1515 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1516 | 1516 |
assert.NilError(c, err) |
| 1517 | 1517 |
|
| 1518 |
- c.Assert(containerJSON.HostConfig.ShmSize, check.Equals, int64(1073741824)) |
|
| 1518 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, int64(1073741824)) |
|
| 1519 | 1519 |
|
| 1520 | 1520 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1521 | 1521 |
shmRegex := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=1048576k`) |
| ... | ... |
@@ -1542,9 +1542,9 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted( |
| 1542 | 1542 |
assert.NilError(c, err) |
| 1543 | 1543 |
|
| 1544 | 1544 |
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.31") {
|
| 1545 |
- c.Assert(*containerJSON.HostConfig.MemorySwappiness, check.Equals, int64(-1)) |
|
| 1545 |
+ assert.Assert(c, *containerJSON.HostConfig.MemorySwappiness, check.Equals, int64(-1)) |
|
| 1546 | 1546 |
} else {
|
| 1547 |
- c.Assert(containerJSON.HostConfig.MemorySwappiness, check.IsNil) |
|
| 1547 |
+ assert.Assert(c, containerJSON.HostConfig.MemorySwappiness, check.IsNil) |
|
| 1548 | 1548 |
} |
| 1549 | 1549 |
} |
| 1550 | 1550 |
|
| ... | ... |
@@ -1614,7 +1614,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *check.C) {
|
| 1614 | 1614 |
err = cli.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
|
| 1615 | 1615 |
assert.NilError(c, err) |
| 1616 | 1616 |
|
| 1617 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 1617 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 1618 | 1618 |
|
| 1619 | 1619 |
type b struct {
|
| 1620 | 1620 |
stats types.ContainerStats |
| ... | ... |
@@ -1636,7 +1636,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *check.C) {
|
| 1636 | 1636 |
case <-time.After(2 * time.Second): |
| 1637 | 1637 |
c.Fatal("stream was not closed after container was removed")
|
| 1638 | 1638 |
case sr := <-bc: |
| 1639 |
- c.Assert(sr.err, checker.IsNil) |
|
| 1639 |
+ assert.Assert(c, sr.err, checker.IsNil) |
|
| 1640 | 1640 |
sr.stats.Body.Close() |
| 1641 | 1641 |
} |
| 1642 | 1642 |
} |
| ... | ... |
@@ -2052,7 +2052,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) {
|
| 2052 | 2052 |
assert.NilError(c, err) |
| 2053 | 2053 |
defer os.RemoveAll(tmpDir3) |
| 2054 | 2054 |
|
| 2055 |
- c.Assert(mount.Mount(tmpDir3, tmpDir3, "none", "bind,shared"), checker.IsNil) |
|
| 2055 |
+ assert.Assert(c, mount.Mount(tmpDir3, tmpDir3, "none", "bind,shared"), checker.IsNil) |
|
| 2056 | 2056 |
|
| 2057 | 2057 |
cases = append(cases, []testCase{
|
| 2058 | 2058 |
{
|
| ... | ... |
@@ -2219,7 +2219,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *check.C) {
|
| 2219 | 2219 |
assert.NilError(c, err) |
| 2220 | 2220 |
out, _ := dockerCmd(c, "start", "-a", cName) |
| 2221 | 2221 |
for _, option := range x.expectedOptions {
|
| 2222 |
- c.Assert(out, checker.Contains, option) |
|
| 2222 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 2223 | 2223 |
} |
| 2224 | 2224 |
} |
| 2225 | 2225 |
} |
| ... | ... |
@@ -17,7 +17,7 @@ func (s *DockerSwarmSuite) TestAPISwarmListNodes(c *check.C) {
|
| 17 | 17 |
d3 := s.AddDaemon(c, true, false) |
| 18 | 18 |
|
| 19 | 19 |
nodes := d1.ListNodes(c) |
| 20 |
- c.Assert(len(nodes), checker.Equals, 3, check.Commentf("nodes: %#v", nodes))
|
|
| 20 |
+ assert.Assert(c, len(nodes), checker.Equals, 3, check.Commentf("nodes: %#v", nodes))
|
|
| 21 | 21 |
|
| 22 | 22 |
loop0: |
| 23 | 23 |
for _, n := range nodes {
|
| ... | ... |
@@ -40,7 +40,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeUpdate(c *check.C) {
|
| 40 | 40 |
}) |
| 41 | 41 |
|
| 42 | 42 |
n := d.GetNode(c, nodes[0].ID) |
| 43 |
- c.Assert(n.Spec.Availability, checker.Equals, swarm.NodeAvailabilityPause) |
|
| 43 |
+ assert.Assert(c, n.Spec.Availability, checker.Equals, swarm.NodeAvailabilityPause) |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) {
|
| ... | ... |
@@ -50,7 +50,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) {
|
| 50 | 50 |
_ = s.AddDaemon(c, true, false) |
| 51 | 51 |
|
| 52 | 52 |
nodes := d1.ListNodes(c) |
| 53 |
- c.Assert(len(nodes), checker.Equals, 3, check.Commentf("nodes: %#v", nodes))
|
|
| 53 |
+ assert.Assert(c, len(nodes), checker.Equals, 3, check.Commentf("nodes: %#v", nodes))
|
|
| 54 | 54 |
|
| 55 | 55 |
// Getting the info so we can take the NodeID |
| 56 | 56 |
d2Info := d2.SwarmInfo(c) |
| ... | ... |
@@ -59,7 +59,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) {
|
| 59 | 59 |
d1.RemoveNode(c, d2Info.NodeID, true) |
| 60 | 60 |
|
| 61 | 61 |
nodes = d1.ListNodes(c) |
| 62 |
- c.Assert(len(nodes), checker.Equals, 2, check.Commentf("nodes: %#v", nodes))
|
|
| 62 |
+ assert.Assert(c, len(nodes), checker.Equals, 2, check.Commentf("nodes: %#v", nodes))
|
|
| 63 | 63 |
|
| 64 | 64 |
// Restart the node that was removed |
| 65 | 65 |
d2.RestartNode(c) |
| ... | ... |
@@ -69,7 +69,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) {
|
| 69 | 69 |
|
| 70 | 70 |
// Make sure the node didn't rejoin |
| 71 | 71 |
nodes = d1.ListNodes(c) |
| 72 |
- c.Assert(len(nodes), checker.Equals, 2, check.Commentf("nodes: %#v", nodes))
|
|
| 72 |
+ assert.Assert(c, len(nodes), checker.Equals, 2, check.Commentf("nodes: %#v", nodes))
|
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
func (s *DockerSwarmSuite) TestAPISwarmNodeDrainPause(c *check.C) {
|
| ... | ... |
@@ -147,7 +147,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
|
| 147 | 147 |
stdout, err := cmd.StdoutPipe() |
| 148 | 148 |
assert.NilError(c, err) |
| 149 | 149 |
defer stdout.Close() |
| 150 |
- c.Assert(cmd.Start(), check.IsNil) |
|
| 150 |
+ assert.Assert(c, cmd.Start(), check.IsNil) |
|
| 151 | 151 |
defer func() {
|
| 152 | 152 |
cmd.Process.Kill() |
| 153 | 153 |
cmd.Wait() |
| ... | ... |
@@ -157,13 +157,13 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
|
| 157 | 157 |
assert.NilError(c, err) |
| 158 | 158 |
out, err = bufio.NewReader(stdout).ReadString('\n')
|
| 159 | 159 |
assert.NilError(c, err) |
| 160 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello") |
|
| 160 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 161 | 161 |
|
| 162 |
- c.Assert(stdin.Close(), check.IsNil) |
|
| 162 |
+ assert.Assert(c, stdin.Close(), check.IsNil) |
|
| 163 | 163 |
|
| 164 | 164 |
// Expect container to still be running after stdin is closed |
| 165 | 165 |
running := inspectField(c, id, "State.Running") |
| 166 |
- c.Assert(running, check.Equals, "true") |
|
| 166 |
+ assert.Assert(c, running, check.Equals, "true") |
|
| 167 | 167 |
} |
| 168 | 168 |
|
| 169 | 169 |
func (s *DockerSuite) TestAttachPausedContainer(c *check.C) {
|
| ... | ... |
@@ -51,7 +51,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *check.C) {
|
| 51 | 51 |
case err := <-errChan: |
| 52 | 52 |
tty.Close() |
| 53 | 53 |
out, _ := ioutil.ReadAll(pty) |
| 54 |
- c.Assert(err, check.IsNil, check.Commentf("out: %v", string(out)))
|
|
| 54 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("out: %v", string(out)))
|
|
| 55 | 55 |
case <-time.After(attachWait): |
| 56 | 56 |
c.Fatal("timed out without attach returning")
|
| 57 | 57 |
} |
| ... | ... |
@@ -74,7 +74,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
|
| 74 | 74 |
close(cmdExit) |
| 75 | 75 |
}() |
| 76 | 76 |
|
| 77 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 77 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 78 | 78 |
|
| 79 | 79 |
cpty.Write([]byte{16})
|
| 80 | 80 |
time.Sleep(100 * time.Millisecond) |
| ... | ... |
@@ -2082,7 +2082,7 @@ CMD ["cat", "/foo"]`), |
| 2082 | 2082 |
}).Assert(c, icmd.Success) |
| 2083 | 2083 |
|
| 2084 | 2084 |
res := inspectField(c, name, "Config.Cmd") |
| 2085 |
- c.Assert(strings.TrimSpace(string(res)), checker.Equals, `[cat /foo]`) |
|
| 2085 |
+ assert.Assert(c, strings.TrimSpace(string(res)), checker.Equals, `[cat /foo]`) |
|
| 2086 | 2086 |
} |
| 2087 | 2087 |
|
| 2088 | 2088 |
// FIXME(vdemeester) migrate to docker/cli tests (unit or e2e) |
| ... | ... |
@@ -2142,9 +2142,9 @@ COPY . /baz`), |
| 2142 | 2142 |
|
| 2143 | 2143 |
result = cli.DockerCmd(c, "run", "--rm", name, "ls", "-A", "/baz") |
| 2144 | 2144 |
if hasDockerignore && !ignoreDockerignore {
|
| 2145 |
- c.Assert(result.Stdout(), checker.Equals, ".dockerignore\nfoo\n") |
|
| 2145 |
+ assert.Assert(c, result.Stdout(), checker.Equals, ".dockerignore\nfoo\n") |
|
| 2146 | 2146 |
} else {
|
| 2147 |
- c.Assert(result.Stdout(), checker.Equals, "foo\n") |
|
| 2147 |
+ assert.Assert(c, result.Stdout(), checker.Equals, "foo\n") |
|
| 2148 | 2148 |
} |
| 2149 | 2149 |
} |
| 2150 | 2150 |
|
| ... | ... |
@@ -4178,7 +4178,7 @@ func (s *DockerSuite) TestBuildTimeArgHistoryExclusions(c *check.C) {
|
| 4178 | 4178 |
result.Assert(c, icmd.Expected{Out: fmt.Sprintf("%s=%s", explicitProxyKey, explicitProxyVal)})
|
| 4179 | 4179 |
|
| 4180 | 4180 |
cacheID := buildImage(imgName + "-two") |
| 4181 |
- c.Assert(origID, checker.Equals, cacheID) |
|
| 4181 |
+ assert.Assert(c, origID, checker.Equals, cacheID) |
|
| 4182 | 4182 |
} |
| 4183 | 4183 |
|
| 4184 | 4184 |
func (s *DockerSuite) TestBuildBuildTimeArgCacheHit(c *check.C) {
|
| ... | ... |
@@ -4373,7 +4373,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *check.C) {
|
| 4373 | 4373 |
) |
| 4374 | 4374 |
|
| 4375 | 4375 |
res := inspectField(c, imgName, "Config.WorkingDir") |
| 4376 |
- c.Assert(filepath.ToSlash(res), check.Equals, filepath.ToSlash(wdVal)) |
|
| 4376 |
+ assert.Assert(c, filepath.ToSlash(res), check.Equals, filepath.ToSlash(wdVal)) |
|
| 4377 | 4377 |
|
| 4378 | 4378 |
var resArr []string |
| 4379 | 4379 |
inspectFieldAndUnmarshall(c, imgName, "Config.Env", &resArr) |
| ... | ... |
@@ -4579,9 +4579,9 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) {
|
| 4579 | 4579 |
out := result.Combined()[i:] // "out" should contain just the warning message now |
| 4580 | 4580 |
|
| 4581 | 4581 |
// These were specified on a --build-arg but no ARG was in the Dockerfile |
| 4582 |
- c.Assert(out, checker.Contains, "FOO7") |
|
| 4583 |
- c.Assert(out, checker.Contains, "FOO8") |
|
| 4584 |
- c.Assert(out, checker.Contains, "FOO9") |
|
| 4582 |
+ assert.Assert(c, out, checker.Contains, "FOO7") |
|
| 4583 |
+ assert.Assert(c, out, checker.Contains, "FOO8") |
|
| 4584 |
+ assert.Assert(c, out, checker.Contains, "FOO9") |
|
| 4585 | 4585 |
} |
| 4586 | 4586 |
|
| 4587 | 4587 |
func (s *DockerSuite) TestBuildBuildTimeArgQuotedValVariants(c *check.C) {
|
| ... | ... |
@@ -4652,11 +4652,11 @@ func (s *DockerSuite) TestBuildMultiStageArg(c *check.C) {
|
| 4652 | 4652 |
parentID := strings.TrimSpace(result.Stdout()) |
| 4653 | 4653 |
|
| 4654 | 4654 |
result = cli.DockerCmd(c, "run", "--rm", parentID, "cat", "/out") |
| 4655 |
- c.Assert(result.Stdout(), checker.Contains, "foo=abc") |
|
| 4655 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "foo=abc") |
|
| 4656 | 4656 |
|
| 4657 | 4657 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4658 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "foo") |
|
| 4659 |
- c.Assert(result.Stdout(), checker.Contains, "bar=def") |
|
| 4658 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "foo") |
|
| 4659 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "bar=def") |
|
| 4660 | 4660 |
} |
| 4661 | 4661 |
|
| 4662 | 4662 |
func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *check.C) {
|
| ... | ... |
@@ -4678,10 +4678,10 @@ func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *check.C) {
|
| 4678 | 4678 |
parentID := strings.TrimSpace(result.Stdout()) |
| 4679 | 4679 |
|
| 4680 | 4680 |
result = cli.DockerCmd(c, "run", "--rm", parentID, "cat", "/out") |
| 4681 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "tag") |
|
| 4681 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "tag") |
|
| 4682 | 4682 |
|
| 4683 | 4683 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4684 |
- c.Assert(result.Stdout(), checker.Contains, "tag=latest") |
|
| 4684 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "tag=latest") |
|
| 4685 | 4685 |
} |
| 4686 | 4686 |
|
| 4687 | 4687 |
func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *check.C) {
|
| ... | ... |
@@ -4696,12 +4696,12 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *check.C) {
|
| 4696 | 4696 |
build.WithDockerfile(dockerfile), |
| 4697 | 4697 |
cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc")))
|
| 4698 | 4698 |
result.Assert(c, icmd.Success) |
| 4699 |
- c.Assert(result.Combined(), checker.Contains, "[Warning]") |
|
| 4700 |
- c.Assert(result.Combined(), checker.Contains, "[baz] were not consumed") |
|
| 4699 |
+ assert.Assert(c, result.Combined(), checker.Contains, "[Warning]") |
|
| 4700 |
+ assert.Assert(c, result.Combined(), checker.Contains, "[baz] were not consumed") |
|
| 4701 | 4701 |
|
| 4702 | 4702 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4703 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "bar") |
|
| 4704 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "baz") |
|
| 4703 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "bar") |
|
| 4704 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "baz") |
|
| 4705 | 4705 |
} |
| 4706 | 4706 |
|
| 4707 | 4707 |
func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) {
|
| ... | ... |
@@ -4741,7 +4741,7 @@ func (s *DockerSuite) TestBuildTagEvent(c *check.C) {
|
| 4741 | 4741 |
} |
| 4742 | 4742 |
} |
| 4743 | 4743 |
|
| 4744 |
- c.Assert(foundTag, checker.True, check.Commentf("No tag event found:\n%s", out))
|
|
| 4744 |
+ assert.Assert(c, foundTag, checker.True, check.Commentf("No tag event found:\n%s", out))
|
|
| 4745 | 4745 |
} |
| 4746 | 4746 |
|
| 4747 | 4747 |
// #15780 |
| ... | ... |
@@ -4754,7 +4754,7 @@ func (s *DockerSuite) TestBuildMultipleTags(c *check.C) {
|
| 4754 | 4754 |
|
| 4755 | 4755 |
id1 := getIDByName(c, "tag1") |
| 4756 | 4756 |
id2 := getIDByName(c, "tag2:v2") |
| 4757 |
- c.Assert(id1, check.Equals, id2) |
|
| 4757 |
+ assert.Assert(c, id1, check.Equals, id2) |
|
| 4758 | 4758 |
} |
| 4759 | 4759 |
|
| 4760 | 4760 |
// #17290 |
| ... | ... |
@@ -4802,17 +4802,17 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *check.C) {
|
| 4802 | 4802 |
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4803 | 4803 |
|
| 4804 | 4804 |
out := cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined() |
| 4805 |
- c.Assert(out, checker.Matches, "bar") |
|
| 4805 |
+ assert.Assert(c, out, checker.Matches, "bar") |
|
| 4806 | 4806 |
|
| 4807 | 4807 |
// change target file should invalidate cache |
| 4808 | 4808 |
err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644)
|
| 4809 | 4809 |
assert.NilError(c, err) |
| 4810 | 4810 |
|
| 4811 | 4811 |
result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4812 |
- c.Assert(result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4812 |
+ assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4813 | 4813 |
|
| 4814 | 4814 |
out = cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined() |
| 4815 |
- c.Assert(out, checker.Matches, "baz") |
|
| 4815 |
+ assert.Assert(c, out, checker.Matches, "baz") |
|
| 4816 | 4816 |
} |
| 4817 | 4817 |
|
| 4818 | 4818 |
func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) {
|
| ... | ... |
@@ -4833,17 +4833,17 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) {
|
| 4833 | 4833 |
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4834 | 4834 |
|
| 4835 | 4835 |
out := cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined() |
| 4836 |
- c.Assert(out, checker.Matches, "barbaz") |
|
| 4836 |
+ assert.Assert(c, out, checker.Matches, "barbaz") |
|
| 4837 | 4837 |
|
| 4838 | 4838 |
// change target file should invalidate cache |
| 4839 | 4839 |
err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo/def"), []byte("bax"), 0644)
|
| 4840 | 4840 |
assert.NilError(c, err) |
| 4841 | 4841 |
|
| 4842 | 4842 |
result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4843 |
- c.Assert(result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4843 |
+ assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4844 | 4844 |
|
| 4845 | 4845 |
out = cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined() |
| 4846 |
- c.Assert(out, checker.Matches, "barbax") |
|
| 4846 |
+ assert.Assert(c, out, checker.Matches, "barbax") |
|
| 4847 | 4847 |
|
| 4848 | 4848 |
} |
| 4849 | 4849 |
|
| ... | ... |
@@ -4866,7 +4866,7 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *check.C) {
|
| 4866 | 4866 |
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4867 | 4867 |
|
| 4868 | 4868 |
out := cli.DockerCmd(c, "run", "--rm", name, "cat", "asymlink").Combined() |
| 4869 |
- c.Assert(out, checker.Matches, "bar") |
|
| 4869 |
+ assert.Assert(c, out, checker.Matches, "bar") |
|
| 4870 | 4870 |
} |
| 4871 | 4871 |
|
| 4872 | 4872 |
// #17827 |
| ... | ... |
@@ -4890,7 +4890,7 @@ func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) {
|
| 4890 | 4890 |
|
| 4891 | 4891 |
result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4892 | 4892 |
|
| 4893 |
- c.Assert(result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4893 |
+ assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Using cache") |
|
| 4894 | 4894 |
} |
| 4895 | 4895 |
|
| 4896 | 4896 |
// #19375 |
| ... | ... |
@@ -4949,7 +4949,7 @@ func (s *DockerSuite) TestBuildLabelOneNode(c *check.C) {
|
| 4949 | 4949 |
if !ok {
|
| 4950 | 4950 |
c.Fatal("label `foo` not found in image")
|
| 4951 | 4951 |
} |
| 4952 |
- c.Assert(v, checker.Equals, "bar") |
|
| 4952 |
+ assert.Assert(c, v, checker.Equals, "bar") |
|
| 4953 | 4953 |
} |
| 4954 | 4954 |
|
| 4955 | 4955 |
func (s *DockerSuite) TestBuildLabelCacheCommit(c *check.C) {
|
| ... | ... |
@@ -5044,7 +5044,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C) |
| 5044 | 5044 |
|
| 5045 | 5045 |
b, err := ioutil.ReadFile(configPath) |
| 5046 | 5046 |
assert.NilError(c, err) |
| 5047 |
- c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 5047 |
+ assert.Assert(c, string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 5048 | 5048 |
|
| 5049 | 5049 |
dockerCmd(c, "--config", tmp, "tag", "busybox", repoName) |
| 5050 | 5050 |
dockerCmd(c, "--config", tmp, "push", repoName) |
| ... | ... |
@@ -5383,9 +5383,9 @@ func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) {
|
| 5383 | 5383 |
totalRun := 5 |
| 5384 | 5384 |
result := buildImage(name, build.WithDockerfile("FROM busybox\n"+strings.Repeat("RUN echo foo\n", totalRun)))
|
| 5385 | 5385 |
result.Assert(c, icmd.Success) |
| 5386 |
- c.Assert(result.Combined(), checker.Contains, fmt.Sprintf("Step 1/%d : FROM busybox", 1+totalRun))
|
|
| 5386 |
+ assert.Assert(c, result.Combined(), checker.Contains, fmt.Sprintf("Step 1/%d : FROM busybox", 1+totalRun))
|
|
| 5387 | 5387 |
for i := 2; i <= 1+totalRun; i++ {
|
| 5388 |
- c.Assert(result.Combined(), checker.Contains, fmt.Sprintf("Step %d/%d : RUN echo foo", i, 1+totalRun))
|
|
| 5388 |
+ assert.Assert(c, result.Combined(), checker.Contains, fmt.Sprintf("Step %d/%d : RUN echo foo", i, 1+totalRun))
|
|
| 5389 | 5389 |
} |
| 5390 | 5390 |
} |
| 5391 | 5391 |
|
| ... | ... |
@@ -5395,16 +5395,16 @@ func (s *DockerSuite) TestBuildWithFailure(c *check.C) {
|
| 5395 | 5395 |
// First test case can only detect `nobody` in runtime so all steps will show up |
| 5396 | 5396 |
dockerfile := "FROM busybox\nRUN nobody" |
| 5397 | 5397 |
result := buildImage(name, build.WithDockerfile(dockerfile)) |
| 5398 |
- c.Assert(result.Error, checker.NotNil) |
|
| 5399 |
- c.Assert(result.Stdout(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5400 |
- c.Assert(result.Stdout(), checker.Contains, "Step 2/2 : RUN nobody") |
|
| 5398 |
+ assert.Assert(c, result.Error, checker.NotNil) |
|
| 5399 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5400 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "Step 2/2 : RUN nobody") |
|
| 5401 | 5401 |
|
| 5402 | 5402 |
// Second test case `FFOM` should have been detected before build runs so no steps |
| 5403 | 5403 |
dockerfile = "FFOM nobody\nRUN nobody" |
| 5404 | 5404 |
result = buildImage(name, build.WithDockerfile(dockerfile)) |
| 5405 |
- c.Assert(result.Error, checker.NotNil) |
|
| 5406 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "Step 1/2 : FROM busybox") |
|
| 5407 |
- c.Assert(result.Stdout(), checker.Not(checker.Contains), "Step 2/2 : RUN nobody") |
|
| 5405 |
+ assert.Assert(c, result.Error, checker.NotNil) |
|
| 5406 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "Step 1/2 : FROM busybox") |
|
| 5407 |
+ assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "Step 2/2 : RUN nobody") |
|
| 5408 | 5408 |
} |
| 5409 | 5409 |
|
| 5410 | 5410 |
func (s *DockerSuite) TestBuildCacheFromEqualDiffIDsLength(c *check.C) {
|
| ... | ... |
@@ -5425,8 +5425,8 @@ func (s *DockerSuite) TestBuildCacheFromEqualDiffIDsLength(c *check.C) {
|
| 5425 | 5425 |
// rebuild with cache-from |
| 5426 | 5426 |
result := cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5427 | 5427 |
id2 := getIDByName(c, "build2") |
| 5428 |
- c.Assert(id1, checker.Equals, id2) |
|
| 5429 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5428 |
+ assert.Assert(c, id1, checker.Equals, id2) |
|
| 5429 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5430 | 5430 |
} |
| 5431 | 5431 |
|
| 5432 | 5432 |
func (s *DockerSuite) TestBuildCacheFrom(c *check.C) {
|
| ... | ... |
@@ -5450,15 +5450,15 @@ func (s *DockerSuite) TestBuildCacheFrom(c *check.C) {
|
| 5450 | 5450 |
// rebuild with cache-from |
| 5451 | 5451 |
result := cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5452 | 5452 |
id2 := getIDByName(c, "build2") |
| 5453 |
- c.Assert(id1, checker.Equals, id2) |
|
| 5454 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5453 |
+ assert.Assert(c, id1, checker.Equals, id2) |
|
| 5454 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5455 | 5455 |
cli.DockerCmd(c, "rmi", "build2") |
| 5456 | 5456 |
|
| 5457 | 5457 |
// no cache match with unknown source |
| 5458 | 5458 |
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=nosuchtag"), build.WithExternalBuildContext(ctx))
|
| 5459 | 5459 |
id2 = getIDByName(c, "build2") |
| 5460 |
- c.Assert(id1, checker.Not(checker.Equals), id2) |
|
| 5461 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 0) |
|
| 5460 |
+ assert.Assert(c, id1, checker.Not(checker.Equals), id2) |
|
| 5461 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 0) |
|
| 5462 | 5462 |
cli.DockerCmd(c, "rmi", "build2") |
| 5463 | 5463 |
|
| 5464 | 5464 |
// clear parent images |
| ... | ... |
@@ -5472,23 +5472,23 @@ func (s *DockerSuite) TestBuildCacheFrom(c *check.C) {
|
| 5472 | 5472 |
cli.DockerCmd(c, "rmi", "build1") |
| 5473 | 5473 |
cli.DockerCmd(c, "load", "-i", tempFile) |
| 5474 | 5474 |
parentID := cli.DockerCmd(c, "inspect", "-f", "{{.Parent}}", "build1").Combined()
|
| 5475 |
- c.Assert(strings.TrimSpace(parentID), checker.Equals, "") |
|
| 5475 |
+ assert.Assert(c, strings.TrimSpace(parentID), checker.Equals, "") |
|
| 5476 | 5476 |
|
| 5477 | 5477 |
// cache still applies without parents |
| 5478 | 5478 |
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5479 | 5479 |
id2 = getIDByName(c, "build2") |
| 5480 |
- c.Assert(id1, checker.Equals, id2) |
|
| 5481 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5480 |
+ assert.Assert(c, id1, checker.Equals, id2) |
|
| 5481 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5482 | 5482 |
history1 := cli.DockerCmd(c, "history", "-q", "build2").Combined() |
| 5483 | 5483 |
|
| 5484 | 5484 |
// Retry, no new intermediate images |
| 5485 | 5485 |
result = cli.BuildCmd(c, "build3", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5486 | 5486 |
id3 := getIDByName(c, "build3") |
| 5487 |
- c.Assert(id1, checker.Equals, id3) |
|
| 5488 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5487 |
+ assert.Assert(c, id1, checker.Equals, id3) |
|
| 5488 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 3) |
|
| 5489 | 5489 |
history2 := cli.DockerCmd(c, "history", "-q", "build3").Combined() |
| 5490 | 5490 |
|
| 5491 |
- c.Assert(history1, checker.Equals, history2) |
|
| 5491 |
+ assert.Assert(c, history1, checker.Equals, history2) |
|
| 5492 | 5492 |
cli.DockerCmd(c, "rmi", "build2") |
| 5493 | 5493 |
cli.DockerCmd(c, "rmi", "build3") |
| 5494 | 5494 |
cli.DockerCmd(c, "rmi", "build1") |
| ... | ... |
@@ -5505,22 +5505,22 @@ func (s *DockerSuite) TestBuildCacheFrom(c *check.C) {
|
| 5505 | 5505 |
|
| 5506 | 5506 |
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5507 | 5507 |
id2 = getIDByName(c, "build2") |
| 5508 |
- c.Assert(id1, checker.Not(checker.Equals), id2) |
|
| 5509 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5508 |
+ assert.Assert(c, id1, checker.Not(checker.Equals), id2) |
|
| 5509 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5510 | 5510 |
|
| 5511 | 5511 |
layers1Str := cli.DockerCmd(c, "inspect", "-f", "{{json .RootFS.Layers}}", "build1").Combined()
|
| 5512 | 5512 |
layers2Str := cli.DockerCmd(c, "inspect", "-f", "{{json .RootFS.Layers}}", "build2").Combined()
|
| 5513 | 5513 |
|
| 5514 | 5514 |
var layers1 []string |
| 5515 | 5515 |
var layers2 []string |
| 5516 |
- c.Assert(json.Unmarshal([]byte(layers1Str), &layers1), checker.IsNil) |
|
| 5517 |
- c.Assert(json.Unmarshal([]byte(layers2Str), &layers2), checker.IsNil) |
|
| 5516 |
+ assert.Assert(c, json.Unmarshal([]byte(layers1Str), &layers1), checker.IsNil) |
|
| 5517 |
+ assert.Assert(c, json.Unmarshal([]byte(layers2Str), &layers2), checker.IsNil) |
|
| 5518 | 5518 |
|
| 5519 |
- c.Assert(len(layers1), checker.Equals, len(layers2)) |
|
| 5519 |
+ assert.Assert(c, len(layers1), checker.Equals, len(layers2)) |
|
| 5520 | 5520 |
for i := 0; i < len(layers1)-1; i++ {
|
| 5521 |
- c.Assert(layers1[i], checker.Equals, layers2[i]) |
|
| 5521 |
+ assert.Assert(c, layers1[i], checker.Equals, layers2[i]) |
|
| 5522 | 5522 |
} |
| 5523 |
- c.Assert(layers1[len(layers1)-1], checker.Not(checker.Equals), layers2[len(layers1)-1]) |
|
| 5523 |
+ assert.Assert(c, layers1[len(layers1)-1], checker.Not(checker.Equals), layers2[len(layers1)-1]) |
|
| 5524 | 5524 |
} |
| 5525 | 5525 |
|
| 5526 | 5526 |
func (s *DockerSuite) TestBuildMultiStageCache(c *check.C) {
|
| ... | ... |
@@ -5540,11 +5540,11 @@ func (s *DockerSuite) TestBuildMultiStageCache(c *check.C) {
|
| 5540 | 5540 |
|
| 5541 | 5541 |
result := cli.BuildCmd(c, "build1", build.WithExternalBuildContext(ctx)) |
| 5542 | 5542 |
// second part of dockerfile was a repeat of first so should be cached |
| 5543 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 1) |
|
| 5543 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 1) |
|
| 5544 | 5544 |
|
| 5545 | 5545 |
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
|
| 5546 | 5546 |
// now both parts of dockerfile should be cached |
| 5547 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5547 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) |
|
| 5548 | 5548 |
} |
| 5549 | 5549 |
|
| 5550 | 5550 |
func (s *DockerSuite) TestBuildNetNone(c *check.C) {
|
| ... | ... |
@@ -5572,7 +5572,7 @@ func (s *DockerSuite) TestBuildNetContainer(c *check.C) {
|
| 5572 | 5572 |
`)) |
| 5573 | 5573 |
|
| 5574 | 5574 |
host, _ := dockerCmd(c, "run", "testbuildnetcontainer", "cat", "/otherhost") |
| 5575 |
- c.Assert(strings.TrimSpace(host), check.Equals, "foobar") |
|
| 5575 |
+ assert.Assert(c, strings.TrimSpace(host), check.Equals, "foobar") |
|
| 5576 | 5576 |
} |
| 5577 | 5577 |
|
| 5578 | 5578 |
func (s *DockerSuite) TestBuildWithExtraHost(c *check.C) {
|
| ... | ... |
@@ -5628,20 +5628,20 @@ func (s *DockerSuite) TestBuildContChar(c *check.C) {
|
| 5628 | 5628 |
result := buildImage(name, build.WithDockerfile(`FROM busybox |
| 5629 | 5629 |
RUN echo hi \`)) |
| 5630 | 5630 |
result.Assert(c, icmd.Success) |
| 5631 |
- c.Assert(result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5632 |
- c.Assert(result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi\n") |
|
| 5631 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5632 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi\n") |
|
| 5633 | 5633 |
|
| 5634 | 5634 |
result = buildImage(name, build.WithDockerfile(`FROM busybox |
| 5635 | 5635 |
RUN echo hi \\`)) |
| 5636 | 5636 |
result.Assert(c, icmd.Success) |
| 5637 |
- c.Assert(result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5638 |
- c.Assert(result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\n") |
|
| 5637 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5638 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\n") |
|
| 5639 | 5639 |
|
| 5640 | 5640 |
result = buildImage(name, build.WithDockerfile(`FROM busybox |
| 5641 | 5641 |
RUN echo hi \\\`)) |
| 5642 | 5642 |
result.Assert(c, icmd.Success) |
| 5643 |
- c.Assert(result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5644 |
- c.Assert(result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\\\n") |
|
| 5643 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5644 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\\\n") |
|
| 5645 | 5645 |
} |
| 5646 | 5646 |
|
| 5647 | 5647 |
func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *check.C) {
|
| ... | ... |
@@ -5681,22 +5681,22 @@ func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *check.C) {
|
| 5681 | 5681 |
result := cli.BuildCmd(c, "build2", build.WithExternalBuildContext(ctx)) |
| 5682 | 5682 |
|
| 5683 | 5683 |
// all commands should be cached |
| 5684 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 7) |
|
| 5685 |
- c.Assert(getIDByName(c, "build1"), checker.Equals, getIDByName(c, "build2")) |
|
| 5684 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 7) |
|
| 5685 |
+ assert.Assert(c, getIDByName(c, "build1"), checker.Equals, getIDByName(c, "build2")) |
|
| 5686 | 5686 |
|
| 5687 | 5687 |
err := ioutil.WriteFile(filepath.Join(ctx.Dir, "Dockerfile"), []byte(fmt.Sprintf(dockerfile, "COPY baz/aa foo")), 0644) |
| 5688 | 5688 |
assert.NilError(c, err) |
| 5689 | 5689 |
|
| 5690 | 5690 |
// changing file in parent block should not affect last block |
| 5691 | 5691 |
result = cli.BuildCmd(c, "build3", build.WithExternalBuildContext(ctx)) |
| 5692 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 5) |
|
| 5692 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 5) |
|
| 5693 | 5693 |
|
| 5694 | 5694 |
err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("pqr"), 0644)
|
| 5695 | 5695 |
assert.NilError(c, err) |
| 5696 | 5696 |
|
| 5697 | 5697 |
// changing file in parent block should affect both first and last block |
| 5698 | 5698 |
result = cli.BuildCmd(c, "build4", build.WithExternalBuildContext(ctx)) |
| 5699 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 5) |
|
| 5699 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 5) |
|
| 5700 | 5700 |
|
| 5701 | 5701 |
cli.DockerCmd(c, "run", "build4", "cat", "bay").Assert(c, icmd.Expected{Out: "pqr"})
|
| 5702 | 5702 |
cli.DockerCmd(c, "run", "build4", "cat", "baz").Assert(c, icmd.Expected{Out: "pqr"})
|
| ... | ... |
@@ -5777,9 +5777,9 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuilds(c *check.C) {
|
| 5777 | 5777 |
cli.BuildCmd(c, "build2", build.WithExternalBuildContext(ctx)) |
| 5778 | 5778 |
|
| 5779 | 5779 |
out := cli.DockerCmd(c, "run", "build2", "cat", "bar").Combined() |
| 5780 |
- c.Assert(strings.TrimSpace(out), check.Equals, "abc") |
|
| 5780 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "abc") |
|
| 5781 | 5781 |
out = cli.DockerCmd(c, "run", "build2", "cat", "foo").Combined() |
| 5782 |
- c.Assert(strings.TrimSpace(out), check.Equals, "def") |
|
| 5782 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") |
|
| 5783 | 5783 |
} |
| 5784 | 5784 |
|
| 5785 | 5785 |
func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *check.C) {
|
| ... | ... |
@@ -5893,9 +5893,9 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) {
|
| 5893 | 5893 |
cli.BuildCmd(c, "build2", build.WithExternalBuildContext(ctx)) |
| 5894 | 5894 |
|
| 5895 | 5895 |
out := cli.DockerCmd(c, "run", "build2", "cmd.exe", "/s", "/c", "type", "c:\\bar").Combined() |
| 5896 |
- c.Assert(strings.TrimSpace(out), check.Equals, "abc") |
|
| 5896 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "abc") |
|
| 5897 | 5897 |
out = cli.DockerCmd(c, "run", "build2", "cmd.exe", "/s", "/c", "type", "c:\\foo").Combined() |
| 5898 |
- c.Assert(strings.TrimSpace(out), check.Equals, "def") |
|
| 5898 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") |
|
| 5899 | 5899 |
} |
| 5900 | 5900 |
|
| 5901 | 5901 |
func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) {
|
| ... | ... |
@@ -5969,7 +5969,7 @@ func (s *DockerSuite) TestBuildMultiStageResetScratch(c *check.C) {
|
| 5969 | 5969 |
cli.BuildCmd(c, "build1", build.WithExternalBuildContext(ctx)) |
| 5970 | 5970 |
|
| 5971 | 5971 |
res := cli.InspectCmd(c, "build1", cli.Format(".Config.WorkingDir")).Combined()
|
| 5972 |
- c.Assert(strings.TrimSpace(res), checker.Equals, "") |
|
| 5972 |
+ assert.Assert(c, strings.TrimSpace(res), checker.Equals, "") |
|
| 5973 | 5973 |
} |
| 5974 | 5974 |
|
| 5975 | 5975 |
func (s *DockerSuite) TestBuildIntermediateTarget(c *check.C) {
|
| ... | ... |
@@ -5990,14 +5990,14 @@ func (s *DockerSuite) TestBuildIntermediateTarget(c *check.C) {
|
| 5990 | 5990 |
cli.WithFlags("--target", "build-env"))
|
| 5991 | 5991 |
|
| 5992 | 5992 |
res := cli.InspectCmd(c, "build1", cli.Format("json .Config.Cmd")).Combined()
|
| 5993 |
- c.Assert(strings.TrimSpace(res), checker.Equals, `["/dev"]`) |
|
| 5993 |
+ assert.Assert(c, strings.TrimSpace(res), checker.Equals, `["/dev"]`) |
|
| 5994 | 5994 |
|
| 5995 | 5995 |
// Stage name is case-insensitive by design |
| 5996 | 5996 |
cli.BuildCmd(c, "build1", build.WithExternalBuildContext(ctx), |
| 5997 | 5997 |
cli.WithFlags("--target", "BUIld-EnV"))
|
| 5998 | 5998 |
|
| 5999 | 5999 |
res = cli.InspectCmd(c, "build1", cli.Format("json .Config.Cmd")).Combined()
|
| 6000 |
- c.Assert(strings.TrimSpace(res), checker.Equals, `["/dev"]`) |
|
| 6000 |
+ assert.Assert(c, strings.TrimSpace(res), checker.Equals, `["/dev"]`) |
|
| 6001 | 6001 |
|
| 6002 | 6002 |
result := cli.Docker(cli.Build("build1"), build.WithExternalBuildContext(ctx),
|
| 6003 | 6003 |
cli.WithFlags("--target", "nosuchtarget"))
|
| ... | ... |
@@ -6100,7 +6100,7 @@ func (s *DockerSuite) TestBuildWorkdirCmd(c *check.C) {
|
| 6100 | 6100 |
buildImageSuccessfully(c, name, build.WithDockerfile(dockerFile)) |
| 6101 | 6101 |
result := buildImage(name, build.WithDockerfile(dockerFile)) |
| 6102 | 6102 |
result.Assert(c, icmd.Success) |
| 6103 |
- c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 1) |
|
| 6103 |
+ assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 1) |
|
| 6104 | 6104 |
} |
| 6105 | 6105 |
|
| 6106 | 6106 |
// FIXME(vdemeester) should be a unit test |
| ... | ... |
@@ -6200,7 +6200,7 @@ ENV BAR BAZ`), |
| 6200 | 6200 |
assert.NilError(c, err) |
| 6201 | 6201 |
d, err := digest.Parse(string(id)) |
| 6202 | 6202 |
assert.NilError(c, err) |
| 6203 |
- c.Assert(d.String(), checker.Equals, getIDByName(c, name)) |
|
| 6203 |
+ assert.Assert(c, d.String(), checker.Equals, getIDByName(c, name)) |
|
| 6204 | 6204 |
} |
| 6205 | 6205 |
|
| 6206 | 6206 |
// FIXME(vdemeester) should migrate to docker/cli tests |
| ... | ... |
@@ -6223,5 +6223,5 @@ func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *check.C) {
|
| 6223 | 6223 |
}) |
| 6224 | 6224 |
_, err = os.Stat(tmpIidFile) |
| 6225 | 6225 |
assert.ErrorContains(c, err, "") |
| 6226 |
- c.Assert(os.IsNotExist(err), check.Equals, true) |
|
| 6226 |
+ assert.Assert(c, os.IsNotExist(err), check.Equals, true) |
|
| 6227 | 6227 |
} |
| ... | ... |
@@ -56,16 +56,16 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
| 56 | 56 |
|
| 57 | 57 |
var c1 hostConfig |
| 58 | 58 |
err := json.Unmarshal([]byte(cfg), &c1) |
| 59 |
- c.Assert(err, checker.IsNil, check.Commentf(cfg)) |
|
| 59 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf(cfg)) |
|
| 60 | 60 |
|
| 61 |
- c.Assert(c1.Memory, checker.Equals, int64(64*1024*1024), check.Commentf("resource constraints not set properly for Memory"))
|
|
| 62 |
- c.Assert(c1.MemorySwap, checker.Equals, int64(-1), check.Commentf("resource constraints not set properly for MemorySwap"))
|
|
| 63 |
- c.Assert(c1.CpusetCpus, checker.Equals, "0", check.Commentf("resource constraints not set properly for CpusetCpus"))
|
|
| 64 |
- c.Assert(c1.CpusetMems, checker.Equals, "0", check.Commentf("resource constraints not set properly for CpusetMems"))
|
|
| 65 |
- c.Assert(c1.CPUShares, checker.Equals, int64(100), check.Commentf("resource constraints not set properly for CPUShares"))
|
|
| 66 |
- c.Assert(c1.CPUQuota, checker.Equals, int64(8000), check.Commentf("resource constraints not set properly for CPUQuota"))
|
|
| 67 |
- c.Assert(c1.Ulimits[0].Name, checker.Equals, "nofile", check.Commentf("resource constraints not set properly for Ulimits"))
|
|
| 68 |
- c.Assert(c1.Ulimits[0].Hard, checker.Equals, int64(42), check.Commentf("resource constraints not set properly for Ulimits"))
|
|
| 61 |
+ assert.Assert(c, c1.Memory, checker.Equals, int64(64*1024*1024), check.Commentf("resource constraints not set properly for Memory"))
|
|
| 62 |
+ assert.Assert(c, c1.MemorySwap, checker.Equals, int64(-1), check.Commentf("resource constraints not set properly for MemorySwap"))
|
|
| 63 |
+ assert.Assert(c, c1.CpusetCpus, checker.Equals, "0", check.Commentf("resource constraints not set properly for CpusetCpus"))
|
|
| 64 |
+ assert.Assert(c, c1.CpusetMems, checker.Equals, "0", check.Commentf("resource constraints not set properly for CpusetMems"))
|
|
| 65 |
+ assert.Assert(c, c1.CPUShares, checker.Equals, int64(100), check.Commentf("resource constraints not set properly for CPUShares"))
|
|
| 66 |
+ assert.Assert(c, c1.CPUQuota, checker.Equals, int64(8000), check.Commentf("resource constraints not set properly for CPUQuota"))
|
|
| 67 |
+ assert.Assert(c, c1.Ulimits[0].Name, checker.Equals, "nofile", check.Commentf("resource constraints not set properly for Ulimits"))
|
|
| 68 |
+ assert.Assert(c, c1.Ulimits[0].Hard, checker.Equals, int64(42), check.Commentf("resource constraints not set properly for Ulimits"))
|
|
| 69 | 69 |
|
| 70 | 70 |
// Make sure constraints aren't saved to image |
| 71 | 71 |
cli.DockerCmd(c, "run", "--name=test", name) |
| ... | ... |
@@ -74,15 +74,15 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
| 74 | 74 |
|
| 75 | 75 |
var c2 hostConfig |
| 76 | 76 |
err = json.Unmarshal([]byte(cfg), &c2) |
| 77 |
- c.Assert(err, checker.IsNil, check.Commentf(cfg)) |
|
| 78 |
- |
|
| 79 |
- c.Assert(c2.Memory, check.Not(checker.Equals), int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
|
|
| 80 |
- c.Assert(c2.MemorySwap, check.Not(checker.Equals), int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
|
|
| 81 |
- c.Assert(c2.CpusetCpus, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetCpus"))
|
|
| 82 |
- c.Assert(c2.CpusetMems, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetMems"))
|
|
| 83 |
- c.Assert(c2.CPUShares, check.Not(checker.Equals), int64(100), check.Commentf("resource leaked from build for CPUShares"))
|
|
| 84 |
- c.Assert(c2.CPUQuota, check.Not(checker.Equals), int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
|
|
| 85 |
- c.Assert(c2.Ulimits, checker.IsNil, check.Commentf("resource leaked from build for Ulimits"))
|
|
| 77 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf(cfg)) |
|
| 78 |
+ |
|
| 79 |
+ assert.Assert(c, c2.Memory, check.Not(checker.Equals), int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
|
|
| 80 |
+ assert.Assert(c, c2.MemorySwap, check.Not(checker.Equals), int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
|
|
| 81 |
+ assert.Assert(c, c2.CpusetCpus, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetCpus"))
|
|
| 82 |
+ assert.Assert(c, c2.CpusetMems, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetMems"))
|
|
| 83 |
+ assert.Assert(c, c2.CPUShares, check.Not(checker.Equals), int64(100), check.Commentf("resource leaked from build for CPUShares"))
|
|
| 84 |
+ assert.Assert(c, c2.CPUQuota, check.Not(checker.Equals), int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
|
|
| 85 |
+ assert.Assert(c, c2.Ulimits, checker.IsNil, check.Commentf("resource leaked from build for Ulimits"))
|
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
func (s *DockerSuite) TestBuildAddChangeOwnership(c *check.C) {
|
| ... | ... |
@@ -73,7 +73,7 @@ func testPullByTagDisplaysDigest(c *check.C) {
|
| 73 | 73 |
pullDigest := matches[1] |
| 74 | 74 |
|
| 75 | 75 |
// make sure the pushed and pull digests match |
| 76 |
- c.Assert(pushDigest.String(), checker.Equals, pullDigest) |
|
| 76 |
+ assert.Assert(c, pushDigest.String(), checker.Equals, pullDigest) |
|
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 | 79 |
func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
|
| ... | ... |
@@ -99,7 +99,7 @@ func testPullByDigest(c *check.C) {
|
| 99 | 99 |
pullDigest := matches[1] |
| 100 | 100 |
|
| 101 | 101 |
// make sure the pushed and pull digests match |
| 102 |
- c.Assert(pushDigest.String(), checker.Equals, pullDigest) |
|
| 102 |
+ assert.Assert(c, pushDigest.String(), checker.Equals, pullDigest) |
|
| 103 | 103 |
} |
| 104 | 104 |
|
| 105 | 105 |
func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
|
| ... | ... |
@@ -115,8 +115,8 @@ func testPullByDigestNoFallback(c *check.C) {
|
| 115 | 115 |
// pull from the registry using the <name>@<digest> reference |
| 116 | 116 |
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
|
| 117 | 117 |
out, _, err := dockerCmdWithError("pull", imageReference)
|
| 118 |
- c.Assert(err, checker.NotNil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 119 |
- c.Assert(out, checker.Contains, fmt.Sprintf("manifest for %s not found", imageReference), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 118 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 119 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("manifest for %s not found", imageReference), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
|
| ... | ... |
@@ -151,8 +151,8 @@ func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) {
|
| 151 | 151 |
|
| 152 | 152 |
foundRegex := regexp.MustCompile("found=([^\n]+)")
|
| 153 | 153 |
matches := foundRegex.FindStringSubmatch(out) |
| 154 |
- c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 155 |
- c.Assert(matches[1], checker.Equals, "1", check.Commentf("Expected %q, got %q", "1", matches[1]))
|
|
| 154 |
+ assert.Assert(c, matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 155 |
+ assert.Assert(c, matches[1], checker.Equals, "1", check.Commentf("Expected %q, got %q", "1", matches[1]))
|
|
| 156 | 156 |
|
| 157 | 157 |
res := inspectField(c, containerName, "Config.Image") |
| 158 | 158 |
assert.Equal(c, res, imageReference) |
| ... | ... |
@@ -234,7 +234,7 @@ func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *check.C) {
|
| 234 | 234 |
dockerCmd(c, "pull", imageReference) |
| 235 | 235 |
|
| 236 | 236 |
out, _ := dockerCmd(c, "images") |
| 237 |
- c.Assert(out, checker.Not(checker.Contains), "DIGEST", check.Commentf("list output should not have contained DIGEST header"))
|
|
| 237 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "DIGEST", check.Commentf("list output should not have contained DIGEST header"))
|
|
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 | 240 |
func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
|
| ... | ... |
@@ -253,7 +253,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
|
| 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 |
- c.Assert(re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 256 |
+ assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("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 *check.C) {
|
| 271 | 271 |
out, _ = dockerCmd(c, "images", "--digests") |
| 272 | 272 |
|
| 273 | 273 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 274 |
- c.Assert(re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 274 |
+ assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 278 |
+ assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("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 *check.C) {
|
| 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 |
- c.Assert(reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 288 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 289 | 289 |
// make sure image 2 has repo, <none>, digest |
| 290 |
- c.Assert(re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 290 |
+ assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("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 *check.C) {
|
| 296 | 296 |
out, _ = dockerCmd(c, "images", "--digests") |
| 297 | 297 |
|
| 298 | 298 |
// make sure image 1 has repo, tag, digest |
| 299 |
- c.Assert(reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 299 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 303 |
+ assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 309 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 310 | 310 |
// make sure image 2 has repo, tag, digest |
| 311 |
- c.Assert(reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 311 |
+ assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(busyboxRe.MatchString(out), checker.True, check.Commentf("expected %q: %s", busyboxRe.String(), out))
|
|
| 314 |
+ assert.Assert(c, busyboxRe.MatchString(out), checker.True, check.Commentf("expected %q: %s", busyboxRe.String(), out))
|
|
| 315 | 315 |
} |
| 316 | 316 |
|
| 317 | 317 |
func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) {
|
| ... | ... |
@@ -329,7 +329,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) {
|
| 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 |
- c.Assert(re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 332 |
+ assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("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 *check.C) {
|
| 347 | 347 |
out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true") |
| 348 | 348 |
|
| 349 | 349 |
// make sure repo shown, tag=<none>, digest = $digest1 |
| 350 |
- c.Assert(re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
|
|
| 350 |
+ assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 354 |
+ assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("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 *check.C) {
|
| 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 |
- c.Assert(reWithDigest1.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 364 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 365 | 365 |
// make sure image 2 has repo, <none>, digest |
| 366 |
- c.Assert(re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 366 |
+ assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
|
|
| 367 | 367 |
|
| 368 | 368 |
// pull dangle2 tag |
| 369 | 369 |
dockerCmd(c, "pull", repoName+":dangle2") |
| ... | ... |
@@ -372,24 +372,24 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) {
|
| 372 | 372 |
out, _ = dockerCmd(c, "images", "--digests") |
| 373 | 373 |
|
| 374 | 374 |
// make sure image 1 has repo, tag, digest |
| 375 |
- c.Assert(reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
|
|
| 375 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
|
|
| 379 |
+ assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("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 |
- c.Assert(reWithDigest1.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 385 |
+ assert.Assert(c, reWithDigest1.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
|
|
| 386 | 386 |
// make sure image 2 has repo, tag, digest |
| 387 |
- c.Assert(reWithDigest2.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest2.String(), out))
|
|
| 387 |
+ assert.Assert(c, reWithDigest2.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest2.String(), out))
|
|
| 388 | 388 |
} |
| 389 | 389 |
|
| 390 | 390 |
func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) {
|
| 391 | 391 |
digest, err := setupImage(c) |
| 392 |
- c.Assert(err, check.IsNil, check.Commentf("error setting up image"))
|
|
| 392 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("error setting up image"))
|
|
| 393 | 393 |
|
| 394 | 394 |
imageReference := fmt.Sprintf("%s@%s", repoName, digest)
|
| 395 | 395 |
|
| ... | ... |
@@ -401,8 +401,8 @@ func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) {
|
| 401 | 401 |
var imageJSON []types.ImageInspect |
| 402 | 402 |
err = json.Unmarshal([]byte(out), &imageJSON) |
| 403 | 403 |
assert.NilError(c, err) |
| 404 |
- c.Assert(imageJSON, checker.HasLen, 1) |
|
| 405 |
- c.Assert(imageJSON[0].RepoDigests, checker.HasLen, 1) |
|
| 404 |
+ assert.Assert(c, imageJSON, checker.HasLen, 1) |
|
| 405 |
+ assert.Assert(c, imageJSON[0].RepoDigests, checker.HasLen, 1) |
|
| 406 | 406 |
assert.Check(c, is.Contains(imageJSON[0].RepoDigests, imageReference)) |
| 407 | 407 |
} |
| 408 | 408 |
|
| ... | ... |
@@ -556,7 +556,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
|
| 556 | 556 |
// Pull from the registry using the <name>@<digest> reference. |
| 557 | 557 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 558 | 558 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 559 |
- c.Assert(exitStatus, checker.Not(check.Equals), 0) |
|
| 559 |
+ assert.Assert(c, exitStatus, checker.Not(check.Equals), 0) |
|
| 560 | 560 |
|
| 561 | 561 |
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
|
| 562 | 562 |
assert.Assert(c, is.Contains(out, expectedErrorMsg)) |
| ... | ... |
@@ -568,14 +568,14 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
|
| 568 | 568 |
func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
|
| 569 | 569 |
testRequires(c, DaemonIsLinux) |
| 570 | 570 |
manifestDigest, err := setupImage(c) |
| 571 |
- c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
|
|
| 571 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error setting up image"))
|
|
| 572 | 572 |
|
| 573 | 573 |
// Load the target manifest blob. |
| 574 | 574 |
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest) |
| 575 | 575 |
|
| 576 | 576 |
var imgManifest schema1.Manifest |
| 577 | 577 |
err = json.Unmarshal(manifestBlob, &imgManifest) |
| 578 |
- c.Assert(err, checker.IsNil, check.Commentf("unable to decode image manifest from blob"))
|
|
| 578 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("unable to decode image manifest from blob"))
|
|
| 579 | 579 |
|
| 580 | 580 |
// Change a layer in the manifest. |
| 581 | 581 |
imgManifest.FSLayers[0] = schema1.FSLayer{
|
| ... | ... |
@@ -588,7 +588,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C |
| 588 | 588 |
defer undo() |
| 589 | 589 |
|
| 590 | 590 |
alteredManifestBlob, err := json.MarshalIndent(imgManifest, "", " ") |
| 591 |
- c.Assert(err, checker.IsNil, check.Commentf("unable to encode altered image manifest to JSON"))
|
|
| 591 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("unable to encode altered image manifest to JSON"))
|
|
| 592 | 592 |
|
| 593 | 593 |
s.reg.WriteBlobContents(c, manifestDigest, alteredManifestBlob) |
| 594 | 594 |
|
| ... | ... |
@@ -598,10 +598,10 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C |
| 598 | 598 |
// Pull from the registry using the <name>@<digest> reference. |
| 599 | 599 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 600 | 600 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 601 |
- c.Assert(exitStatus, checker.Not(check.Equals), 0) |
|
| 601 |
+ assert.Assert(c, exitStatus, checker.Not(check.Equals), 0) |
|
| 602 | 602 |
|
| 603 | 603 |
expectedErrorMsg := fmt.Sprintf("image verification failed for digest %s", manifestDigest)
|
| 604 |
- c.Assert(out, checker.Contains, expectedErrorMsg) |
|
| 604 |
+ assert.Assert(c, out, checker.Contains, expectedErrorMsg) |
|
| 605 | 605 |
} |
| 606 | 606 |
|
| 607 | 607 |
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when |
| ... | ... |
@@ -610,14 +610,14 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C |
| 610 | 610 |
func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
|
| 611 | 611 |
testRequires(c, DaemonIsLinux) |
| 612 | 612 |
manifestDigest, err := setupImage(c) |
| 613 |
- c.Assert(err, checker.IsNil) |
|
| 613 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 614 | 614 |
|
| 615 | 615 |
// Load the target manifest blob. |
| 616 | 616 |
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest) |
| 617 | 617 |
|
| 618 | 618 |
var imgManifest schema2.Manifest |
| 619 | 619 |
err = json.Unmarshal(manifestBlob, &imgManifest) |
| 620 |
- c.Assert(err, checker.IsNil) |
|
| 620 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 621 | 621 |
|
| 622 | 622 |
// Next, get the digest of one of the layers from the manifest. |
| 623 | 623 |
targetLayerDigest := imgManifest.Layers[0].Digest |
| ... | ... |
@@ -641,10 +641,10 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
|
| 641 | 641 |
// Pull from the registry using the <name>@<digest> reference. |
| 642 | 642 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 643 | 643 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 644 |
- c.Assert(exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 644 |
+ assert.Assert(c, exitStatus, checker.Not(check.Equals), 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 |
- c.Assert(out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 647 |
+ assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 648 | 648 |
} |
| 649 | 649 |
|
| 650 | 650 |
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when |
| ... | ... |
@@ -653,14 +653,14 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
|
| 653 | 653 |
func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
|
| 654 | 654 |
testRequires(c, DaemonIsLinux) |
| 655 | 655 |
manifestDigest, err := setupImage(c) |
| 656 |
- c.Assert(err, checker.IsNil) |
|
| 656 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 657 | 657 |
|
| 658 | 658 |
// Load the target manifest blob. |
| 659 | 659 |
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest) |
| 660 | 660 |
|
| 661 | 661 |
var imgManifest schema1.Manifest |
| 662 | 662 |
err = json.Unmarshal(manifestBlob, &imgManifest) |
| 663 |
- c.Assert(err, checker.IsNil) |
|
| 663 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 664 | 664 |
|
| 665 | 665 |
// Next, get the digest of one of the layers from the manifest. |
| 666 | 666 |
targetLayerDigest := imgManifest.FSLayers[0].BlobSum |
| ... | ... |
@@ -684,8 +684,8 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
|
| 684 | 684 |
// Pull from the registry using the <name>@<digest> reference. |
| 685 | 685 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 686 | 686 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 687 |
- c.Assert(exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 687 |
+ assert.Assert(c, exitStatus, checker.Not(check.Equals), 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 |
- c.Assert(out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 690 |
+ assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 691 | 691 |
} |
| ... | ... |
@@ -50,7 +50,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
|
| 50 | 50 |
|
| 51 | 51 |
out = inspectField(c, cleanedContainerID, "State.Paused") |
| 52 | 52 |
// commit should not unpause a paused container |
| 53 |
- c.Assert(out, checker.Contains, "true") |
|
| 53 |
+ assert.Assert(c, out, checker.Contains, "true") |
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
func (s *DockerSuite) TestCommitNewFile(c *check.C) {
|
| ... | ... |
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestCommitNewFile(c *check.C) {
|
| 61 | 61 |
|
| 62 | 62 |
out, _ := dockerCmd(c, "run", imageID, "cat", "/foo") |
| 63 | 63 |
actual := strings.TrimSpace(out) |
| 64 |
- c.Assert(actual, checker.Equals, "koye") |
|
| 64 |
+ assert.Assert(c, actual, checker.Equals, "koye") |
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
func (s *DockerSuite) TestCommitHardlink(c *check.C) {
|
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestCommitHardlink(c *check.C) {
|
| 71 | 71 |
chunks := strings.Split(strings.TrimSpace(firstOutput), " ") |
| 72 | 72 |
inode := chunks[0] |
| 73 | 73 |
chunks = strings.SplitAfterN(strings.TrimSpace(firstOutput), " ", 2) |
| 74 |
- c.Assert(chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 74 |
+ assert.Assert(c, chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 75 | 75 |
|
| 76 | 76 |
imageID, _ := dockerCmd(c, "commit", "hardlinks", "hardlinks") |
| 77 | 77 |
imageID = strings.TrimSpace(imageID) |
| ... | ... |
@@ -81,7 +81,7 @@ func (s *DockerSuite) TestCommitHardlink(c *check.C) {
|
| 81 | 81 |
chunks = strings.Split(strings.TrimSpace(secondOutput), " ") |
| 82 | 82 |
inode = chunks[0] |
| 83 | 83 |
chunks = strings.SplitAfterN(strings.TrimSpace(secondOutput), " ", 2) |
| 84 |
- c.Assert(chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 84 |
+ assert.Assert(c, chunks[1], checker.Contains, chunks[0], check.Commentf("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 *check.C) {
|
| ... | ... |
@@ -161,7 +161,7 @@ func (s *DockerSuite) TestCommitChangeLabels(c *check.C) {
|
| 161 | 161 |
"test", "test-commit") |
| 162 | 162 |
imageID = strings.TrimSpace(imageID) |
| 163 | 163 |
|
| 164 |
- c.Assert(inspectField(c, imageID, "Config.Labels"), checker.Equals, "map[some:label2]") |
|
| 164 |
+ assert.Assert(c, inspectField(c, imageID, "Config.Labels"), checker.Equals, "map[some:label2]") |
|
| 165 | 165 |
// check that container labels didn't change |
| 166 |
- c.Assert(inspectField(c, "test", "Config.Labels"), checker.Equals, "map[some:label]") |
|
| 166 |
+ assert.Assert(c, inspectField(c, "test", "Config.Labels"), checker.Equals, "map[some:label]") |
|
| 167 | 167 |
} |
| ... | ... |
@@ -36,38 +36,38 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
|
| 36 | 36 |
srcPath := containerCpPath(containerID, "/file2") |
| 37 | 37 |
dstPath := cpPath(tmpDir, "symlinkToFile1") |
| 38 | 38 |
|
| 39 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 39 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 40 | 40 |
|
| 41 | 41 |
// The symlink should not have been modified. |
| 42 |
- c.Assert(symlinkTargetEquals(c, dstPath, "file1"), checker.IsNil) |
|
| 42 |
+ assert.Assert(c, symlinkTargetEquals(c, dstPath, "file1"), checker.IsNil) |
|
| 43 | 43 |
|
| 44 | 44 |
// The file should have the contents of "file2" now. |
| 45 |
- c.Assert(fileContentEquals(c, cpPath(tmpDir, "file1"), "file2\n"), checker.IsNil) |
|
| 45 |
+ assert.Assert(c, fileContentEquals(c, cpPath(tmpDir, "file1"), "file2\n"), checker.IsNil) |
|
| 46 | 46 |
|
| 47 | 47 |
// Next, copy a file from the container to a symlink to a directory. This |
| 48 | 48 |
// should copy the file into the symlink target directory. |
| 49 | 49 |
dstPath = cpPath(tmpDir, "symlinkToDir1") |
| 50 | 50 |
|
| 51 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 51 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 52 | 52 |
|
| 53 | 53 |
// The symlink should not have been modified. |
| 54 |
- c.Assert(symlinkTargetEquals(c, dstPath, "dir1"), checker.IsNil) |
|
| 54 |
+ assert.Assert(c, symlinkTargetEquals(c, dstPath, "dir1"), checker.IsNil) |
|
| 55 | 55 |
|
| 56 | 56 |
// The file should have the contents of "file2" now. |
| 57 |
- c.Assert(fileContentEquals(c, cpPath(tmpDir, "file2"), "file2\n"), checker.IsNil) |
|
| 57 |
+ assert.Assert(c, fileContentEquals(c, cpPath(tmpDir, "file2"), "file2\n"), checker.IsNil) |
|
| 58 | 58 |
|
| 59 | 59 |
// Next, copy a file from the container to a symlink to a file that does |
| 60 | 60 |
// not exist (a broken symlink). This should create the target file with |
| 61 | 61 |
// the contents of the source file. |
| 62 | 62 |
dstPath = cpPath(tmpDir, "brokenSymlinkToFileX") |
| 63 | 63 |
|
| 64 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 64 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 65 | 65 |
|
| 66 | 66 |
// The symlink should not have been modified. |
| 67 |
- c.Assert(symlinkTargetEquals(c, dstPath, "fileX"), checker.IsNil) |
|
| 67 |
+ assert.Assert(c, symlinkTargetEquals(c, dstPath, "fileX"), checker.IsNil) |
|
| 68 | 68 |
|
| 69 | 69 |
// The file should have the contents of "file2" now. |
| 70 |
- c.Assert(fileContentEquals(c, cpPath(tmpDir, "fileX"), "file2\n"), checker.IsNil) |
|
| 70 |
+ assert.Assert(c, fileContentEquals(c, cpPath(tmpDir, "fileX"), "file2\n"), checker.IsNil) |
|
| 71 | 71 |
|
| 72 | 72 |
// Next, copy a directory from the container to a symlink to a local |
| 73 | 73 |
// directory. This should copy the directory into the symlink target |
| ... | ... |
@@ -75,13 +75,13 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
|
| 75 | 75 |
srcPath = containerCpPath(containerID, "/dir2") |
| 76 | 76 |
dstPath = cpPath(tmpDir, "symlinkToDir1") |
| 77 | 77 |
|
| 78 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 78 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 79 | 79 |
|
| 80 | 80 |
// The symlink should not have been modified. |
| 81 |
- c.Assert(symlinkTargetEquals(c, dstPath, "dir1"), checker.IsNil) |
|
| 81 |
+ assert.Assert(c, symlinkTargetEquals(c, dstPath, "dir1"), checker.IsNil) |
|
| 82 | 82 |
|
| 83 | 83 |
// The directory should now contain a copy of "dir2". |
| 84 |
- c.Assert(fileContentEquals(c, cpPath(tmpDir, "dir1/dir2/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 84 |
+ assert.Assert(c, fileContentEquals(c, cpPath(tmpDir, "dir1/dir2/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 85 | 85 |
|
| 86 | 86 |
// Next, copy a directory from the container to a symlink to a local |
| 87 | 87 |
// directory that does not exist (a broken symlink). This should create |
| ... | ... |
@@ -89,13 +89,13 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
|
| 89 | 89 |
// should not modify the symlink. |
| 90 | 90 |
dstPath = cpPath(tmpDir, "brokenSymlinkToDirX") |
| 91 | 91 |
|
| 92 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 92 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 93 | 93 |
|
| 94 | 94 |
// The symlink should not have been modified. |
| 95 |
- c.Assert(symlinkTargetEquals(c, dstPath, "dirX"), checker.IsNil) |
|
| 95 |
+ assert.Assert(c, symlinkTargetEquals(c, dstPath, "dirX"), checker.IsNil) |
|
| 96 | 96 |
|
| 97 | 97 |
// The "dirX" directory should now be a copy of "dir2". |
| 98 |
- c.Assert(fileContentEquals(c, cpPath(tmpDir, "dirX/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 98 |
+ assert.Assert(c, fileContentEquals(c, cpPath(tmpDir, "dirX/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
// Possibilities are reduced to the remaining 10 cases: |
| ... | ... |
@@ -129,9 +129,9 @@ func (s *DockerSuite) TestCpFromCaseA(c *check.C) {
|
| 129 | 129 |
srcPath := containerCpPath(containerID, "/root/file1") |
| 130 | 130 |
dstPath := cpPath(tmpDir, "itWorks.txt") |
| 131 | 131 |
|
| 132 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 132 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 133 | 133 |
|
| 134 |
- c.Assert(fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 134 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 135 | 135 |
} |
| 136 | 136 |
|
| 137 | 137 |
// B. SRC specifies a file and DST (with trailing path separator) doesn't |
| ... | ... |
@@ -150,7 +150,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *check.C) {
|
| 150 | 150 |
err := runDockerCp(c, srcPath, dstDir, nil) |
| 151 | 151 |
assert.ErrorContains(c, err, "") |
| 152 | 152 |
|
| 153 |
- c.Assert(isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 153 |
+ assert.Assert(c, isCpDirNotExist(err), checker.True, check.Commentf("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 |
| ... | ... |
@@ -170,11 +170,11 @@ func (s *DockerSuite) TestCpFromCaseC(c *check.C) {
|
| 170 | 170 |
dstPath := cpPath(tmpDir, "file2") |
| 171 | 171 |
|
| 172 | 172 |
// Ensure the local file starts with different content. |
| 173 |
- c.Assert(fileContentEquals(c, dstPath, "file2\n"), checker.IsNil) |
|
| 173 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file2\n"), checker.IsNil) |
|
| 174 | 174 |
|
| 175 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 175 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 176 | 176 |
|
| 177 |
- c.Assert(fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 177 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 | 180 |
// D. SRC specifies a file and DST exists as a directory. This should place |
| ... | ... |
@@ -195,25 +195,25 @@ func (s *DockerSuite) TestCpFromCaseD(c *check.C) {
|
| 195 | 195 |
|
| 196 | 196 |
// Ensure that dstPath doesn't exist. |
| 197 | 197 |
_, err := os.Stat(dstPath) |
| 198 |
- c.Assert(os.IsNotExist(err), checker.True, check.Commentf("did not expect dstPath %q to exist", dstPath))
|
|
| 198 |
+ assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("did not expect dstPath %q to exist", dstPath))
|
|
| 199 | 199 |
|
| 200 |
- c.Assert(runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 200 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 201 | 201 |
|
| 202 |
- c.Assert(fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 202 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 203 | 203 |
|
| 204 | 204 |
// Now try again but using a trailing path separator for dstDir. |
| 205 | 205 |
|
| 206 | 206 |
// unable to remove dstDir |
| 207 |
- c.Assert(os.RemoveAll(dstDir), checker.IsNil) |
|
| 207 |
+ assert.Assert(c, os.RemoveAll(dstDir), checker.IsNil) |
|
| 208 | 208 |
|
| 209 | 209 |
// unable to make dstDir |
| 210 |
- c.Assert(os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 210 |
+ assert.Assert(c, os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 211 | 211 |
|
| 212 | 212 |
dstDir = cpPathTrailingSep(tmpDir, "dir1") |
| 213 | 213 |
|
| 214 |
- c.Assert(runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 214 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 215 | 215 |
|
| 216 |
- c.Assert(fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 216 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1\n"), checker.IsNil) |
|
| 217 | 217 |
} |
| 218 | 218 |
|
| 219 | 219 |
// E. SRC specifies a directory and DST does not exist. This should create a |
| ... | ... |
@@ -231,20 +231,20 @@ func (s *DockerSuite) TestCpFromCaseE(c *check.C) {
|
| 231 | 231 |
dstDir := cpPath(tmpDir, "testDir") |
| 232 | 232 |
dstPath := filepath.Join(dstDir, "file1-1") |
| 233 | 233 |
|
| 234 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 234 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 235 | 235 |
|
| 236 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 236 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 237 | 237 |
|
| 238 | 238 |
// Now try again but using a trailing path separator for dstDir. |
| 239 | 239 |
|
| 240 | 240 |
// unable to remove dstDir |
| 241 |
- c.Assert(os.RemoveAll(dstDir), checker.IsNil) |
|
| 241 |
+ assert.Assert(c, os.RemoveAll(dstDir), checker.IsNil) |
|
| 242 | 242 |
|
| 243 | 243 |
dstDir = cpPathTrailingSep(tmpDir, "testDir") |
| 244 | 244 |
|
| 245 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 245 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 246 | 246 |
|
| 247 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 247 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
// F. SRC specifies a directory and DST exists as a file. This should cause an |
| ... | ... |
@@ -266,7 +266,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *check.C) {
|
| 266 | 266 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 267 | 267 |
assert.ErrorContains(c, err, "") |
| 268 | 268 |
|
| 269 |
- c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 269 |
+ assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("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 |
| ... | ... |
@@ -288,23 +288,23 @@ func (s *DockerSuite) TestCpFromCaseG(c *check.C) {
|
| 288 | 288 |
resultDir := filepath.Join(dstDir, "dir1") |
| 289 | 289 |
dstPath := filepath.Join(resultDir, "file1-1") |
| 290 | 290 |
|
| 291 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 291 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 292 | 292 |
|
| 293 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 293 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 294 | 294 |
|
| 295 | 295 |
// Now try again but using a trailing path separator for dstDir. |
| 296 | 296 |
|
| 297 | 297 |
// unable to remove dstDir |
| 298 |
- c.Assert(os.RemoveAll(dstDir), checker.IsNil) |
|
| 298 |
+ assert.Assert(c, os.RemoveAll(dstDir), checker.IsNil) |
|
| 299 | 299 |
|
| 300 | 300 |
// unable to make dstDir |
| 301 |
- c.Assert(os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 301 |
+ assert.Assert(c, os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 302 | 302 |
|
| 303 | 303 |
dstDir = cpPathTrailingSep(tmpDir, "dir2") |
| 304 | 304 |
|
| 305 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 305 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 306 | 306 |
|
| 307 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 307 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
// H. SRC specifies a directory's contents only and DST does not exist. This |
| ... | ... |
@@ -322,20 +322,20 @@ func (s *DockerSuite) TestCpFromCaseH(c *check.C) {
|
| 322 | 322 |
dstDir := cpPath(tmpDir, "testDir") |
| 323 | 323 |
dstPath := filepath.Join(dstDir, "file1-1") |
| 324 | 324 |
|
| 325 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 325 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 326 | 326 |
|
| 327 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 327 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 328 | 328 |
|
| 329 | 329 |
// Now try again but using a trailing path separator for dstDir. |
| 330 | 330 |
|
| 331 | 331 |
// unable to remove resultDir |
| 332 |
- c.Assert(os.RemoveAll(dstDir), checker.IsNil) |
|
| 332 |
+ assert.Assert(c, os.RemoveAll(dstDir), checker.IsNil) |
|
| 333 | 333 |
|
| 334 | 334 |
dstDir = cpPathTrailingSep(tmpDir, "testDir") |
| 335 | 335 |
|
| 336 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 336 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 337 | 337 |
|
| 338 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 338 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 339 | 339 |
} |
| 340 | 340 |
|
| 341 | 341 |
// I. SRC specifies a directory's contents only and DST exists as a file. This |
| ... | ... |
@@ -358,7 +358,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *check.C) {
|
| 358 | 358 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 359 | 359 |
assert.ErrorContains(c, err, "") |
| 360 | 360 |
|
| 361 |
- c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 361 |
+ assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("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. |
| ... | ... |
@@ -380,21 +380,21 @@ func (s *DockerSuite) TestCpFromCaseJ(c *check.C) {
|
| 380 | 380 |
dstDir := cpPath(tmpDir, "dir2") |
| 381 | 381 |
dstPath := filepath.Join(dstDir, "file1-1") |
| 382 | 382 |
|
| 383 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 383 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 384 | 384 |
|
| 385 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 385 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 386 | 386 |
|
| 387 | 387 |
// Now try again but using a trailing path separator for dstDir. |
| 388 | 388 |
|
| 389 | 389 |
// unable to remove dstDir |
| 390 |
- c.Assert(os.RemoveAll(dstDir), checker.IsNil) |
|
| 390 |
+ assert.Assert(c, os.RemoveAll(dstDir), checker.IsNil) |
|
| 391 | 391 |
|
| 392 | 392 |
// unable to make dstDir |
| 393 |
- c.Assert(os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 393 |
+ assert.Assert(c, os.MkdirAll(dstDir, os.FileMode(0755)), checker.IsNil) |
|
| 394 | 394 |
|
| 395 | 395 |
dstDir = cpPathTrailingSep(tmpDir, "dir2") |
| 396 | 396 |
|
| 397 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 397 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 398 | 398 |
|
| 399 |
- c.Assert(fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 399 |
+ assert.Assert(c, fileContentEquals(c, dstPath, "file1-1\n"), checker.IsNil) |
|
| 400 | 400 |
} |
| ... | ... |
@@ -40,38 +40,38 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
|
| 40 | 40 |
srcPath := cpPath(testVol, "file2") |
| 41 | 41 |
dstPath := containerCpPath(containerID, "/vol2/symlinkToFile1") |
| 42 | 42 |
|
| 43 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 43 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 44 | 44 |
|
| 45 | 45 |
// The symlink should not have been modified. |
| 46 |
- c.Assert(symlinkTargetEquals(c, cpPath(testVol, "symlinkToFile1"), "file1"), checker.IsNil) |
|
| 46 |
+ assert.Assert(c, symlinkTargetEquals(c, cpPath(testVol, "symlinkToFile1"), "file1"), checker.IsNil) |
|
| 47 | 47 |
|
| 48 | 48 |
// The file should have the contents of "file2" now. |
| 49 |
- c.Assert(fileContentEquals(c, cpPath(testVol, "file1"), "file2\n"), checker.IsNil) |
|
| 49 |
+ assert.Assert(c, fileContentEquals(c, cpPath(testVol, "file1"), "file2\n"), checker.IsNil) |
|
| 50 | 50 |
|
| 51 | 51 |
// Next, copy a local file to a symlink to a directory in the container. |
| 52 | 52 |
// This should copy the file into the symlink target directory. |
| 53 | 53 |
dstPath = containerCpPath(containerID, "/vol2/symlinkToDir1") |
| 54 | 54 |
|
| 55 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 55 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 56 | 56 |
|
| 57 | 57 |
// The symlink should not have been modified. |
| 58 |
- c.Assert(symlinkTargetEquals(c, cpPath(testVol, "symlinkToDir1"), "dir1"), checker.IsNil) |
|
| 58 |
+ assert.Assert(c, symlinkTargetEquals(c, cpPath(testVol, "symlinkToDir1"), "dir1"), checker.IsNil) |
|
| 59 | 59 |
|
| 60 | 60 |
// The file should have the contents of "file2" now. |
| 61 |
- c.Assert(fileContentEquals(c, cpPath(testVol, "file2"), "file2\n"), checker.IsNil) |
|
| 61 |
+ assert.Assert(c, fileContentEquals(c, cpPath(testVol, "file2"), "file2\n"), checker.IsNil) |
|
| 62 | 62 |
|
| 63 | 63 |
// Next, copy a file to a symlink to a file that does not exist (a broken |
| 64 | 64 |
// symlink) in the container. This should create the target file with the |
| 65 | 65 |
// contents of the source file. |
| 66 | 66 |
dstPath = containerCpPath(containerID, "/vol2/brokenSymlinkToFileX") |
| 67 | 67 |
|
| 68 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 68 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 69 | 69 |
|
| 70 | 70 |
// The symlink should not have been modified. |
| 71 |
- c.Assert(symlinkTargetEquals(c, cpPath(testVol, "brokenSymlinkToFileX"), "fileX"), checker.IsNil) |
|
| 71 |
+ assert.Assert(c, symlinkTargetEquals(c, cpPath(testVol, "brokenSymlinkToFileX"), "fileX"), checker.IsNil) |
|
| 72 | 72 |
|
| 73 | 73 |
// The file should have the contents of "file2" now. |
| 74 |
- c.Assert(fileContentEquals(c, cpPath(testVol, "fileX"), "file2\n"), checker.IsNil) |
|
| 74 |
+ assert.Assert(c, fileContentEquals(c, cpPath(testVol, "fileX"), "file2\n"), checker.IsNil) |
|
| 75 | 75 |
|
| 76 | 76 |
// Next, copy a local directory to a symlink to a directory in the |
| 77 | 77 |
// container. This should copy the directory into the symlink target |
| ... | ... |
@@ -79,13 +79,13 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
|
| 79 | 79 |
srcPath = cpPath(testVol, "/dir2") |
| 80 | 80 |
dstPath = containerCpPath(containerID, "/vol2/symlinkToDir1") |
| 81 | 81 |
|
| 82 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 82 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 83 | 83 |
|
| 84 | 84 |
// The symlink should not have been modified. |
| 85 |
- c.Assert(symlinkTargetEquals(c, cpPath(testVol, "symlinkToDir1"), "dir1"), checker.IsNil) |
|
| 85 |
+ assert.Assert(c, symlinkTargetEquals(c, cpPath(testVol, "symlinkToDir1"), "dir1"), checker.IsNil) |
|
| 86 | 86 |
|
| 87 | 87 |
// The directory should now contain a copy of "dir2". |
| 88 |
- c.Assert(fileContentEquals(c, cpPath(testVol, "dir1/dir2/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 88 |
+ assert.Assert(c, fileContentEquals(c, cpPath(testVol, "dir1/dir2/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 89 | 89 |
|
| 90 | 90 |
// Next, copy a local directory to a symlink to a local directory that does |
| 91 | 91 |
// not exist (a broken symlink) in the container. This should create the |
| ... | ... |
@@ -93,13 +93,13 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
|
| 93 | 93 |
// should not modify the symlink. |
| 94 | 94 |
dstPath = containerCpPath(containerID, "/vol2/brokenSymlinkToDirX") |
| 95 | 95 |
|
| 96 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 96 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 97 | 97 |
|
| 98 | 98 |
// The symlink should not have been modified. |
| 99 |
- c.Assert(symlinkTargetEquals(c, cpPath(testVol, "brokenSymlinkToDirX"), "dirX"), checker.IsNil) |
|
| 99 |
+ assert.Assert(c, symlinkTargetEquals(c, cpPath(testVol, "brokenSymlinkToDirX"), "dirX"), checker.IsNil) |
|
| 100 | 100 |
|
| 101 | 101 |
// The "dirX" directory should now be a copy of "dir2". |
| 102 |
- c.Assert(fileContentEquals(c, cpPath(testVol, "dirX/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 102 |
+ assert.Assert(c, fileContentEquals(c, cpPath(testVol, "dirX/file2-1"), "file2-1\n"), checker.IsNil) |
|
| 103 | 103 |
} |
| 104 | 104 |
|
| 105 | 105 |
// Possibilities are reduced to the remaining 10 cases: |
| ... | ... |
@@ -134,9 +134,9 @@ func (s *DockerSuite) TestCpToCaseA(c *check.C) {
|
| 134 | 134 |
srcPath := cpPath(tmpDir, "file1") |
| 135 | 135 |
dstPath := containerCpPath(containerID, "/root/itWorks.txt") |
| 136 | 136 |
|
| 137 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 137 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 138 | 138 |
|
| 139 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 139 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 | 142 |
// B. SRC specifies a file and DST (with trailing path separator) doesn't |
| ... | ... |
@@ -158,7 +158,7 @@ func (s *DockerSuite) TestCpToCaseB(c *check.C) {
|
| 158 | 158 |
err := runDockerCp(c, srcPath, dstDir, nil) |
| 159 | 159 |
assert.ErrorContains(c, err, "") |
| 160 | 160 |
|
| 161 |
- c.Assert(isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
|
|
| 161 |
+ assert.Assert(c, isCpDirNotExist(err), checker.True, check.Commentf("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 |
| ... | ... |
@@ -179,12 +179,12 @@ func (s *DockerSuite) TestCpToCaseC(c *check.C) {
|
| 179 | 179 |
dstPath := containerCpPath(containerID, "/root/file2") |
| 180 | 180 |
|
| 181 | 181 |
// Ensure the container's file starts with the original content. |
| 182 |
- c.Assert(containerStartOutputEquals(c, containerID, "file2\n"), checker.IsNil) |
|
| 182 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file2\n"), checker.IsNil) |
|
| 183 | 183 |
|
| 184 |
- c.Assert(runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 184 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstPath, nil), checker.IsNil) |
|
| 185 | 185 |
|
| 186 | 186 |
// Should now contain file1's contents. |
| 187 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 187 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 | 190 |
// D. SRC specifies a file and DST exists as a directory. This should place |
| ... | ... |
@@ -206,12 +206,12 @@ func (s *DockerSuite) TestCpToCaseD(c *check.C) {
|
| 206 | 206 |
dstDir := containerCpPath(containerID, "dir1") |
| 207 | 207 |
|
| 208 | 208 |
// Ensure that dstPath doesn't exist. |
| 209 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 209 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 210 | 210 |
|
| 211 |
- c.Assert(runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 211 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 212 | 212 |
|
| 213 | 213 |
// Should now contain file1's contents. |
| 214 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 214 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 215 | 215 |
|
| 216 | 216 |
// Now try again but using a trailing path separator for dstDir. |
| 217 | 217 |
|
| ... | ... |
@@ -224,12 +224,12 @@ func (s *DockerSuite) TestCpToCaseD(c *check.C) {
|
| 224 | 224 |
dstDir = containerCpPathTrailingSep(containerID, "dir1") |
| 225 | 225 |
|
| 226 | 226 |
// Ensure that dstPath doesn't exist. |
| 227 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 227 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 228 | 228 |
|
| 229 |
- c.Assert(runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 229 |
+ assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil), checker.IsNil) |
|
| 230 | 230 |
|
| 231 | 231 |
// Should now contain file1's contents. |
| 232 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 232 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1\n"), checker.IsNil) |
|
| 233 | 233 |
} |
| 234 | 234 |
|
| 235 | 235 |
// E. SRC specifies a directory and DST does not exist. This should create a |
| ... | ... |
@@ -249,10 +249,10 @@ func (s *DockerSuite) TestCpToCaseE(c *check.C) {
|
| 249 | 249 |
srcDir := cpPath(tmpDir, "dir1") |
| 250 | 250 |
dstDir := containerCpPath(containerID, "testDir") |
| 251 | 251 |
|
| 252 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 252 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 253 | 253 |
|
| 254 | 254 |
// Should now contain file1-1's contents. |
| 255 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 255 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 256 | 256 |
|
| 257 | 257 |
// Now try again but using a trailing path separator for dstDir. |
| 258 | 258 |
|
| ... | ... |
@@ -263,10 +263,10 @@ func (s *DockerSuite) TestCpToCaseE(c *check.C) {
|
| 263 | 263 |
|
| 264 | 264 |
dstDir = containerCpPathTrailingSep(containerID, "testDir") |
| 265 | 265 |
|
| 266 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 266 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 267 | 267 |
|
| 268 | 268 |
// Should now contain file1-1's contents. |
| 269 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 269 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 270 | 270 |
} |
| 271 | 271 |
|
| 272 | 272 |
// F. SRC specifies a directory and DST exists as a file. This should cause an |
| ... | ... |
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestCpToCaseF(c *check.C) {
|
| 288 | 288 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 289 | 289 |
assert.ErrorContains(c, err, "") |
| 290 | 290 |
|
| 291 |
- c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 291 |
+ assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("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 |
| ... | ... |
@@ -310,12 +310,12 @@ func (s *DockerSuite) TestCpToCaseG(c *check.C) {
|
| 310 | 310 |
dstDir := containerCpPath(containerID, "/root/dir2") |
| 311 | 311 |
|
| 312 | 312 |
// Ensure that dstPath doesn't exist. |
| 313 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 313 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 314 | 314 |
|
| 315 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 315 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 316 | 316 |
|
| 317 | 317 |
// Should now contain file1-1's contents. |
| 318 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 318 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 319 | 319 |
|
| 320 | 320 |
// Now try again but using a trailing path separator for dstDir. |
| 321 | 321 |
|
| ... | ... |
@@ -328,12 +328,12 @@ func (s *DockerSuite) TestCpToCaseG(c *check.C) {
|
| 328 | 328 |
dstDir = containerCpPathTrailingSep(containerID, "/dir2") |
| 329 | 329 |
|
| 330 | 330 |
// Ensure that dstPath doesn't exist. |
| 331 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 331 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 332 | 332 |
|
| 333 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 333 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 334 | 334 |
|
| 335 | 335 |
// Should now contain file1-1's contents. |
| 336 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 336 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 337 | 337 |
} |
| 338 | 338 |
|
| 339 | 339 |
// H. SRC specifies a directory's contents only and DST does not exist. This |
| ... | ... |
@@ -353,10 +353,10 @@ func (s *DockerSuite) TestCpToCaseH(c *check.C) {
|
| 353 | 353 |
srcDir := cpPathTrailingSep(tmpDir, "dir1") + "." |
| 354 | 354 |
dstDir := containerCpPath(containerID, "testDir") |
| 355 | 355 |
|
| 356 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 356 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 357 | 357 |
|
| 358 | 358 |
// Should now contain file1-1's contents. |
| 359 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 359 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 360 | 360 |
|
| 361 | 361 |
// Now try again but using a trailing path separator for dstDir. |
| 362 | 362 |
|
| ... | ... |
@@ -367,10 +367,10 @@ func (s *DockerSuite) TestCpToCaseH(c *check.C) {
|
| 367 | 367 |
|
| 368 | 368 |
dstDir = containerCpPathTrailingSep(containerID, "testDir") |
| 369 | 369 |
|
| 370 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 370 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 371 | 371 |
|
| 372 | 372 |
// Should now contain file1-1's contents. |
| 373 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 373 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 374 | 374 |
} |
| 375 | 375 |
|
| 376 | 376 |
// I. SRC specifies a directory's contents only and DST exists as a file. This |
| ... | ... |
@@ -393,7 +393,7 @@ func (s *DockerSuite) TestCpToCaseI(c *check.C) {
|
| 393 | 393 |
err := runDockerCp(c, srcDir, dstFile, nil) |
| 394 | 394 |
assert.ErrorContains(c, err, "") |
| 395 | 395 |
|
| 396 |
- c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
|
|
| 396 |
+ assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("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. |
| ... | ... |
@@ -416,12 +416,12 @@ func (s *DockerSuite) TestCpToCaseJ(c *check.C) {
|
| 416 | 416 |
dstDir := containerCpPath(containerID, "/dir2") |
| 417 | 417 |
|
| 418 | 418 |
// Ensure that dstPath doesn't exist. |
| 419 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 419 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 420 | 420 |
|
| 421 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 421 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 422 | 422 |
|
| 423 | 423 |
// Should now contain file1-1's contents. |
| 424 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 424 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 425 | 425 |
|
| 426 | 426 |
// Now try again but using a trailing path separator for dstDir. |
| 427 | 427 |
|
| ... | ... |
@@ -433,12 +433,12 @@ func (s *DockerSuite) TestCpToCaseJ(c *check.C) {
|
| 433 | 433 |
dstDir = containerCpPathTrailingSep(containerID, "/dir2") |
| 434 | 434 |
|
| 435 | 435 |
// Ensure that dstPath doesn't exist. |
| 436 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 436 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 437 | 437 |
|
| 438 |
- c.Assert(runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 438 |
+ assert.Assert(c, runDockerCp(c, srcDir, dstDir, nil), checker.IsNil) |
|
| 439 | 439 |
|
| 440 | 440 |
// Should now contain file1-1's contents. |
| 441 |
- c.Assert(containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 441 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, "file1-1\n"), checker.IsNil) |
|
| 442 | 442 |
} |
| 443 | 443 |
|
| 444 | 444 |
// The `docker cp` command should also ensure that you cannot |
| ... | ... |
@@ -462,10 +462,10 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) {
|
| 462 | 462 |
err := runDockerCp(c, srcPath, dstPath, nil) |
| 463 | 463 |
assert.ErrorContains(c, err, "") |
| 464 | 464 |
|
| 465 |
- c.Assert(isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
|
|
| 465 |
+ assert.Assert(c, isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
|
|
| 466 | 466 |
|
| 467 | 467 |
// Ensure that dstPath doesn't exist. |
| 468 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 468 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 469 | 469 |
} |
| 470 | 470 |
|
| 471 | 471 |
// The `docker cp` command should also ensure that you |
| ... | ... |
@@ -489,8 +489,8 @@ func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *check.C) {
|
| 489 | 489 |
err := runDockerCp(c, srcPath, dstPath, nil) |
| 490 | 490 |
assert.ErrorContains(c, err, "") |
| 491 | 491 |
|
| 492 |
- c.Assert(isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
|
|
| 492 |
+ assert.Assert(c, isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
|
|
| 493 | 493 |
|
| 494 | 494 |
// Ensure that dstPath doesn't exist. |
| 495 |
- c.Assert(containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 495 |
+ assert.Assert(c, containerStartOutputEquals(c, containerID, ""), checker.IsNil) |
|
| 496 | 496 |
} |
| ... | ... |
@@ -37,11 +37,11 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
err := json.Unmarshal([]byte(out), &containers) |
| 40 |
- c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 40 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 41 | 41 |
assert.Equal(c, len(containers), 1) |
| 42 | 42 |
|
| 43 | 43 |
cont := containers[0] |
| 44 |
- c.Assert(string(cont.Path), checker.Equals, "command", check.Commentf("Unexpected container path. Expected command, received: %s", cont.Path))
|
|
| 44 |
+ assert.Assert(c, string(cont.Path), checker.Equals, "command", check.Commentf("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"}
|
| ... | ... |
@@ -68,7 +68,7 @@ func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) {
|
| 68 | 68 |
cleanedContainerID := strings.TrimSpace(out) |
| 69 | 69 |
|
| 70 | 70 |
inspectOut := inspectField(c, cleanedContainerID, "HostConfig.StorageOpt") |
| 71 |
- c.Assert(inspectOut, checker.Equals, "map[size:120G]") |
|
| 71 |
+ assert.Assert(c, inspectOut, checker.Equals, "map[size:120G]") |
|
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 | 74 |
// Make sure we cannot shrink the container's rootfs at creation time. |
| ... | ... |
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) {
|
| 78 | 78 |
// Ensure this fails because of the defaultBaseFsSize is 10G |
| 79 | 79 |
out, _, err := dockerCmdWithError("create", "--storage-opt", "size=5G", "busybox")
|
| 80 | 80 |
assert.ErrorContains(c, err, "", out) |
| 81 |
- c.Assert(out, checker.Contains, "Container size cannot be smaller than") |
|
| 81 |
+ assert.Assert(c, out, checker.Contains, "Container size cannot be smaller than") |
|
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 | 84 |
// Make sure we can set hostconfig options too |
| ... | ... |
@@ -96,12 +96,12 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
err := json.Unmarshal([]byte(out), &containers) |
| 99 |
- c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 99 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 100 | 100 |
assert.Equal(c, len(containers), 1) |
| 101 | 101 |
|
| 102 | 102 |
cont := containers[0] |
| 103 |
- c.Assert(cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 104 |
- c.Assert(cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false"))
|
|
| 103 |
+ assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 104 |
+ assert.Assert(c, cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false"))
|
|
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 | 107 |
func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
|
| ... | ... |
@@ -117,17 +117,17 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
|
| 117 | 117 |
} |
| 118 | 118 |
} |
| 119 | 119 |
err := json.Unmarshal([]byte(out), &containers) |
| 120 |
- c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 120 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 121 | 121 |
assert.Equal(c, len(containers), 1) |
| 122 | 122 |
|
| 123 | 123 |
cont := containers[0] |
| 124 | 124 |
|
| 125 |
- c.Assert(cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 126 |
- c.Assert(cont.HostConfig.PortBindings, checker.HasLen, 4, check.Commentf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
|
|
| 125 |
+ assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 126 |
+ assert.Assert(c, cont.HostConfig.PortBindings, checker.HasLen, 4, check.Commentf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
|
|
| 127 | 127 |
|
| 128 | 128 |
for k, v := range cont.HostConfig.PortBindings {
|
| 129 |
- c.Assert(v, checker.HasLen, 1, check.Commentf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 130 |
- c.Assert(k.Port(), checker.Equals, v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 129 |
+ assert.Assert(c, v, checker.HasLen, 1, check.Commentf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 130 |
+ assert.Assert(c, k.Port(), checker.Equals, v[0].HostPort, check.Commentf("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 *check.C) {
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
err := json.Unmarshal([]byte(out), &containers) |
| 150 |
- c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 150 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 151 | 151 |
assert.Equal(c, len(containers), 1) |
| 152 | 152 |
|
| 153 | 153 |
cont := containers[0] |
| 154 |
- c.Assert(cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 155 |
- c.Assert(cont.HostConfig.PortBindings, checker.HasLen, 65535) |
|
| 154 |
+ assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 155 |
+ assert.Assert(c, cont.HostConfig.PortBindings, checker.HasLen, 65535) |
|
| 156 | 156 |
|
| 157 | 157 |
for k, v := range cont.HostConfig.PortBindings {
|
| 158 |
- c.Assert(v, checker.HasLen, 1) |
|
| 159 |
- c.Assert(k.Port(), checker.Equals, v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
|
| 158 |
+ assert.Assert(c, v, checker.HasLen, 1) |
|
| 159 |
+ assert.Assert(c, k.Port(), checker.Equals, v[0].HostPort, check.Commentf("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 *check.C) {
|
| 179 | 179 |
dockerCmd(c, "create", "--name", name, "-v", prefix+slash+"foo", "busybox") |
| 180 | 180 |
|
| 181 | 181 |
dir, err := inspectMountSourceField(name, prefix+slash+"foo") |
| 182 |
- c.Assert(err, check.IsNil, check.Commentf("Error getting volume host path: %q", err))
|
|
| 182 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("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")
|
| ... | ... |
@@ -295,7 +295,7 @@ func (s *DockerSuite) TestCreateStopSignal(c *check.C) {
|
| 295 | 295 |
dockerCmd(c, "create", "--name", name, "--stop-signal", "9", "busybox") |
| 296 | 296 |
|
| 297 | 297 |
res := inspectFieldJSON(c, name, "Config.StopSignal") |
| 298 |
- c.Assert(res, checker.Contains, "9") |
|
| 298 |
+ assert.Assert(c, res, checker.Contains, "9") |
|
| 299 | 299 |
|
| 300 | 300 |
} |
| 301 | 301 |
|
| ... | ... |
@@ -325,11 +325,11 @@ func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *check.C) {
|
| 325 | 325 |
name := "test-invalidate-log-opts" |
| 326 | 326 |
out, _, err := dockerCmdWithError("create", "--name", name, "--log-opt", "invalid=true", "busybox")
|
| 327 | 327 |
assert.ErrorContains(c, err, "") |
| 328 |
- c.Assert(out, checker.Contains, "unknown log opt") |
|
| 328 |
+ assert.Assert(c, out, checker.Contains, "unknown log opt") |
|
| 329 | 329 |
assert.Assert(c, is.Contains(out, "unknown log opt")) |
| 330 | 330 |
|
| 331 | 331 |
out, _ = dockerCmd(c, "ps", "-a") |
| 332 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 332 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
// #20972 |
| ... | ... |
@@ -362,9 +362,9 @@ exec "$@"`, |
| 362 | 362 |
|
| 363 | 363 |
out := cli.DockerCmd(c, "create", "--entrypoint=", name, "echo", "foo").Combined() |
| 364 | 364 |
id := strings.TrimSpace(out) |
| 365 |
- c.Assert(id, check.Not(check.Equals), "") |
|
| 365 |
+ assert.Assert(c, id, check.Not(check.Equals), "") |
|
| 366 | 366 |
out = cli.DockerCmd(c, "start", "-a", id).Combined() |
| 367 |
- c.Assert(strings.TrimSpace(out), check.Equals, "foo") |
|
| 367 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "foo") |
|
| 368 | 368 |
} |
| 369 | 369 |
|
| 370 | 370 |
// #22471 |
| ... | ... |
@@ -373,11 +373,11 @@ func (s *DockerSuite) TestCreateStopTimeout(c *check.C) {
|
| 373 | 373 |
dockerCmd(c, "create", "--name", name1, "--stop-timeout", "15", "busybox") |
| 374 | 374 |
|
| 375 | 375 |
res := inspectFieldJSON(c, name1, "Config.StopTimeout") |
| 376 |
- c.Assert(res, checker.Contains, "15") |
|
| 376 |
+ assert.Assert(c, res, checker.Contains, "15") |
|
| 377 | 377 |
|
| 378 | 378 |
name2 := "test_create_stop_timeout_2" |
| 379 | 379 |
dockerCmd(c, "create", "--name", name2, "busybox") |
| 380 | 380 |
|
| 381 | 381 |
res = inspectFieldJSON(c, name2, "Config.StopTimeout") |
| 382 |
- c.Assert(res, checker.Contains, "null") |
|
| 382 |
+ assert.Assert(c, res, checker.Contains, "null") |
|
| 383 | 383 |
} |
| ... | ... |
@@ -130,13 +130,13 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *check.C) {
|
| 130 | 130 |
var format string |
| 131 | 131 |
for name, shouldRun := range m {
|
| 132 | 132 |
out, err := s.d.Cmd("ps")
|
| 133 |
- c.Assert(err, check.IsNil, check.Commentf("run ps: %v", out))
|
|
| 133 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("run ps: %v", out))
|
|
| 134 | 134 |
if shouldRun {
|
| 135 | 135 |
format = "%scontainer %q is not running" |
| 136 | 136 |
} else {
|
| 137 | 137 |
format = "%scontainer %q is running" |
| 138 | 138 |
} |
| 139 |
- c.Assert(strings.Contains(out, name), check.Equals, shouldRun, check.Commentf(format, prefix, name)) |
|
| 139 |
+ assert.Assert(c, strings.Contains(out, name), check.Equals, shouldRun, check.Commentf(format, prefix, name)) |
|
| 140 | 140 |
} |
| 141 | 141 |
} |
| 142 | 142 |
|
| ... | ... |
@@ -216,7 +216,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *check.C) {
|
| 216 | 216 |
|
| 217 | 217 |
if newBasesizeBytes < oldBasesizeBytes {
|
| 218 | 218 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 219 |
- c.Assert(err, check.NotNil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 219 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 220 | 220 |
// 'err != nil' is expected behaviour, no new daemon started, |
| 221 | 221 |
// so no need to stop daemon. |
| 222 | 222 |
if err != nil {
|
| ... | ... |
@@ -240,12 +240,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *check.C) {
|
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 | 242 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 243 |
- c.Assert(err, check.IsNil, check.Commentf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 243 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 244 | 244 |
|
| 245 | 245 |
basesizeAfterRestart := getBaseDeviceSize(c, s.d) |
| 246 | 246 |
newBasesize, err := convertBasesize(newBasesizeBytes) |
| 247 |
- c.Assert(err, check.IsNil, check.Commentf("Error in converting base device size: %v", err))
|
|
| 248 |
- c.Assert(newBasesize, check.Equals, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
|
| 247 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Error in converting base device size: %v", err))
|
|
| 248 |
+ assert.Assert(c, newBasesize, check.Equals, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
|
| 249 | 249 |
s.d.Stop(c) |
| 250 | 250 |
} |
| 251 | 251 |
|
| ... | ... |
@@ -434,12 +434,12 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) {
|
| 434 | 434 |
out = strings.Trim(out, " \r\n'") |
| 435 | 435 |
|
| 436 | 436 |
ip := net.ParseIP(out) |
| 437 |
- c.Assert(ip, checker.NotNil, check.Commentf("Container should have a global IPv6 address"))
|
|
| 437 |
+ assert.Assert(c, ip, checker.NotNil, check.Commentf("Container should have a global IPv6 address"))
|
|
| 438 | 438 |
|
| 439 | 439 |
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.IPv6Gateway}}", "ipv6test")
|
| 440 | 440 |
assert.NilError(c, err, out) |
| 441 | 441 |
|
| 442 |
- c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:2::100", check.Commentf("Container should have a global IPv6 gateway"))
|
|
| 442 |
+ assert.Assert(c, strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:2::100", check.Commentf("Container should have a global IPv6 gateway"))
|
|
| 443 | 443 |
} |
| 444 | 444 |
|
| 445 | 445 |
// TestDaemonIPv6FixedCIDRAndMac checks that when the daemon is started with ipv6 fixed CIDR |
| ... | ... |
@@ -458,7 +458,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) {
|
| 458 | 458 |
|
| 459 | 459 |
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
|
| 460 | 460 |
assert.NilError(c, err, out) |
| 461 |
- c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:1::aabb:ccdd:eeff") |
|
| 461 |
+ assert.Assert(c, strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:1::aabb:ccdd:eeff") |
|
| 462 | 462 |
} |
| 463 | 463 |
|
| 464 | 464 |
// TestDaemonIPv6HostMode checks that when the running a container with |
| ... | ... |
@@ -473,11 +473,11 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *check.C) {
|
| 473 | 473 |
|
| 474 | 474 |
out, err = s.d.Cmd("exec", "hostcnt", "ip", "-6", "addr", "show", "docker0")
|
| 475 | 475 |
assert.NilError(c, err, out) |
| 476 |
- c.Assert(strings.Trim(out, " \r\n'"), checker.Contains, "2001:db8:2::1") |
|
| 476 |
+ assert.Assert(c, strings.Trim(out, " \r\n'"), checker.Contains, "2001:db8:2::1") |
|
| 477 | 477 |
} |
| 478 | 478 |
|
| 479 | 479 |
func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *check.C) {
|
| 480 |
- c.Assert(s.d.StartWithError("--log-level=bogus"), check.NotNil, check.Commentf("Daemon shouldn't start with wrong log level"))
|
|
| 480 |
+ assert.Assert(c, s.d.StartWithError("--log-level=bogus"), check.NotNil, check.Commentf("Daemon shouldn't start with wrong log level"))
|
|
| 481 | 481 |
} |
| 482 | 482 |
|
| 483 | 483 |
func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *check.C) {
|
| ... | ... |
@@ -679,7 +679,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
|
| 679 | 679 |
|
| 680 | 680 |
containerIP := d.FindContainerIP(c, "test") |
| 681 | 681 |
ip = net.ParseIP(containerIP) |
| 682 |
- c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 682 |
+ assert.Assert(c, bridgeIPNet.Contains(ip), check.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 683 | 683 |
deleteInterface(c, defaultNetworkBridge) |
| 684 | 684 |
} |
| 685 | 685 |
|
| ... | ... |
@@ -783,7 +783,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) {
|
| 783 | 783 |
expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
|
| 784 | 784 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 785 | 785 |
assert.NilError(c, err, out) |
| 786 |
- c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 786 |
+ assert.Assert(c, strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 787 | 787 |
deleteInterface(c, defaultNetworkBridge) |
| 788 | 788 |
} |
| 789 | 789 |
|
| ... | ... |
@@ -803,7 +803,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) {
|
| 803 | 803 |
expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
|
| 804 | 804 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 805 | 805 |
assert.NilError(c, err, out) |
| 806 |
- c.Assert(strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 806 |
+ assert.Assert(c, strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 807 | 807 |
deleteInterface(c, defaultNetworkBridge) |
| 808 | 808 |
} |
| 809 | 809 |
|
| ... | ... |
@@ -844,8 +844,8 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) {
|
| 844 | 844 |
defer d.Restart(c) |
| 845 | 845 |
|
| 846 | 846 |
out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
|
| 847 |
- c.Assert(err, check.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 848 |
- c.Assert(strings.Contains(out, "Error starting userland proxy"), check.Equals, true) |
|
| 847 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 848 |
+ assert.Assert(c, strings.Contains(out, "Error starting userland proxy"), check.Equals, true) |
|
| 849 | 849 |
|
| 850 | 850 |
ifName := "dummy" |
| 851 | 851 |
createInterface(c, "dummy", ifName, ipStr) |
| ... | ... |
@@ -858,7 +858,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) {
|
| 858 | 858 |
result.Assert(c, icmd.Success) |
| 859 | 859 |
regex := fmt.Sprintf("DNAT.*%s.*dpt:8000", ip.String())
|
| 860 | 860 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 861 |
- c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 861 |
+ assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 862 | 862 |
} |
| 863 | 863 |
|
| 864 | 864 |
func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
|
| ... | ... |
@@ -878,7 +878,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
|
| 878 | 878 |
result.Assert(c, icmd.Success) |
| 879 | 879 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 880 | 880 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 881 |
- c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 881 |
+ assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 882 | 882 |
// Pinging another container must fail with --icc=false |
| 883 | 883 |
pingContainers(c, d, true) |
| 884 | 884 |
|
| ... | ... |
@@ -911,7 +911,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
|
| 911 | 911 |
result.Assert(c, icmd.Success) |
| 912 | 912 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 913 | 913 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 914 |
- c.Assert(matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 914 |
+ assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 915 | 915 |
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
| 916 | 916 |
assert.NilError(c, err, out) |
| 917 | 917 |
|
| ... | ... |
@@ -1136,7 +1136,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) {
|
| 1136 | 1136 |
assert.NilError(c, err, out) |
| 1137 | 1137 |
|
| 1138 | 1138 |
out, err = s.d.Cmd("logs", "test")
|
| 1139 |
- c.Assert(err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
|
| 1139 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
|
| 1140 | 1140 |
expected := `configured logging driver does not support reading` |
| 1141 | 1141 |
assert.Assert(c, strings.Contains(out, expected)) |
| 1142 | 1142 |
} |
| ... | ... |
@@ -1151,9 +1151,9 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *ch |
| 1151 | 1151 |
build.WithoutCache, |
| 1152 | 1152 |
) |
| 1153 | 1153 |
comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
| 1154 |
- c.Assert(result.Error, check.IsNil, comment) |
|
| 1155 |
- c.Assert(result.ExitCode, check.Equals, 0, comment) |
|
| 1156 |
- c.Assert(result.Combined(), checker.Contains, "foo", comment) |
|
| 1154 |
+ assert.Assert(c, result.Error, check.IsNil, comment) |
|
| 1155 |
+ assert.Assert(c, result.ExitCode, check.Equals, 0, comment) |
|
| 1156 |
+ assert.Assert(c, result.Combined(), checker.Contains, "foo", comment) |
|
| 1157 | 1157 |
} |
| 1158 | 1158 |
|
| 1159 | 1159 |
func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) {
|
| ... | ... |
@@ -1223,7 +1223,7 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) {
|
| 1223 | 1223 |
} |
| 1224 | 1224 |
|
| 1225 | 1225 |
content, err := s.d.ReadLogFile() |
| 1226 |
- c.Assert(err, checker.IsNil) |
|
| 1226 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 1227 | 1227 |
|
| 1228 | 1228 |
if !strings.Contains(string(content), "Public Key ID does not match") {
|
| 1229 | 1229 |
c.Fatalf("Missing KeyID message from daemon logs: %s", string(content))
|
| ... | ... |
@@ -1569,7 +1569,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway |
| 1569 | 1569 |
|
| 1570 | 1570 |
out, err = s.d.Cmd("ps", "-q")
|
| 1571 | 1571 |
assert.NilError(c, err, out) |
| 1572 |
- c.Assert(strings.TrimSpace(out), check.Equals, id[:12]) |
|
| 1572 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, id[:12]) |
|
| 1573 | 1573 |
} |
| 1574 | 1574 |
|
| 1575 | 1575 |
func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) {
|
| ... | ... |
@@ -1630,8 +1630,8 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) {
|
| 1630 | 1630 |
s.d.Restart(c) |
| 1631 | 1631 |
|
| 1632 | 1632 |
out, err = s.d.Cmd("volume", "rm", "test")
|
| 1633 |
- c.Assert(err, check.NotNil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
|
| 1634 |
- c.Assert(out, checker.Contains, "in use") |
|
| 1633 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
|
| 1634 |
+ assert.Assert(c, out, checker.Contains, "in use") |
|
| 1635 | 1635 |
} |
| 1636 | 1636 |
|
| 1637 | 1637 |
func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) {
|
| ... | ... |
@@ -1648,7 +1648,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) {
|
| 1648 | 1648 |
// FIXME(vdemeester) should be a unit test |
| 1649 | 1649 |
func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) {
|
| 1650 | 1650 |
d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) |
| 1651 |
- c.Assert(d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil)
|
|
| 1651 |
+ assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil)
|
|
| 1652 | 1652 |
expected := "syslog-address should be in form proto://address" |
| 1653 | 1653 |
icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
|
| 1654 | 1654 |
} |
| ... | ... |
@@ -1656,7 +1656,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) {
|
| 1656 | 1656 |
// FIXME(vdemeester) should be a unit test |
| 1657 | 1657 |
func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *check.C) {
|
| 1658 | 1658 |
d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) |
| 1659 |
- c.Assert(d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil)
|
|
| 1659 |
+ assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil)
|
|
| 1660 | 1660 |
expected := "invalid fluentd-address corrupted:c: " |
| 1661 | 1661 |
icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
|
| 1662 | 1662 |
} |
| ... | ... |
@@ -1725,9 +1725,9 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *check.C) {
|
| 1725 | 1725 |
assert.NilError(c, err) |
| 1726 | 1726 |
conn.Close() |
| 1727 | 1727 |
|
| 1728 |
- c.Assert(certRequestInfo, checker.NotNil) |
|
| 1729 |
- c.Assert(certRequestInfo.AcceptableCAs, checker.HasLen, 1) |
|
| 1730 |
- c.Assert(certRequestInfo.AcceptableCAs[0], checker.DeepEquals, rootCert.RawSubject) |
|
| 1728 |
+ assert.Assert(c, certRequestInfo, checker.NotNil) |
|
| 1729 |
+ assert.Assert(c, certRequestInfo.AcceptableCAs, checker.HasLen, 1) |
|
| 1730 |
+ assert.Assert(c, certRequestInfo.AcceptableCAs[0], checker.DeepEquals, rootCert.RawSubject) |
|
| 1731 | 1731 |
} |
| 1732 | 1732 |
|
| 1733 | 1733 |
func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C) {
|
| ... | ... |
@@ -1749,9 +1749,9 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C) |
| 1749 | 1749 |
break |
| 1750 | 1750 |
} |
| 1751 | 1751 |
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
|
| 1752 |
- c.Assert(err, check.IsNil, check.Commentf("%s", ip))
|
|
| 1752 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("%s", ip))
|
|
| 1753 | 1753 |
|
| 1754 |
- c.Assert(ip, check.Not(check.Equals), bridgeIP) |
|
| 1754 |
+ assert.Assert(c, ip, check.Not(check.Equals), bridgeIP) |
|
| 1755 | 1755 |
cont++ |
| 1756 | 1756 |
} |
| 1757 | 1757 |
} |
| ... | ... |
@@ -1763,7 +1763,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
|
| 1763 | 1763 |
testDir, err := ioutil.TempDir("", "no-space-left-on-device-test")
|
| 1764 | 1764 |
assert.NilError(c, err) |
| 1765 | 1765 |
defer os.RemoveAll(testDir) |
| 1766 |
- c.Assert(mount.MakeRShared(testDir), checker.IsNil) |
|
| 1766 |
+ assert.Assert(c, mount.MakeRShared(testDir), checker.IsNil) |
|
| 1767 | 1767 |
defer mount.Unmount(testDir) |
| 1768 | 1768 |
|
| 1769 | 1769 |
// create a 3MiB image (with a 2MiB ext4 fs) and mount it as graph root |
| ... | ... |
@@ -1779,8 +1779,8 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
|
| 1779 | 1779 |
|
| 1780 | 1780 |
// pull a repository large enough to overfill the mounted filesystem |
| 1781 | 1781 |
pullOut, err := s.d.Cmd("pull", "debian:stretch")
|
| 1782 |
- c.Assert(err, checker.NotNil, check.Commentf("%s", pullOut))
|
|
| 1783 |
- c.Assert(pullOut, checker.Contains, "no space left on device") |
|
| 1782 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("%s", pullOut))
|
|
| 1783 |
+ assert.Assert(c, pullOut, checker.Contains, "no space left on device") |
|
| 1784 | 1784 |
} |
| 1785 | 1785 |
|
| 1786 | 1786 |
// Test daemon restart with container links + auto restart |
| ... | ... |
@@ -1854,7 +1854,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *check.C) {
|
| 1854 | 1854 |
out, err := s.d.Cmd("run", "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
| 1855 | 1855 |
assert.NilError(c, err) |
| 1856 | 1856 |
cgroupPaths := ParseCgroupPaths(string(out)) |
| 1857 |
- c.Assert(len(cgroupPaths), checker.Not(checker.Equals), 0, check.Commentf("unexpected output - %q", string(out)))
|
|
| 1857 |
+ assert.Assert(c, len(cgroupPaths), checker.Not(checker.Equals), 0, check.Commentf("unexpected output - %q", string(out)))
|
|
| 1858 | 1858 |
out, err = s.d.Cmd("inspect", "-f", "{{.Id}}", name)
|
| 1859 | 1859 |
assert.NilError(c, err) |
| 1860 | 1860 |
id := strings.TrimSpace(string(out)) |
| ... | ... |
@@ -1866,7 +1866,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *check.C) {
|
| 1866 | 1866 |
break |
| 1867 | 1867 |
} |
| 1868 | 1868 |
} |
| 1869 |
- c.Assert(found, checker.True, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
|
|
| 1869 |
+ assert.Assert(c, found, checker.True, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
|
|
| 1870 | 1870 |
} |
| 1871 | 1871 |
|
| 1872 | 1872 |
func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) {
|
| ... | ... |
@@ -1889,7 +1889,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) {
|
| 1889 | 1889 |
assert.NilError(c, err, out) |
| 1890 | 1890 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 1891 | 1891 |
assert.NilError(c, err, out) |
| 1892 |
- c.Assert(strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf("%s", out))
|
|
| 1892 |
+ assert.Assert(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf("%s", out))
|
|
| 1893 | 1893 |
} |
| 1894 | 1894 |
|
| 1895 | 1895 |
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
|
| ... | ... |
@@ -1999,14 +1999,14 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *check.C) {
|
| 1999 | 1999 |
id := strings.TrimSpace(out) |
| 2000 | 2000 |
|
| 2001 | 2001 |
// kill the daemon |
| 2002 |
- c.Assert(s.d.Kill(), check.IsNil) |
|
| 2002 |
+ assert.Assert(c, s.d.Kill(), check.IsNil) |
|
| 2003 | 2003 |
|
| 2004 | 2004 |
// Check if there are mounts with container id visible from the host. |
| 2005 | 2005 |
// If not, those mounts exist in container's own mount ns, and so |
| 2006 | 2006 |
// the following check for mounts being cleared is pointless. |
| 2007 | 2007 |
skipMountCheck := false |
| 2008 | 2008 |
mountOut, err := ioutil.ReadFile("/proc/self/mountinfo")
|
| 2009 |
- c.Assert(err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2009 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2010 | 2010 |
if !strings.Contains(string(mountOut), id) {
|
| 2011 | 2011 |
skipMountCheck = true |
| 2012 | 2012 |
} |
| ... | ... |
@@ -2031,9 +2031,9 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *check.C) {
|
| 2031 | 2031 |
} |
| 2032 | 2032 |
// Now, container mounts should be gone. |
| 2033 | 2033 |
mountOut, err = ioutil.ReadFile("/proc/self/mountinfo")
|
| 2034 |
- c.Assert(err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2034 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2035 | 2035 |
comment := check.Commentf("%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, s.d.Root, mountOut)
|
| 2036 |
- c.Assert(strings.Contains(string(mountOut), id), check.Equals, false, comment) |
|
| 2036 |
+ assert.Assert(c, strings.Contains(string(mountOut), id), check.Equals, false, comment) |
|
| 2037 | 2037 |
} |
| 2038 | 2038 |
|
| 2039 | 2039 |
// TestDaemonRestartWithUnpausedRunningContainer requires live restore of running containers. |
| ... | ... |
@@ -2103,7 +2103,7 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) {
|
| 2103 | 2103 |
|
| 2104 | 2104 |
out, err = s.d.Cmd("run", "--name=test2", "--link=test:abc", "busybox", "sh", "-c", "ping -c 1 abc")
|
| 2105 | 2105 |
assert.NilError(c, err, out) |
| 2106 |
- c.Assert(out, checker.Contains, "1 packets transmitted, 1 packets received") |
|
| 2106 |
+ assert.Assert(c, out, checker.Contains, "1 packets transmitted, 1 packets received") |
|
| 2107 | 2107 |
|
| 2108 | 2108 |
out, err = s.d.Cmd("rm", "-f", "test")
|
| 2109 | 2109 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -2112,12 +2112,12 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) {
|
| 2112 | 2112 |
assert.NilError(c, err, out) |
| 2113 | 2113 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 2114 | 2114 |
assert.ErrorContains(c, err, "", out) |
| 2115 |
- c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2115 |
+ assert.Assert(c, out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2116 | 2116 |
|
| 2117 | 2117 |
s.d.Restart(c) |
| 2118 | 2118 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 2119 | 2119 |
assert.ErrorContains(c, err, "", out) |
| 2120 |
- c.Assert(out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2120 |
+ assert.Assert(c, out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2121 | 2121 |
} |
| 2122 | 2122 |
|
| 2123 | 2123 |
func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) {
|
| ... | ... |
@@ -2145,7 +2145,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) {
|
| 2145 | 2145 |
s.d.Stop(c) |
| 2146 | 2146 |
// Wait for io.Copy() before checking output |
| 2147 | 2147 |
<-done |
| 2148 |
- c.Assert(b.String(), checker.Contains, infoLog) |
|
| 2148 |
+ assert.Assert(c, b.String(), checker.Contains, infoLog) |
|
| 2149 | 2149 |
|
| 2150 | 2150 |
b.Reset() |
| 2151 | 2151 |
|
| ... | ... |
@@ -2166,8 +2166,8 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) {
|
| 2166 | 2166 |
s.d.Stop(c) |
| 2167 | 2167 |
// Wait for io.Copy() before checking output |
| 2168 | 2168 |
<-done |
| 2169 |
- c.Assert(b.String(), check.Not(check.Equals), "") |
|
| 2170 |
- c.Assert(b.String(), check.Not(checker.Contains), infoLog) |
|
| 2169 |
+ assert.Assert(c, b.String(), check.Not(check.Equals), "") |
|
| 2170 |
+ assert.Assert(c, b.String(), check.Not(checker.Contains), infoLog) |
|
| 2171 | 2171 |
} |
| 2172 | 2172 |
|
| 2173 | 2173 |
func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) {
|
| ... | ... |
@@ -2187,7 +2187,7 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) {
|
| 2187 | 2187 |
|
| 2188 | 2188 |
s.d.StartWithLogFile(tty, "--debug") |
| 2189 | 2189 |
s.d.Stop(c) |
| 2190 |
- c.Assert(b.String(), checker.Contains, debugLog) |
|
| 2190 |
+ assert.Assert(c, b.String(), checker.Contains, debugLog) |
|
| 2191 | 2191 |
} |
| 2192 | 2192 |
|
| 2193 | 2193 |
func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) {
|
| ... | ... |
@@ -2196,7 +2196,7 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) {
|
| 2196 | 2196 |
// daemon config file |
| 2197 | 2197 |
daemonConfig := `{ "debug" : false }`
|
| 2198 | 2198 |
configFile, err := ioutil.TempFile("", "test-daemon-discovery-backend-config-reload-config")
|
| 2199 |
- c.Assert(err, checker.IsNil, check.Commentf("could not create temp file for config reload"))
|
|
| 2199 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("could not create temp file for config reload"))
|
|
| 2200 | 2200 |
configFilePath := configFile.Name() |
| 2201 | 2201 |
defer func() {
|
| 2202 | 2202 |
configFile.Close() |
| ... | ... |
@@ -2226,13 +2226,13 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) {
|
| 2226 | 2226 |
assert.NilError(c, err) |
| 2227 | 2227 |
|
| 2228 | 2228 |
err = s.d.ReloadConfig() |
| 2229 |
- c.Assert(err, checker.IsNil, check.Commentf("error reloading daemon config"))
|
|
| 2229 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error reloading daemon config"))
|
|
| 2230 | 2230 |
|
| 2231 | 2231 |
out, err := s.d.Cmd("info")
|
| 2232 | 2232 |
assert.NilError(c, err) |
| 2233 | 2233 |
|
| 2234 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: consul://consuladdr:consulport/some/path"))
|
|
| 2235 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: 192.168.56.100:0"))
|
|
| 2234 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: consul://consuladdr:consulport/some/path"))
|
|
| 2235 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: 192.168.56.100:0"))
|
|
| 2236 | 2236 |
} |
| 2237 | 2237 |
|
| 2238 | 2238 |
// Test for #21956 |
| ... | ... |
@@ -2245,7 +2245,7 @@ func (s *DockerDaemonSuite) TestDaemonLogOptions(c *check.C) {
|
| 2245 | 2245 |
|
| 2246 | 2246 |
out, err = s.d.Cmd("inspect", "--format='{{.HostConfig.LogConfig}}'", id)
|
| 2247 | 2247 |
assert.NilError(c, err, out) |
| 2248 |
- c.Assert(out, checker.Contains, "{json-file map[]}")
|
|
| 2248 |
+ assert.Assert(c, out, checker.Contains, "{json-file map[]}")
|
|
| 2249 | 2249 |
} |
| 2250 | 2250 |
|
| 2251 | 2251 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2256,8 +2256,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrency(c *check.C) {
|
| 2256 | 2256 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 8"` |
| 2257 | 2257 |
content, err := s.d.ReadLogFile() |
| 2258 | 2258 |
assert.NilError(c, err) |
| 2259 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2260 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2259 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2260 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2261 | 2261 |
} |
| 2262 | 2262 |
|
| 2263 | 2263 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2279,8 +2279,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *check.C) {
|
| 2279 | 2279 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 8"` |
| 2280 | 2280 |
content, err := s.d.ReadLogFile() |
| 2281 | 2281 |
assert.NilError(c, err) |
| 2282 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2283 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2282 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2283 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2284 | 2284 |
|
| 2285 | 2285 |
configFile, err = os.Create(configFilePath) |
| 2286 | 2286 |
assert.NilError(c, err) |
| ... | ... |
@@ -2288,7 +2288,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *check.C) {
|
| 2288 | 2288 |
fmt.Fprintf(configFile, "%s", daemonConfig) |
| 2289 | 2289 |
configFile.Close() |
| 2290 | 2290 |
|
| 2291 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2291 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2292 | 2292 |
// unix.Kill(s.d.cmd.Process.Pid, unix.SIGHUP) |
| 2293 | 2293 |
|
| 2294 | 2294 |
time.Sleep(3 * time.Second) |
| ... | ... |
@@ -2297,8 +2297,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *check.C) {
|
| 2297 | 2297 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 9"` |
| 2298 | 2298 |
content, err = s.d.ReadLogFile() |
| 2299 | 2299 |
assert.NilError(c, err) |
| 2300 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2301 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2300 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2301 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2302 | 2302 |
} |
| 2303 | 2303 |
|
| 2304 | 2304 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2320,8 +2320,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec |
| 2320 | 2320 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 3"` |
| 2321 | 2321 |
content, err := s.d.ReadLogFile() |
| 2322 | 2322 |
assert.NilError(c, err) |
| 2323 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2324 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2323 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2324 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2325 | 2325 |
|
| 2326 | 2326 |
configFile, err = os.Create(configFilePath) |
| 2327 | 2327 |
assert.NilError(c, err) |
| ... | ... |
@@ -2329,7 +2329,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec |
| 2329 | 2329 |
fmt.Fprintf(configFile, "%s", daemonConfig) |
| 2330 | 2330 |
configFile.Close() |
| 2331 | 2331 |
|
| 2332 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2332 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2333 | 2333 |
// unix.Kill(s.d.cmd.Process.Pid, unix.SIGHUP) |
| 2334 | 2334 |
|
| 2335 | 2335 |
time.Sleep(3 * time.Second) |
| ... | ... |
@@ -2338,8 +2338,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec |
| 2338 | 2338 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 3"` |
| 2339 | 2339 |
content, err = s.d.ReadLogFile() |
| 2340 | 2340 |
assert.NilError(c, err) |
| 2341 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2342 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2341 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2342 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2343 | 2343 |
|
| 2344 | 2344 |
configFile, err = os.Create(configFilePath) |
| 2345 | 2345 |
assert.NilError(c, err) |
| ... | ... |
@@ -2347,7 +2347,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec |
| 2347 | 2347 |
fmt.Fprintf(configFile, "%s", daemonConfig) |
| 2348 | 2348 |
configFile.Close() |
| 2349 | 2349 |
|
| 2350 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2350 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2351 | 2351 |
|
| 2352 | 2352 |
time.Sleep(3 * time.Second) |
| 2353 | 2353 |
|
| ... | ... |
@@ -2355,8 +2355,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec |
| 2355 | 2355 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 3"` |
| 2356 | 2356 |
content, err = s.d.ReadLogFile() |
| 2357 | 2357 |
assert.NilError(c, err) |
| 2358 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2359 |
- c.Assert(string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2358 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2359 |
+ assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2360 | 2360 |
} |
| 2361 | 2361 |
|
| 2362 | 2362 |
func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *check.C) {
|
| ... | ... |
@@ -2369,8 +2369,8 @@ func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *check.C) {
|
| 2369 | 2369 |
build.WithoutCache, |
| 2370 | 2370 |
) |
| 2371 | 2371 |
comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
| 2372 |
- c.Assert(result.Error, check.IsNil, comment) |
|
| 2373 |
- c.Assert(result.ExitCode, check.Equals, 0, comment) |
|
| 2372 |
+ assert.Assert(c, result.Error, check.IsNil, comment) |
|
| 2373 |
+ assert.Assert(c, result.ExitCode, check.Equals, 0, comment) |
|
| 2374 | 2374 |
} |
| 2375 | 2375 |
|
| 2376 | 2376 |
// Test case for #21976 |
| ... | ... |
@@ -2381,11 +2381,11 @@ func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *check.C) {
|
| 2381 | 2381 |
|
| 2382 | 2382 |
expectedOutput := "nameserver 1.2.3.4" |
| 2383 | 2383 |
out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "/etc/resolv.conf")
|
| 2384 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2384 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2385 | 2385 |
expectedOutput = "search example.com" |
| 2386 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2386 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2387 | 2387 |
expectedOutput = "options timeout:3" |
| 2388 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2388 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2389 | 2389 |
} |
| 2390 | 2390 |
|
| 2391 | 2391 |
func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| ... | ... |
@@ -2428,7 +2428,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| 2428 | 2428 |
// Run with "vm" |
| 2429 | 2429 |
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
| 2430 | 2430 |
assert.ErrorContains(c, err, "", out) |
| 2431 |
- c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2431 |
+ assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2432 | 2432 |
|
| 2433 | 2433 |
// Reset config to only have the default |
| 2434 | 2434 |
config = ` |
| ... | ... |
@@ -2438,7 +2438,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| 2438 | 2438 |
} |
| 2439 | 2439 |
` |
| 2440 | 2440 |
ioutil.WriteFile(configName, []byte(config), 0644) |
| 2441 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2441 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2442 | 2442 |
// Give daemon time to reload config |
| 2443 | 2443 |
<-time.After(1 * time.Second) |
| 2444 | 2444 |
|
| ... | ... |
@@ -2449,12 +2449,12 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| 2449 | 2449 |
// Run with "oci" |
| 2450 | 2450 |
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
| 2451 | 2451 |
assert.ErrorContains(c, err, "", out) |
| 2452 |
- c.Assert(out, checker.Contains, "Unknown runtime specified oci") |
|
| 2452 |
+ assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2453 | 2453 |
|
| 2454 | 2454 |
// Start previously created container with oci |
| 2455 | 2455 |
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
| 2456 | 2456 |
assert.ErrorContains(c, err, "", out) |
| 2457 |
- c.Assert(out, checker.Contains, "Unknown runtime specified oci") |
|
| 2457 |
+ assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2458 | 2458 |
|
| 2459 | 2459 |
// Check that we can't override the default runtime |
| 2460 | 2460 |
config = ` |
| ... | ... |
@@ -2467,13 +2467,13 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| 2467 | 2467 |
} |
| 2468 | 2468 |
` |
| 2469 | 2469 |
ioutil.WriteFile(configName, []byte(config), 0644) |
| 2470 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2470 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2471 | 2471 |
// Give daemon time to reload config |
| 2472 | 2472 |
<-time.After(1 * time.Second) |
| 2473 | 2473 |
|
| 2474 | 2474 |
content, err := s.d.ReadLogFile() |
| 2475 | 2475 |
assert.NilError(c, err) |
| 2476 |
- c.Assert(string(content), checker.Contains, `file configuration validation failed: runtime name 'runc' is reserved`) |
|
| 2476 |
+ assert.Assert(c, string(content), checker.Contains, `file configuration validation failed: runtime name 'runc' is reserved`) |
|
| 2477 | 2477 |
|
| 2478 | 2478 |
// Check that we can select a default runtime |
| 2479 | 2479 |
config = ` |
| ... | ... |
@@ -2493,13 +2493,13 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) {
|
| 2493 | 2493 |
} |
| 2494 | 2494 |
` |
| 2495 | 2495 |
ioutil.WriteFile(configName, []byte(config), 0644) |
| 2496 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2496 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2497 | 2497 |
// Give daemon time to reload config |
| 2498 | 2498 |
<-time.After(1 * time.Second) |
| 2499 | 2499 |
|
| 2500 | 2500 |
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
| 2501 | 2501 |
assert.ErrorContains(c, err, "", out) |
| 2502 |
- c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2502 |
+ assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2503 | 2503 |
|
| 2504 | 2504 |
// Run with default runtime explicitly |
| 2505 | 2505 |
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
| ... | ... |
@@ -2524,7 +2524,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
| 2524 | 2524 |
// Run with "vm" |
| 2525 | 2525 |
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
| 2526 | 2526 |
assert.ErrorContains(c, err, "", out) |
| 2527 |
- c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2527 |
+ assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2528 | 2528 |
|
| 2529 | 2529 |
// Start a daemon without any extra runtimes |
| 2530 | 2530 |
s.d.Stop(c) |
| ... | ... |
@@ -2537,20 +2537,20 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
| 2537 | 2537 |
// Run with "oci" |
| 2538 | 2538 |
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
| 2539 | 2539 |
assert.ErrorContains(c, err, "", out) |
| 2540 |
- c.Assert(out, checker.Contains, "Unknown runtime specified oci") |
|
| 2540 |
+ assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2541 | 2541 |
|
| 2542 | 2542 |
// Start previously created container with oci |
| 2543 | 2543 |
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
| 2544 | 2544 |
assert.ErrorContains(c, err, "", out) |
| 2545 |
- c.Assert(out, checker.Contains, "Unknown runtime specified oci") |
|
| 2545 |
+ assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2546 | 2546 |
|
| 2547 | 2547 |
// Check that we can't override the default runtime |
| 2548 | 2548 |
s.d.Stop(c) |
| 2549 |
- c.Assert(s.d.StartWithError("--add-runtime", "runc=my-runc"), checker.NotNil)
|
|
| 2549 |
+ assert.Assert(c, s.d.StartWithError("--add-runtime", "runc=my-runc"), checker.NotNil)
|
|
| 2550 | 2550 |
|
| 2551 | 2551 |
content, err := s.d.ReadLogFile() |
| 2552 | 2552 |
assert.NilError(c, err) |
| 2553 |
- c.Assert(string(content), checker.Contains, `runtime name 'runc' is reserved`) |
|
| 2553 |
+ assert.Assert(c, string(content), checker.Contains, `runtime name 'runc' is reserved`) |
|
| 2554 | 2554 |
|
| 2555 | 2555 |
// Check that we can select a default runtime |
| 2556 | 2556 |
s.d.Stop(c) |
| ... | ... |
@@ -2558,7 +2558,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
| 2558 | 2558 |
|
| 2559 | 2559 |
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
| 2560 | 2560 |
assert.ErrorContains(c, err, "", out) |
| 2561 |
- c.Assert(out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2561 |
+ assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2562 | 2562 |
|
| 2563 | 2563 |
// Run with default runtime explicitly |
| 2564 | 2564 |
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
| ... | ... |
@@ -2570,23 +2570,23 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) |
| 2570 | 2570 |
|
| 2571 | 2571 |
// top1 will exist after daemon restarts |
| 2572 | 2572 |
out, err := s.d.Cmd("run", "-d", "--name", "top1", "busybox:latest", "top")
|
| 2573 |
- c.Assert(err, checker.IsNil, check.Commentf("run top1: %v", out))
|
|
| 2573 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("run top1: %v", out))
|
|
| 2574 | 2574 |
// top2 will be removed after daemon restarts |
| 2575 | 2575 |
out, err = s.d.Cmd("run", "-d", "--rm", "--name", "top2", "busybox:latest", "top")
|
| 2576 |
- c.Assert(err, checker.IsNil, check.Commentf("run top2: %v", out))
|
|
| 2576 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("run top2: %v", out))
|
|
| 2577 | 2577 |
|
| 2578 | 2578 |
out, err = s.d.Cmd("ps")
|
| 2579 | 2579 |
assert.NilError(c, err) |
| 2580 |
- c.Assert(out, checker.Contains, "top1", check.Commentf("top1 should be running"))
|
|
| 2581 |
- c.Assert(out, checker.Contains, "top2", check.Commentf("top2 should be running"))
|
|
| 2580 |
+ assert.Assert(c, out, checker.Contains, "top1", check.Commentf("top1 should be running"))
|
|
| 2581 |
+ assert.Assert(c, out, checker.Contains, "top2", check.Commentf("top2 should be running"))
|
|
| 2582 | 2582 |
|
| 2583 | 2583 |
// now restart daemon gracefully |
| 2584 | 2584 |
s.d.Restart(c) |
| 2585 | 2585 |
|
| 2586 | 2586 |
out, err = s.d.Cmd("ps", "-a")
|
| 2587 | 2587 |
assert.NilError(c, err, "out: %v", out) |
| 2588 |
- c.Assert(out, checker.Contains, "top1", check.Commentf("top1 should exist after daemon restarts"))
|
|
| 2589 |
- c.Assert(out, checker.Not(checker.Contains), "top2", check.Commentf("top2 should be removed after daemon restarts"))
|
|
| 2588 |
+ assert.Assert(c, out, checker.Contains, "top1", check.Commentf("top1 should exist after daemon restarts"))
|
|
| 2589 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "top2", check.Commentf("top2 should be removed after daemon restarts"))
|
|
| 2590 | 2590 |
} |
| 2591 | 2591 |
|
| 2592 | 2592 |
func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| ... | ... |
@@ -2613,7 +2613,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| 2613 | 2613 |
errMsg1, err := s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
| 2614 | 2614 |
errMsg1 = strings.TrimSpace(errMsg1) |
| 2615 | 2615 |
assert.NilError(c, err) |
| 2616 |
- c.Assert(errMsg1, checker.Contains, "executable file not found") |
|
| 2616 |
+ assert.Assert(c, errMsg1, checker.Contains, "executable file not found") |
|
| 2617 | 2617 |
|
| 2618 | 2618 |
// now restart daemon |
| 2619 | 2619 |
s.d.Restart(c) |
| ... | ... |
@@ -2656,8 +2656,8 @@ func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
|
| 2656 | 2656 |
s.d.Restart(c, "--userland-proxy-path", "/does/not/exist") |
| 2657 | 2657 |
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
| 2658 | 2658 |
assert.ErrorContains(c, err, "", out) |
| 2659 |
- c.Assert(out, checker.Contains, "driver failed programming external connectivity on endpoint") |
|
| 2660 |
- c.Assert(out, checker.Contains, "/does/not/exist: no such file or directory") |
|
| 2659 |
+ assert.Assert(c, out, checker.Contains, "driver failed programming external connectivity on endpoint") |
|
| 2660 |
+ assert.Assert(c, out, checker.Contains, "/does/not/exist: no such file or directory") |
|
| 2661 | 2661 |
} |
| 2662 | 2662 |
|
| 2663 | 2663 |
// Test case for #22471 |
| ... | ... |
@@ -2668,7 +2668,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *check.C) {
|
| 2668 | 2668 |
_, err := s.d.Cmd("run", "-d", "busybox", "top")
|
| 2669 | 2669 |
assert.NilError(c, err) |
| 2670 | 2670 |
|
| 2671 |
- c.Assert(s.d.Signal(unix.SIGINT), checker.IsNil) |
|
| 2671 |
+ assert.Assert(c, s.d.Signal(unix.SIGINT), checker.IsNil) |
|
| 2672 | 2672 |
|
| 2673 | 2673 |
select {
|
| 2674 | 2674 |
case <-s.d.Wait: |
| ... | ... |
@@ -2678,7 +2678,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *check.C) {
|
| 2678 | 2678 |
expectedMessage := `level=debug msg="daemon configured with a 3 seconds minimum shutdown timeout"` |
| 2679 | 2679 |
content, err := s.d.ReadLogFile() |
| 2680 | 2680 |
assert.NilError(c, err) |
| 2681 |
- c.Assert(string(content), checker.Contains, expectedMessage) |
|
| 2681 |
+ assert.Assert(c, string(content), checker.Contains, expectedMessage) |
|
| 2682 | 2682 |
} |
| 2683 | 2683 |
|
| 2684 | 2684 |
// Test case for #22471 |
| ... | ... |
@@ -2702,7 +2702,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *check.C) |
| 2702 | 2702 |
fmt.Fprintf(configFile, "%s", daemonConfig) |
| 2703 | 2703 |
configFile.Close() |
| 2704 | 2704 |
|
| 2705 |
- c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2705 |
+ assert.Assert(c, s.d.Signal(unix.SIGHUP), checker.IsNil) |
|
| 2706 | 2706 |
|
| 2707 | 2707 |
select {
|
| 2708 | 2708 |
case <-s.d.Wait: |
| ... | ... |
@@ -2712,7 +2712,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *check.C) |
| 2712 | 2712 |
expectedMessage := `level=debug msg="Reset Shutdown Timeout: 5"` |
| 2713 | 2713 |
content, err := s.d.ReadLogFile() |
| 2714 | 2714 |
assert.NilError(c, err) |
| 2715 |
- c.Assert(string(content), checker.Contains, expectedMessage) |
|
| 2715 |
+ assert.Assert(c, string(content), checker.Contains, expectedMessage) |
|
| 2716 | 2716 |
} |
| 2717 | 2717 |
|
| 2718 | 2718 |
// Test case for 29342 |
| ... | ... |
@@ -2727,18 +2727,18 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) {
|
| 2727 | 2727 |
|
| 2728 | 2728 |
// Wait for shell command to be completed |
| 2729 | 2729 |
_, err = s.d.Cmd("exec", "top", "sh", "-c", `for i in $(seq 1 5); do if [ -e /adduser_end ]; then rm -f /adduser_end && break; else sleep 1 && false; fi; done`)
|
| 2730 |
- c.Assert(err, check.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
|
|
| 2730 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
|
|
| 2731 | 2731 |
|
| 2732 | 2732 |
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2733 | 2733 |
// uid=100(test) gid=101(test) groups=101(test) |
| 2734 |
- c.Assert(err, check.IsNil, check.Commentf("Output: %s", out1))
|
|
| 2734 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", out1))
|
|
| 2735 | 2735 |
|
| 2736 | 2736 |
// restart daemon. |
| 2737 | 2737 |
s.d.Restart(c, "--live-restore") |
| 2738 | 2738 |
|
| 2739 | 2739 |
out2, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2740 |
- c.Assert(err, check.IsNil, check.Commentf("Output: %s", out2))
|
|
| 2741 |
- c.Assert(out2, check.Equals, out1, check.Commentf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2740 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", out2))
|
|
| 2741 |
+ assert.Assert(c, out2, check.Equals, out1, check.Commentf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2742 | 2742 |
|
| 2743 | 2743 |
out, err = s.d.Cmd("stop", "top")
|
| 2744 | 2744 |
assert.NilError(c, err, "Output: %s", out) |
| ... | ... |
@@ -2790,7 +2790,7 @@ func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *check.C) {
|
| 2790 | 2790 |
StartedAt time.Time |
| 2791 | 2791 |
} |
| 2792 | 2792 |
out, err = s.d.Cmd("inspect", "-f", "{{json .State}}", id)
|
| 2793 |
- c.Assert(err, checker.IsNil, check.Commentf("output: %s", out))
|
|
| 2793 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("output: %s", out))
|
|
| 2794 | 2794 |
|
| 2795 | 2795 |
var origState state |
| 2796 | 2796 |
err = json.Unmarshal([]byte(strings.TrimSpace(out)), &origState) |
| ... | ... |
@@ -2816,7 +2816,7 @@ func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *check.C) {
|
| 2816 | 2816 |
} |
| 2817 | 2817 |
|
| 2818 | 2818 |
out, err := s.d.Cmd("inspect", "-f", "{{json .State}}", id)
|
| 2819 |
- c.Assert(err, checker.IsNil, check.Commentf("output: %s", out))
|
|
| 2819 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("output: %s", out))
|
|
| 2820 | 2820 |
|
| 2821 | 2821 |
var newState state |
| 2822 | 2822 |
err = json.Unmarshal([]byte(strings.TrimSpace(out)), &newState) |
| ... | ... |
@@ -2845,23 +2845,23 @@ func (s *DockerDaemonSuite) TestShmSize(c *check.C) {
|
| 2845 | 2845 |
name := "shm1" |
| 2846 | 2846 |
out, err := s.d.Cmd("run", "--name", name, "busybox", "mount")
|
| 2847 | 2847 |
assert.NilError(c, err, "Output: %s", out) |
| 2848 |
- c.Assert(pattern.MatchString(out), checker.True) |
|
| 2848 |
+ assert.Assert(c, pattern.MatchString(out), checker.True) |
|
| 2849 | 2849 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2850 | 2850 |
assert.NilError(c, err, "Output: %s", out) |
| 2851 |
- c.Assert(strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2851 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2852 | 2852 |
} |
| 2853 | 2853 |
|
| 2854 | 2854 |
func (s *DockerDaemonSuite) TestShmSizeReload(c *check.C) {
|
| 2855 | 2855 |
testRequires(c, DaemonIsLinux) |
| 2856 | 2856 |
|
| 2857 | 2857 |
configPath, err := ioutil.TempDir("", "test-daemon-shm-size-reload-config")
|
| 2858 |
- c.Assert(err, checker.IsNil, check.Commentf("could not create temp file for config reload"))
|
|
| 2858 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("could not create temp file for config reload"))
|
|
| 2859 | 2859 |
defer os.RemoveAll(configPath) // clean up |
| 2860 | 2860 |
configFile := filepath.Join(configPath, "config.json") |
| 2861 | 2861 |
|
| 2862 | 2862 |
size := 67108864 * 2 |
| 2863 | 2863 |
configData := []byte(fmt.Sprintf(`{"default-shm-size": "%dM"}`, size/1024/1024))
|
| 2864 |
- c.Assert(ioutil.WriteFile(configFile, configData, 0666), checker.IsNil, check.Commentf("could not write temp file for config reload"))
|
|
| 2864 |
+ assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666), checker.IsNil, check.Commentf("could not write temp file for config reload"))
|
|
| 2865 | 2865 |
pattern := regexp.MustCompile(fmt.Sprintf("shm on /dev/shm type tmpfs(.*)size=%dk", size/1024))
|
| 2866 | 2866 |
|
| 2867 | 2867 |
s.d.StartWithBusybox(c, "--config-file", configFile) |
| ... | ... |
@@ -2869,26 +2869,26 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *check.C) {
|
| 2869 | 2869 |
name := "shm1" |
| 2870 | 2870 |
out, err := s.d.Cmd("run", "--name", name, "busybox", "mount")
|
| 2871 | 2871 |
assert.NilError(c, err, "Output: %s", out) |
| 2872 |
- c.Assert(pattern.MatchString(out), checker.True) |
|
| 2872 |
+ assert.Assert(c, pattern.MatchString(out), checker.True) |
|
| 2873 | 2873 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2874 | 2874 |
assert.NilError(c, err, "Output: %s", out) |
| 2875 |
- c.Assert(strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2875 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2876 | 2876 |
|
| 2877 | 2877 |
size = 67108864 * 3 |
| 2878 | 2878 |
configData = []byte(fmt.Sprintf(`{"default-shm-size": "%dM"}`, size/1024/1024))
|
| 2879 |
- c.Assert(ioutil.WriteFile(configFile, configData, 0666), checker.IsNil, check.Commentf("could not write temp file for config reload"))
|
|
| 2879 |
+ assert.Assert(c, ioutil.WriteFile(configFile, configData, 0666), checker.IsNil, check.Commentf("could not write temp file for config reload"))
|
|
| 2880 | 2880 |
pattern = regexp.MustCompile(fmt.Sprintf("shm on /dev/shm type tmpfs(.*)size=%dk", size/1024))
|
| 2881 | 2881 |
|
| 2882 | 2882 |
err = s.d.ReloadConfig() |
| 2883 |
- c.Assert(err, checker.IsNil, check.Commentf("error reloading daemon config"))
|
|
| 2883 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error reloading daemon config"))
|
|
| 2884 | 2884 |
|
| 2885 | 2885 |
name = "shm2" |
| 2886 | 2886 |
out, err = s.d.Cmd("run", "--name", name, "busybox", "mount")
|
| 2887 | 2887 |
assert.NilError(c, err, "Output: %s", out) |
| 2888 |
- c.Assert(pattern.MatchString(out), checker.True) |
|
| 2888 |
+ assert.Assert(c, pattern.MatchString(out), checker.True) |
|
| 2889 | 2889 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2890 | 2890 |
assert.NilError(c, err, "Output: %s", out) |
| 2891 |
- c.Assert(strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2891 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2892 | 2892 |
} |
| 2893 | 2893 |
|
| 2894 | 2894 |
func testDaemonStartIpcMode(c *check.C, from, mode string, valid bool) {
|
| ... | ... |
@@ -287,8 +287,8 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C |
| 287 | 287 |
dockerCmd(c, "volume", "create", "test") |
| 288 | 288 |
|
| 289 | 289 |
out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
|
| 290 |
- c.Assert(err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
|
| 291 |
- c.Assert(out, checker.Contains, "must be unique") |
|
| 290 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
|
| 291 |
+ assert.Assert(c, out, checker.Contains, "must be unique") |
|
| 292 | 292 |
|
| 293 | 293 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
|
| 294 | 294 |
_, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out))
|
| ... | ... |
@@ -300,7 +300,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) {
|
| 300 | 300 |
|
| 301 | 301 |
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
| 302 | 302 |
assert.NilError(c, err, out) |
| 303 |
- c.Assert(out, checker.Contains, s.Server.URL) |
|
| 303 |
+ assert.Assert(c, out, checker.Contains, s.Server.URL) |
|
| 304 | 304 |
|
| 305 | 305 |
_, err = s.d.Cmd("volume", "rm", "external-volume-test")
|
| 306 | 306 |
assert.NilError(c, err) |
| ... | ... |
@@ -308,13 +308,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) {
|
| 308 | 308 |
p := hostVolumePath("external-volume-test")
|
| 309 | 309 |
_, err = os.Lstat(p) |
| 310 | 310 |
assert.ErrorContains(c, err, "") |
| 311 |
- c.Assert(os.IsNotExist(err), checker.True, check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
|
|
| 311 |
+ assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
|
|
| 312 | 312 |
|
| 313 |
- c.Assert(s.ec.activations, checker.Equals, 1) |
|
| 314 |
- c.Assert(s.ec.creations, checker.Equals, 1) |
|
| 315 |
- c.Assert(s.ec.removals, checker.Equals, 1) |
|
| 316 |
- c.Assert(s.ec.mounts, checker.Equals, 1) |
|
| 317 |
- c.Assert(s.ec.unmounts, checker.Equals, 1) |
|
| 313 |
+ assert.Assert(c, s.ec.activations, checker.Equals, 1) |
|
| 314 |
+ assert.Assert(c, s.ec.creations, checker.Equals, 1) |
|
| 315 |
+ assert.Assert(c, s.ec.removals, checker.Equals, 1) |
|
| 316 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 1) |
|
| 317 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 1) |
|
| 318 | 318 |
} |
| 319 | 319 |
|
| 320 | 320 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C) {
|
| ... | ... |
@@ -322,13 +322,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C) |
| 322 | 322 |
|
| 323 | 323 |
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
| 324 | 324 |
assert.NilError(c, err, out) |
| 325 |
- c.Assert(out, checker.Contains, s.Server.URL) |
|
| 325 |
+ assert.Assert(c, out, checker.Contains, s.Server.URL) |
|
| 326 | 326 |
|
| 327 |
- c.Assert(s.ec.activations, checker.Equals, 1) |
|
| 328 |
- c.Assert(s.ec.creations, checker.Equals, 1) |
|
| 329 |
- c.Assert(s.ec.removals, checker.Equals, 1) |
|
| 330 |
- c.Assert(s.ec.mounts, checker.Equals, 1) |
|
| 331 |
- c.Assert(s.ec.unmounts, checker.Equals, 1) |
|
| 327 |
+ assert.Assert(c, s.ec.activations, checker.Equals, 1) |
|
| 328 |
+ assert.Assert(c, s.ec.creations, checker.Equals, 1) |
|
| 329 |
+ assert.Assert(c, s.ec.removals, checker.Equals, 1) |
|
| 330 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 1) |
|
| 331 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 1) |
|
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 | 334 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check.C) {
|
| ... | ... |
@@ -343,11 +343,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check |
| 343 | 343 |
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
| 344 | 344 |
assert.NilError(c, err, out) |
| 345 | 345 |
|
| 346 |
- c.Assert(s.ec.activations, checker.Equals, 1) |
|
| 347 |
- c.Assert(s.ec.creations, checker.Equals, 1) |
|
| 348 |
- c.Assert(s.ec.removals, checker.Equals, 1) |
|
| 349 |
- c.Assert(s.ec.mounts, checker.Equals, 2) |
|
| 350 |
- c.Assert(s.ec.unmounts, checker.Equals, 2) |
|
| 346 |
+ assert.Assert(c, s.ec.activations, checker.Equals, 1) |
|
| 347 |
+ assert.Assert(c, s.ec.creations, checker.Equals, 1) |
|
| 348 |
+ assert.Assert(c, s.ec.removals, checker.Equals, 1) |
|
| 349 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 2) |
|
| 350 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 2) |
|
| 351 | 351 |
} |
| 352 | 352 |
|
| 353 | 353 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *check.C) {
|
| ... | ... |
@@ -359,11 +359,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *c |
| 359 | 359 |
out, err = s.d.Cmd("rm", "-fv", "vol-test1")
|
| 360 | 360 |
assert.NilError(c, err, out) |
| 361 | 361 |
|
| 362 |
- c.Assert(s.ec.activations, checker.Equals, 1) |
|
| 363 |
- c.Assert(s.ec.creations, checker.Equals, 1) |
|
| 364 |
- c.Assert(s.ec.removals, checker.Equals, 1) |
|
| 365 |
- c.Assert(s.ec.mounts, checker.Equals, 1) |
|
| 366 |
- c.Assert(s.ec.unmounts, checker.Equals, 1) |
|
| 362 |
+ assert.Assert(c, s.ec.activations, checker.Equals, 1) |
|
| 363 |
+ assert.Assert(c, s.ec.creations, checker.Equals, 1) |
|
| 364 |
+ assert.Assert(c, s.ec.removals, checker.Equals, 1) |
|
| 365 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 1) |
|
| 366 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 1) |
|
| 367 | 367 |
} |
| 368 | 368 |
|
| 369 | 369 |
func hostVolumePath(name string) string {
|
| ... | ... |
@@ -382,10 +382,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c * |
| 382 | 382 |
cmd1 := exec.Command(dockerBinary, "volume", "create", "-d", "down-driver") |
| 383 | 383 |
cmd2 := exec.Command(dockerBinary, "volume", "create") |
| 384 | 384 |
|
| 385 |
- c.Assert(cmd1.Start(), checker.IsNil) |
|
| 385 |
+ assert.Assert(c, cmd1.Start(), checker.IsNil) |
|
| 386 | 386 |
defer cmd1.Process.Kill() |
| 387 | 387 |
time.Sleep(100 * time.Millisecond) // ensure API has been called |
| 388 |
- c.Assert(cmd2.Start(), checker.IsNil) |
|
| 388 |
+ assert.Assert(c, cmd2.Start(), checker.IsNil) |
|
| 389 | 389 |
|
| 390 | 390 |
go func() {
|
| 391 | 391 |
cmd1.Wait() |
| ... | ... |
@@ -437,11 +437,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyE |
| 437 | 437 |
_, err := s.d.Cmd("volume", "rm", "external-volume-test")
|
| 438 | 438 |
assert.NilError(c, err) |
| 439 | 439 |
|
| 440 |
- c.Assert(p.ec.activations, checker.Equals, 1) |
|
| 441 |
- c.Assert(p.ec.creations, checker.Equals, 1) |
|
| 442 |
- c.Assert(p.ec.removals, checker.Equals, 1) |
|
| 443 |
- c.Assert(p.ec.mounts, checker.Equals, 1) |
|
| 444 |
- c.Assert(p.ec.unmounts, checker.Equals, 1) |
|
| 440 |
+ assert.Assert(c, p.ec.activations, checker.Equals, 1) |
|
| 441 |
+ assert.Assert(c, p.ec.creations, checker.Equals, 1) |
|
| 442 |
+ assert.Assert(c, p.ec.removals, checker.Equals, 1) |
|
| 443 |
+ assert.Assert(c, p.ec.mounts, checker.Equals, 1) |
|
| 444 |
+ assert.Assert(c, p.ec.unmounts, checker.Equals, 1) |
|
| 445 | 445 |
} |
| 446 | 446 |
|
| 447 | 447 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c *check.C) {
|
| ... | ... |
@@ -453,31 +453,31 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c |
| 453 | 453 |
Driver string |
| 454 | 454 |
} |
| 455 | 455 |
out := inspectFieldJSON(c, "testing", "Mounts") |
| 456 |
- c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil) |
|
| 457 |
- c.Assert(len(mounts), checker.Equals, 1, check.Commentf("%s", out))
|
|
| 458 |
- c.Assert(mounts[0].Name, checker.Equals, "foo") |
|
| 459 |
- c.Assert(mounts[0].Driver, checker.Equals, volumePluginName) |
|
| 456 |
+ assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil) |
|
| 457 |
+ assert.Assert(c, len(mounts), checker.Equals, 1, check.Commentf("%s", out))
|
|
| 458 |
+ assert.Assert(c, mounts[0].Name, checker.Equals, "foo") |
|
| 459 |
+ assert.Assert(c, mounts[0].Driver, checker.Equals, volumePluginName) |
|
| 460 | 460 |
} |
| 461 | 461 |
|
| 462 | 462 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) {
|
| 463 | 463 |
dockerCmd(c, "volume", "create", "-d", volumePluginName, "abc3") |
| 464 | 464 |
out, _ := dockerCmd(c, "volume", "ls") |
| 465 | 465 |
ls := strings.Split(strings.TrimSpace(out), "\n") |
| 466 |
- c.Assert(len(ls), check.Equals, 2, check.Commentf("\n%s", out))
|
|
| 466 |
+ assert.Assert(c, len(ls), check.Equals, 2, check.Commentf("\n%s", out))
|
|
| 467 | 467 |
|
| 468 | 468 |
vol := strings.Fields(ls[len(ls)-1]) |
| 469 |
- c.Assert(len(vol), check.Equals, 2, check.Commentf("%v", vol))
|
|
| 470 |
- c.Assert(vol[0], check.Equals, volumePluginName) |
|
| 471 |
- c.Assert(vol[1], check.Equals, "abc3") |
|
| 469 |
+ assert.Assert(c, len(vol), check.Equals, 2, check.Commentf("%v", vol))
|
|
| 470 |
+ assert.Assert(c, vol[0], check.Equals, volumePluginName) |
|
| 471 |
+ assert.Assert(c, vol[1], check.Equals, "abc3") |
|
| 472 | 472 |
|
| 473 |
- c.Assert(s.ec.lists, check.Equals, 1) |
|
| 473 |
+ assert.Assert(c, s.ec.lists, check.Equals, 1) |
|
| 474 | 474 |
} |
| 475 | 475 |
|
| 476 | 476 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
|
| 477 | 477 |
out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
|
| 478 | 478 |
assert.ErrorContains(c, err, "", out) |
| 479 |
- c.Assert(out, checker.Contains, "No such volume") |
|
| 480 |
- c.Assert(s.ec.gets, check.Equals, 1) |
|
| 479 |
+ assert.Assert(c, out, checker.Contains, "No such volume") |
|
| 480 |
+ assert.Assert(c, s.ec.gets, check.Equals, 1) |
|
| 481 | 481 |
|
| 482 | 482 |
dockerCmd(c, "volume", "create", "test", "-d", volumePluginName) |
| 483 | 483 |
out, _ = dockerCmd(c, "volume", "inspect", "test") |
| ... | ... |
@@ -487,10 +487,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
|
| 487 | 487 |
} |
| 488 | 488 |
var st []vol |
| 489 | 489 |
|
| 490 |
- c.Assert(json.Unmarshal([]byte(out), &st), checker.IsNil) |
|
| 491 |
- c.Assert(st, checker.HasLen, 1) |
|
| 492 |
- c.Assert(st[0].Status, checker.HasLen, 1, check.Commentf("%v", st[0]))
|
|
| 493 |
- c.Assert(st[0].Status["Hello"], checker.Equals, "world", check.Commentf("%v", st[0].Status))
|
|
| 490 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &st), checker.IsNil) |
|
| 491 |
+ assert.Assert(c, st, checker.HasLen, 1) |
|
| 492 |
+ assert.Assert(c, st[0].Status, checker.HasLen, 1, check.Commentf("%v", st[0]))
|
|
| 493 |
+ assert.Assert(c, st[0].Status["Hello"], checker.Equals, "world", check.Commentf("%v", st[0].Status))
|
|
| 494 | 494 |
} |
| 495 | 495 |
|
| 496 | 496 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c *check.C) {
|
| ... | ... |
@@ -500,8 +500,8 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c |
| 500 | 500 |
dockerCmd(c, "run", "--name=test", "-v", "abc1:/foo", "busybox", "true") |
| 501 | 501 |
var mounts []types.MountPoint |
| 502 | 502 |
inspectFieldAndUnmarshall(c, "test", "Mounts", &mounts) |
| 503 |
- c.Assert(mounts, checker.HasLen, 1) |
|
| 504 |
- c.Assert(mounts[0].Driver, checker.Equals, volumePluginName) |
|
| 503 |
+ assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 504 |
+ assert.Assert(c, mounts[0].Driver, checker.Equals, volumePluginName) |
|
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 | 507 |
// Ensures that the daemon handles when the plugin responds to a `Get` request with a null volume and a null error. |
| ... | ... |
@@ -514,7 +514,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c * |
| 514 | 514 |
|
| 515 | 515 |
out, err = s.d.Cmd("volume", "inspect", "abc2")
|
| 516 | 516 |
assert.ErrorContains(c, err, "", out) |
| 517 |
- c.Assert(out, checker.Contains, "No such volume") |
|
| 517 |
+ assert.Assert(c, out, checker.Contains, "No such volume") |
|
| 518 | 518 |
} |
| 519 | 519 |
|
| 520 | 520 |
// Ensure only cached paths are used in volume list to prevent N+1 calls to `VolumeDriver.Path` |
| ... | ... |
@@ -523,15 +523,15 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c * |
| 523 | 523 |
// available because the volume is not even mounted. Consider removing this test. |
| 524 | 524 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C) {
|
| 525 | 525 |
s.d.Start(c) |
| 526 |
- c.Assert(s.ec.paths, checker.Equals, 0) |
|
| 526 |
+ assert.Assert(c, s.ec.paths, checker.Equals, 0) |
|
| 527 | 527 |
|
| 528 | 528 |
out, err := s.d.Cmd("volume", "create", "test", "--driver=test-external-volume-driver")
|
| 529 | 529 |
assert.NilError(c, err, out) |
| 530 |
- c.Assert(s.ec.paths, checker.Equals, 0) |
|
| 530 |
+ assert.Assert(c, s.ec.paths, checker.Equals, 0) |
|
| 531 | 531 |
|
| 532 | 532 |
out, err = s.d.Cmd("volume", "ls")
|
| 533 | 533 |
assert.NilError(c, err, out) |
| 534 |
- c.Assert(s.ec.paths, checker.Equals, 0) |
|
| 534 |
+ assert.Assert(c, s.ec.paths, checker.Equals, 0) |
|
| 535 | 535 |
} |
| 536 | 536 |
|
| 537 | 537 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C) {
|
| ... | ... |
@@ -545,12 +545,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C) |
| 545 | 545 |
// Check that VolumeDriver.Capabilities gets called, and only called once |
| 546 | 546 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *check.C) {
|
| 547 | 547 |
s.d.Start(c) |
| 548 |
- c.Assert(s.ec.caps, checker.Equals, 0) |
|
| 548 |
+ assert.Assert(c, s.ec.caps, checker.Equals, 0) |
|
| 549 | 549 |
|
| 550 | 550 |
for i := 0; i < 3; i++ {
|
| 551 | 551 |
out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, fmt.Sprintf("test%d", i))
|
| 552 | 552 |
assert.NilError(c, err, out) |
| 553 |
- c.Assert(s.ec.caps, checker.Equals, 1) |
|
| 553 |
+ assert.Assert(c, s.ec.caps, checker.Equals, 1) |
|
| 554 | 554 |
out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i))
|
| 555 | 555 |
assert.NilError(c, err) |
| 556 | 556 |
assert.Equal(c, strings.TrimSpace(out), volume.GlobalScope) |
| ... | ... |
@@ -569,7 +569,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c |
| 569 | 569 |
|
| 570 | 570 |
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
| 571 | 571 |
assert.ErrorContains(c, err, "", out) |
| 572 |
- c.Assert(out, checker.Contains, "must be unique") |
|
| 572 |
+ assert.Assert(c, out, checker.Contains, "must be unique") |
|
| 573 | 573 |
|
| 574 | 574 |
// simulate out of band volume deletion on plugin level |
| 575 | 575 |
delete(p.vols, "test") |
| ... | ... |
@@ -583,11 +583,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c |
| 583 | 583 |
var vs []types.Volume |
| 584 | 584 |
err = json.Unmarshal([]byte(out), &vs) |
| 585 | 585 |
assert.NilError(c, err) |
| 586 |
- c.Assert(vs, checker.HasLen, 1) |
|
| 587 |
- c.Assert(vs[0].Driver, checker.Equals, driverName) |
|
| 588 |
- c.Assert(vs[0].Options, checker.NotNil) |
|
| 589 |
- c.Assert(vs[0].Options["foo"], checker.Equals, "bar") |
|
| 590 |
- c.Assert(vs[0].Driver, checker.Equals, driverName) |
|
| 586 |
+ assert.Assert(c, vs, checker.HasLen, 1) |
|
| 587 |
+ assert.Assert(c, vs[0].Driver, checker.Equals, driverName) |
|
| 588 |
+ assert.Assert(c, vs[0].Options, checker.NotNil) |
|
| 589 |
+ assert.Assert(c, vs[0].Options["foo"], checker.Equals, "bar") |
|
| 590 |
+ assert.Assert(c, vs[0].Driver, checker.Equals, driverName) |
|
| 591 | 591 |
|
| 592 | 592 |
// simulate out of band volume deletion on plugin level |
| 593 | 593 |
delete(p.vols, "test") |
| ... | ... |
@@ -601,9 +601,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c |
| 601 | 601 |
vs = nil |
| 602 | 602 |
err = json.Unmarshal([]byte(out), &vs) |
| 603 | 603 |
assert.NilError(c, err) |
| 604 |
- c.Assert(vs, checker.HasLen, 1) |
|
| 605 |
- c.Assert(vs[0].Options, checker.HasLen, 0) |
|
| 606 |
- c.Assert(vs[0].Driver, checker.Equals, "local") |
|
| 604 |
+ assert.Assert(c, vs, checker.HasLen, 1) |
|
| 605 |
+ assert.Assert(c, vs[0].Options, checker.HasLen, 0) |
|
| 606 |
+ assert.Assert(c, vs[0].Driver, checker.Equals, "local") |
|
| 607 | 607 |
} |
| 608 | 608 |
|
| 609 | 609 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c *check.C) {
|
| ... | ... |
@@ -611,9 +611,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c |
| 611 | 611 |
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
|
| 612 | 612 |
|
| 613 | 613 |
out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
|
| 614 |
- c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
|
| 614 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
|
| 615 | 615 |
out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
|
| 616 |
- c.Assert(s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
|
| 616 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out))
|
|
| 617 | 617 |
} |
| 618 | 618 |
|
| 619 | 619 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check.C) {
|
| ... | ... |
@@ -621,12 +621,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check |
| 621 | 621 |
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
|
| 622 | 622 |
|
| 623 | 623 |
out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
|
| 624 |
- c.Assert(s.ec.mounts, checker.Equals, 1, check.Commentf("%s", out))
|
|
| 624 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 1, check.Commentf("%s", out))
|
|
| 625 | 625 |
|
| 626 | 626 |
out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
|
| 627 |
- c.Assert(s.ec.mounts, checker.Equals, 2, check.Commentf("%s", out))
|
|
| 628 |
- c.Assert(s.ec.unmounts, checker.Equals, 1, check.Commentf("%s", out))
|
|
| 627 |
+ assert.Assert(c, s.ec.mounts, checker.Equals, 2, check.Commentf("%s", out))
|
|
| 628 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 1, check.Commentf("%s", out))
|
|
| 629 | 629 |
|
| 630 | 630 |
out, _ = s.d.Cmd("kill", "test")
|
| 631 |
- c.Assert(s.ec.unmounts, checker.Equals, 2, check.Commentf("%s", out))
|
|
| 631 |
+ assert.Assert(c, s.ec.unmounts, checker.Equals, 2, check.Commentf("%s", out))
|
|
| 632 | 632 |
} |
| ... | ... |
@@ -20,7 +20,7 @@ func waitForHealthStatus(c *check.C, name string, prev string, expected string) |
| 20 | 20 |
if out == expected {
|
| 21 | 21 |
return |
| 22 | 22 |
} |
| 23 |
- c.Assert(out, checker.Equals, prev) |
|
| 23 |
+ assert.Assert(c, out, checker.Equals, prev) |
|
| 24 | 24 |
if out != prev {
|
| 25 | 25 |
return |
| 26 | 26 |
} |
| ... | ... |
@@ -32,7 +32,7 @@ func getHealth(c *check.C, name string) *types.Health {
|
| 32 | 32 |
out, _ := dockerCmd(c, "inspect", "--format={{json .State.Health}}", name)
|
| 33 | 33 |
var health types.Health |
| 34 | 34 |
err := json.Unmarshal([]byte(out), &health) |
| 35 |
- c.Assert(err, checker.Equals, nil) |
|
| 35 |
+ assert.Assert(c, err, checker.Equals, nil) |
|
| 36 | 36 |
return &health |
| 37 | 37 |
} |
| 38 | 38 |
|
| ... | ... |
@@ -54,12 +54,12 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 54 | 54 |
cid, _ := dockerCmd(c, "create", "--name", name, imageName) |
| 55 | 55 |
out, _ := dockerCmd(c, "ps", "-a", "--format={{.ID}} {{.Status}}")
|
| 56 | 56 |
out = RemoveOutputForExistingElements(out, existingContainers) |
| 57 |
- c.Assert(out, checker.Equals, cid[:12]+" Created\n") |
|
| 57 |
+ assert.Assert(c, out, checker.Equals, cid[:12]+" Created\n") |
|
| 58 | 58 |
|
| 59 | 59 |
// Inspect the options |
| 60 | 60 |
out, _ = dockerCmd(c, "inspect", |
| 61 | 61 |
"--format=timeout={{.Config.Healthcheck.Timeout}} interval={{.Config.Healthcheck.Interval}} retries={{.Config.Healthcheck.Retries}} test={{.Config.Healthcheck.Test}}", name)
|
| 62 |
- c.Assert(out, checker.Equals, "timeout=30s interval=1s retries=0 test=[CMD-SHELL cat /status]\n") |
|
| 62 |
+ assert.Assert(c, out, checker.Equals, "timeout=30s interval=1s retries=0 test=[CMD-SHELL cat /status]\n") |
|
| 63 | 63 |
|
| 64 | 64 |
// Start |
| 65 | 65 |
dockerCmd(c, "start", name) |
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 71 | 71 |
|
| 72 | 72 |
// Inspect the status |
| 73 | 73 |
out, _ = dockerCmd(c, "inspect", "--format={{.State.Health.Status}}", name)
|
| 74 |
- c.Assert(out, checker.Equals, "unhealthy\n") |
|
| 74 |
+ assert.Assert(c, out, checker.Equals, "unhealthy\n") |
|
| 75 | 75 |
|
| 76 | 76 |
// Make it healthy again |
| 77 | 77 |
dockerCmd(c, "exec", name, "touch", "/status") |
| ... | ... |
@@ -83,7 +83,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 83 | 83 |
// Disable the check from the CLI |
| 84 | 84 |
dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName) |
| 85 | 85 |
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "noh")
|
| 86 |
- c.Assert(out, checker.Equals, "[NONE]\n") |
|
| 86 |
+ assert.Assert(c, out, checker.Equals, "[NONE]\n") |
|
| 87 | 87 |
dockerCmd(c, "rm", "noh") |
| 88 | 88 |
|
| 89 | 89 |
// Disable the check with a new build |
| ... | ... |
@@ -91,7 +91,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 91 | 91 |
HEALTHCHECK NONE`)) |
| 92 | 92 |
|
| 93 | 93 |
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "no_healthcheck")
|
| 94 |
- c.Assert(out, checker.Equals, "[NONE]\n") |
|
| 94 |
+ assert.Assert(c, out, checker.Equals, "[NONE]\n") |
|
| 95 | 95 |
|
| 96 | 96 |
// Enable the checks from the CLI |
| 97 | 97 |
_, _ = dockerCmd(c, "run", "-d", "--name=fatal_healthcheck", |
| ... | ... |
@@ -101,11 +101,11 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 101 | 101 |
"no_healthcheck") |
| 102 | 102 |
waitForHealthStatus(c, "fatal_healthcheck", "starting", "healthy") |
| 103 | 103 |
health := getHealth(c, "fatal_healthcheck") |
| 104 |
- c.Assert(health.Status, checker.Equals, "healthy") |
|
| 105 |
- c.Assert(health.FailingStreak, checker.Equals, 0) |
|
| 104 |
+ assert.Assert(c, health.Status, checker.Equals, "healthy") |
|
| 105 |
+ assert.Assert(c, health.FailingStreak, checker.Equals, 0) |
|
| 106 | 106 |
last := health.Log[len(health.Log)-1] |
| 107 |
- c.Assert(last.ExitCode, checker.Equals, 0) |
|
| 108 |
- c.Assert(last.Output, checker.Equals, "OK\n") |
|
| 107 |
+ assert.Assert(c, last.ExitCode, checker.Equals, 0) |
|
| 108 |
+ assert.Assert(c, last.Output, checker.Equals, "OK\n") |
|
| 109 | 109 |
|
| 110 | 110 |
// Fail the check |
| 111 | 111 |
dockerCmd(c, "exec", "fatal_healthcheck", "rm", "/status") |
| ... | ... |
@@ -113,8 +113,8 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 113 | 113 |
|
| 114 | 114 |
failsStr, _ := dockerCmd(c, "inspect", "--format={{.State.Health.FailingStreak}}", "fatal_healthcheck")
|
| 115 | 115 |
fails, err := strconv.Atoi(strings.TrimSpace(failsStr)) |
| 116 |
- c.Assert(err, check.IsNil) |
|
| 117 |
- c.Assert(fails >= 3, checker.Equals, true) |
|
| 116 |
+ assert.Assert(c, err, check.IsNil) |
|
| 117 |
+ assert.Assert(c, fails >= 3, checker.Equals, true) |
|
| 118 | 118 |
dockerCmd(c, "rm", "-f", "fatal_healthcheck") |
| 119 | 119 |
|
| 120 | 120 |
// Check timeout |
| ... | ... |
@@ -125,9 +125,9 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 125 | 125 |
waitForHealthStatus(c, "test", "starting", "unhealthy") |
| 126 | 126 |
health = getHealth(c, "test") |
| 127 | 127 |
last = health.Log[len(health.Log)-1] |
| 128 |
- c.Assert(health.Status, checker.Equals, "unhealthy") |
|
| 129 |
- c.Assert(last.ExitCode, checker.Equals, -1) |
|
| 130 |
- c.Assert(last.Output, checker.Equals, "Health check exceeded timeout (1s)") |
|
| 128 |
+ assert.Assert(c, health.Status, checker.Equals, "unhealthy") |
|
| 129 |
+ assert.Assert(c, last.ExitCode, checker.Equals, -1) |
|
| 130 |
+ assert.Assert(c, last.Output, checker.Equals, "Health check exceeded timeout (1s)") |
|
| 131 | 131 |
dockerCmd(c, "rm", "-f", "test") |
| 132 | 132 |
|
| 133 | 133 |
// Check JSON-format |
| ... | ... |
@@ -139,7 +139,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 139 | 139 |
CMD ["cat", "/my status"]`)) |
| 140 | 140 |
out, _ = dockerCmd(c, "inspect", |
| 141 | 141 |
"--format={{.Config.Healthcheck.Test}}", imageName)
|
| 142 |
- c.Assert(out, checker.Equals, "[CMD cat /my status]\n") |
|
| 142 |
+ assert.Assert(c, out, checker.Equals, "[CMD cat /my status]\n") |
|
| 143 | 143 |
|
| 144 | 144 |
} |
| 145 | 145 |
|
| ... | ... |
@@ -50,7 +50,7 @@ LABEL label.Z="Z"`)) |
| 50 | 50 |
for i := 0; i < 26; i++ {
|
| 51 | 51 |
echoValue := fmt.Sprintf("LABEL label.%s=%s", expectedValues[i], expectedValues[i])
|
| 52 | 52 |
actualValue := actualValues[i] |
| 53 |
- c.Assert(actualValue, checker.Contains, echoValue) |
|
| 53 |
+ assert.Assert(c, actualValue, checker.Contains, echoValue) |
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
} |
| ... | ... |
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestHistoryExistentImage(c *check.C) {
|
| 61 | 61 |
|
| 62 | 62 |
func (s *DockerSuite) TestHistoryNonExistentImage(c *check.C) {
|
| 63 | 63 |
_, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
|
| 64 |
- c.Assert(err, checker.NotNil, check.Commentf("history on a non-existent image should fail."))
|
|
| 64 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("history on a non-existent image should fail."))
|
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) {
|
| ... | ... |
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) {
|
| 80 | 80 |
out, _ := dockerCmd(c, "history", name) |
| 81 | 81 |
outputTabs := strings.Fields(strings.Split(out, "\n")[1]) |
| 82 | 82 |
actualValue := outputTabs[len(outputTabs)-1] |
| 83 |
- c.Assert(actualValue, checker.Contains, comment) |
|
| 83 |
+ assert.Assert(c, actualValue, checker.Contains, comment) |
|
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 | 86 |
func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) {
|
| ... | ... |
@@ -97,7 +97,7 @@ func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) {
|
| 97 | 97 |
sizeString := lines[i][startIndex:endIndex] |
| 98 | 98 |
|
| 99 | 99 |
_, err := strconv.Atoi(strings.TrimSpace(sizeString)) |
| 100 |
- c.Assert(err, checker.IsNil, check.Commentf("The size '%s' was not an Integer", sizeString))
|
|
| 100 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("The size '%s' was not an Integer", sizeString))
|
|
| 101 | 101 |
} |
| 102 | 102 |
} |
| 103 | 103 |
|
| ... | ... |
@@ -114,6 +114,6 @@ func (s *DockerSuite) TestHistoryHumanOptionTrue(c *check.C) {
|
| 114 | 114 |
endIndex = len(lines[i]) |
| 115 | 115 |
} |
| 116 | 116 |
sizeString := lines[i][startIndex:endIndex] |
| 117 |
- c.Assert(strings.TrimSpace(sizeString), checker.Matches, humanSizeRegexRaw, check.Commentf("The size '%s' was not in human format", sizeString))
|
|
| 117 |
+ assert.Assert(c, strings.TrimSpace(sizeString), checker.Matches, humanSizeRegexRaw, check.Commentf("The size '%s' was not in human format", sizeString))
|
|
| 118 | 118 |
} |
| 119 | 119 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ import ( |
| 21 | 21 |
|
| 22 | 22 |
func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
|
| 23 | 23 |
imagesOut, _ := dockerCmd(c, "images") |
| 24 |
- c.Assert(imagesOut, checker.Contains, "busybox") |
|
| 24 |
+ assert.Assert(c, imagesOut, checker.Contains, "busybox") |
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
|
| ... | ... |
@@ -31,21 +31,21 @@ func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
|
| 31 | 31 |
dockerCmd(c, "tag", "busybox", name+":v2") |
| 32 | 32 |
|
| 33 | 33 |
imagesOut, _ := dockerCmd(c, "images", name+":v1") |
| 34 |
- c.Assert(imagesOut, checker.Contains, name) |
|
| 35 |
- c.Assert(imagesOut, checker.Contains, "v1") |
|
| 36 |
- c.Assert(imagesOut, checker.Not(checker.Contains), "v2") |
|
| 37 |
- c.Assert(imagesOut, checker.Not(checker.Contains), "v1v1") |
|
| 34 |
+ assert.Assert(c, imagesOut, checker.Contains, name) |
|
| 35 |
+ assert.Assert(c, imagesOut, checker.Contains, "v1") |
|
| 36 |
+ assert.Assert(c, imagesOut, checker.Not(checker.Contains), "v2") |
|
| 37 |
+ assert.Assert(c, imagesOut, checker.Not(checker.Contains), "v1v1") |
|
| 38 | 38 |
|
| 39 | 39 |
imagesOut, _ = dockerCmd(c, "images", name) |
| 40 |
- c.Assert(imagesOut, checker.Contains, name) |
|
| 41 |
- c.Assert(imagesOut, checker.Contains, "v1") |
|
| 42 |
- c.Assert(imagesOut, checker.Contains, "v1v1") |
|
| 43 |
- c.Assert(imagesOut, checker.Contains, "v2") |
|
| 40 |
+ assert.Assert(c, imagesOut, checker.Contains, name) |
|
| 41 |
+ assert.Assert(c, imagesOut, checker.Contains, "v1") |
|
| 42 |
+ assert.Assert(c, imagesOut, checker.Contains, "v1v1") |
|
| 43 |
+ assert.Assert(c, imagesOut, checker.Contains, "v2") |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) {
|
| 47 | 47 |
imagesOut, _ := dockerCmd(c, "images", "busybox:nonexistent") |
| 48 |
- c.Assert(imagesOut, checker.Not(checker.Contains), "busybox") |
|
| 48 |
+ assert.Assert(c, imagesOut, checker.Not(checker.Contains), "busybox") |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
|
| ... | ... |
@@ -63,15 +63,15 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
|
| 63 | 63 |
|
| 64 | 64 |
out, _ := dockerCmd(c, "images", "-q", "--no-trunc") |
| 65 | 65 |
imgs := strings.Split(out, "\n") |
| 66 |
- c.Assert(imgs[0], checker.Equals, id3, check.Commentf("First image must be %s, got %s", id3, imgs[0]))
|
|
| 67 |
- c.Assert(imgs[1], checker.Equals, id2, check.Commentf("First image must be %s, got %s", id2, imgs[1]))
|
|
| 68 |
- c.Assert(imgs[2], checker.Equals, id1, check.Commentf("First image must be %s, got %s", id1, imgs[2]))
|
|
| 66 |
+ assert.Assert(c, imgs[0], checker.Equals, id3, check.Commentf("First image must be %s, got %s", id3, imgs[0]))
|
|
| 67 |
+ assert.Assert(c, imgs[1], checker.Equals, id2, check.Commentf("First image must be %s, got %s", id2, imgs[1]))
|
|
| 68 |
+ assert.Assert(c, imgs[2], checker.Equals, id1, check.Commentf("First image must be %s, got %s", id1, imgs[2]))
|
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) {
|
| 72 | 72 |
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
| 73 | 73 |
assert.ErrorContains(c, err, "") |
| 74 |
- c.Assert(out, checker.Contains, "Invalid filter") |
|
| 74 |
+ assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
func (s *DockerSuite) TestImagesFilterLabelMatch(c *check.C) {
|
| ... | ... |
@@ -92,9 +92,9 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *check.C) {
|
| 92 | 92 |
|
| 93 | 93 |
out, _ := dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match") |
| 94 | 94 |
out = strings.TrimSpace(out) |
| 95 |
- c.Assert(out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID))
|
|
| 96 |
- c.Assert(out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID))
|
|
| 97 |
- c.Assert(out, check.Not(check.Matches), fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID))
|
|
| 95 |
+ assert.Assert(c, out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID))
|
|
| 96 |
+ assert.Assert(c, out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID))
|
|
| 97 |
+ assert.Assert(c, out, check.Not(check.Matches), fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID))
|
|
| 98 | 98 |
|
| 99 | 99 |
out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match=me too") |
| 100 | 100 |
out = strings.TrimSpace(out) |
| ... | ... |
@@ -128,34 +128,34 @@ LABEL number=3`)) |
| 128 | 128 |
expected := []string{imageID3, imageID2}
|
| 129 | 129 |
|
| 130 | 130 |
out, _ := dockerCmd(c, "images", "-f", "since=image:1", "image") |
| 131 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 131 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 132 | 132 |
|
| 133 | 133 |
out, _ = dockerCmd(c, "images", "-f", "since="+imageID1, "image") |
| 134 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 134 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 135 | 135 |
|
| 136 | 136 |
expected = []string{imageID3}
|
| 137 | 137 |
|
| 138 | 138 |
out, _ = dockerCmd(c, "images", "-f", "since=image:2", "image") |
| 139 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 139 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 140 | 140 |
|
| 141 | 141 |
out, _ = dockerCmd(c, "images", "-f", "since="+imageID2, "image") |
| 142 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 142 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("SINCE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 143 | 143 |
|
| 144 | 144 |
expected = []string{imageID2, imageID1}
|
| 145 | 145 |
|
| 146 | 146 |
out, _ = dockerCmd(c, "images", "-f", "before=image:3", "image") |
| 147 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 147 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 148 | 148 |
|
| 149 | 149 |
out, _ = dockerCmd(c, "images", "-f", "before="+imageID3, "image") |
| 150 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 150 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 151 | 151 |
|
| 152 | 152 |
expected = []string{imageID1}
|
| 153 | 153 |
|
| 154 | 154 |
out, _ = dockerCmd(c, "images", "-f", "before=image:2", "image") |
| 155 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 155 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 156 | 156 |
|
| 157 | 157 |
out, _ = dockerCmd(c, "images", "-f", "before="+imageID2, "image") |
| 158 |
- c.Assert(assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 158 |
+ assert.Assert(c, assertImageList(out, expected), checker.Equals, true, check.Commentf("BEFORE filter: Image list is not in the correct order: %v\n%s", expected, out))
|
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
func assertImageList(out string, expected []string) bool {
|
| ... | ... |
@@ -239,15 +239,15 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
|
| 239 | 239 |
|
| 240 | 240 |
out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=true") |
| 241 | 241 |
// Expect one dangling image |
| 242 |
- c.Assert(strings.Count(out, imageID), checker.Equals, 1) |
|
| 242 |
+ assert.Assert(c, strings.Count(out, imageID), checker.Equals, 1) |
|
| 243 | 243 |
|
| 244 | 244 |
out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=false") |
| 245 | 245 |
//dangling=false would not include dangling images |
| 246 |
- c.Assert(out, checker.Not(checker.Contains), imageID) |
|
| 246 |
+ assert.Assert(c, out, checker.Not(checker.Contains), imageID) |
|
| 247 | 247 |
|
| 248 | 248 |
out, _ = dockerCmd(c, "images") |
| 249 | 249 |
//docker images still include dangling images |
| 250 |
- c.Assert(out, checker.Contains, imageID) |
|
| 250 |
+ assert.Assert(c, out, checker.Contains, imageID) |
|
| 251 | 251 |
|
| 252 | 252 |
} |
| 253 | 253 |
|
| ... | ... |
@@ -255,7 +255,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
|
| 255 | 255 |
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *check.C) {
|
| 256 | 256 |
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
|
| 257 | 257 |
assert.ErrorContains(c, err, "") |
| 258 |
- c.Assert(out, checker.Contains, "Invalid filter") |
|
| 258 |
+ assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 259 | 259 |
} |
| 260 | 260 |
|
| 261 | 261 |
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) {
|
| ... | ... |
@@ -276,9 +276,9 @@ func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) {
|
| 276 | 276 |
|
| 277 | 277 |
out, _ := dockerCmd(c, "images") |
| 278 | 278 |
// images shouldn't show non-heads images |
| 279 |
- c.Assert(out, checker.Not(checker.Contains), intermediate) |
|
| 279 |
+ assert.Assert(c, out, checker.Not(checker.Contains), intermediate) |
|
| 280 | 280 |
// images should contain final built images |
| 281 |
- c.Assert(out, checker.Contains, stringid.TruncateID(id)) |
|
| 281 |
+ assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 282 | 282 |
} |
| 283 | 283 |
|
| 284 | 284 |
func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) {
|
| ... | ... |
@@ -293,7 +293,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) {
|
| 293 | 293 |
|
| 294 | 294 |
out, _ := dockerCmd(c, "images") |
| 295 | 295 |
// images should contain images built from scratch |
| 296 |
- c.Assert(out, checker.Contains, stringid.TruncateID(id)) |
|
| 296 |
+ assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 297 | 297 |
} |
| 298 | 298 |
|
| 299 | 299 |
// For W2W - equivalent to TestImagesEnsureImagesFromScratchShown but Windows |
| ... | ... |
@@ -309,7 +309,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *check.C) {
|
| 309 | 309 |
|
| 310 | 310 |
out, _ := dockerCmd(c, "images") |
| 311 | 311 |
// images should contain images built from busybox |
| 312 |
- c.Assert(out, checker.Contains, stringid.TruncateID(id)) |
|
| 312 |
+ assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 313 | 313 |
} |
| 314 | 314 |
|
| 315 | 315 |
// #18181 |
| ... | ... |
@@ -317,13 +317,13 @@ func (s *DockerSuite) TestImagesFilterNameWithPort(c *check.C) {
|
| 317 | 317 |
tag := "a.b.c.d:5000/hello" |
| 318 | 318 |
dockerCmd(c, "tag", "busybox", tag) |
| 319 | 319 |
out, _ := dockerCmd(c, "images", tag) |
| 320 |
- c.Assert(out, checker.Contains, tag) |
|
| 320 |
+ assert.Assert(c, out, checker.Contains, tag) |
|
| 321 | 321 |
|
| 322 | 322 |
out, _ = dockerCmd(c, "images", tag+":latest") |
| 323 |
- c.Assert(out, checker.Contains, tag) |
|
| 323 |
+ assert.Assert(c, out, checker.Contains, tag) |
|
| 324 | 324 |
|
| 325 | 325 |
out, _ = dockerCmd(c, "images", tag+":no-such-tag") |
| 326 |
- c.Assert(out, checker.Not(checker.Contains), tag) |
|
| 326 |
+ assert.Assert(c, out, checker.Not(checker.Contains), tag) |
|
| 327 | 327 |
} |
| 328 | 328 |
|
| 329 | 329 |
func (s *DockerSuite) TestImagesFormat(c *check.C) {
|
| ... | ... |
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
|
| 36 | 36 |
|
| 37 | 37 |
func (s *DockerSuite) TestImportBadURL(c *check.C) {
|
| 38 | 38 |
out, _, err := dockerCmdWithError("import", "http://nourl/bad")
|
| 39 |
- c.Assert(err, checker.NotNil, check.Commentf("import was supposed to fail but didn't"))
|
|
| 39 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("import was supposed to fail but didn't"))
|
|
| 40 | 40 |
// Depending on your system you can get either of these errors |
| 41 | 41 |
if !strings.Contains(out, "dial tcp") && |
| 42 | 42 |
!strings.Contains(out, "ApplyLayer exit status 1 stdout: stderr: archive/tar: invalid tar header") && |
| ... | ... |
@@ -50,7 +50,7 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
|
| 50 | 50 |
dockerCmd(c, "run", "--name", "test-import", "busybox", "true") |
| 51 | 51 |
|
| 52 | 52 |
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
| 53 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 53 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 54 | 54 |
defer os.Remove(temporaryFile.Name()) |
| 55 | 55 |
|
| 56 | 56 |
icmd.RunCmd(icmd.Cmd{
|
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestImportGzipped(c *check.C) {
|
| 71 | 71 |
dockerCmd(c, "run", "--name", "test-import", "busybox", "true") |
| 72 | 72 |
|
| 73 | 73 |
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
| 74 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 74 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 75 | 75 |
defer os.Remove(temporaryFile.Name()) |
| 76 | 76 |
|
| 77 | 77 |
w := gzip.NewWriter(temporaryFile) |
| ... | ... |
@@ -79,7 +79,7 @@ func (s *DockerSuite) TestImportGzipped(c *check.C) {
|
| 79 | 79 |
Command: []string{dockerBinary, "export", "test-import"},
|
| 80 | 80 |
Stdout: w, |
| 81 | 81 |
}).Assert(c, icmd.Success) |
| 82 |
- c.Assert(w.Close(), checker.IsNil, check.Commentf("failed to close gzip writer"))
|
|
| 82 |
+ assert.Assert(c, w.Close(), checker.IsNil, check.Commentf("failed to close gzip writer"))
|
|
| 83 | 83 |
temporaryFile.Close() |
| 84 | 84 |
out, _ := dockerCmd(c, "import", temporaryFile.Name()) |
| 85 | 85 |
assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't") |
| ... | ... |
@@ -94,7 +94,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
|
| 94 | 94 |
dockerCmd(c, "run", "--name", "test-import", "busybox", "true") |
| 95 | 95 |
|
| 96 | 96 |
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
| 97 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 97 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 98 | 98 |
defer os.Remove(temporaryFile.Name()) |
| 99 | 99 |
|
| 100 | 100 |
icmd.RunCmd(icmd.Cmd{
|
| ... | ... |
@@ -110,11 +110,11 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
|
| 110 | 110 |
out, _ = dockerCmd(c, "history", image) |
| 111 | 111 |
split := strings.Split(out, "\n") |
| 112 | 112 |
|
| 113 |
- c.Assert(split, checker.HasLen, 3, check.Commentf("expected 3 lines from image history"))
|
|
| 113 |
+ assert.Assert(c, split, checker.HasLen, 3, check.Commentf("expected 3 lines from image history"))
|
|
| 114 | 114 |
r := regexp.MustCompile("[\\s]{2,}")
|
| 115 | 115 |
split = r.Split(split[1], -1) |
| 116 | 116 |
|
| 117 |
- c.Assert(message, checker.Equals, split[3], check.Commentf("didn't get expected value in commit message"))
|
|
| 117 |
+ assert.Assert(c, message, checker.Equals, split[3], check.Commentf("didn't get expected value in commit message"))
|
|
| 118 | 118 |
|
| 119 | 119 |
out, _ = dockerCmd(c, "run", "--rm", image, "true") |
| 120 | 120 |
assert.Equal(c, out, "", "command output should've been nothing") |
| ... | ... |
@@ -122,7 +122,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
|
| 122 | 122 |
|
| 123 | 123 |
func (s *DockerSuite) TestImportFileNonExistentFile(c *check.C) {
|
| 124 | 124 |
_, _, err := dockerCmdWithError("import", "example.com/myImage.tar")
|
| 125 |
- c.Assert(err, checker.NotNil, check.Commentf("import non-existing file must failed"))
|
|
| 125 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("import non-existing file must failed"))
|
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
func (s *DockerSuite) TestImportWithQuotedChanges(c *check.C) {
|
| ... | ... |
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestImportWithQuotedChanges(c *check.C) {
|
| 130 | 130 |
cli.DockerCmd(c, "run", "--name", "test-import", "busybox", "true") |
| 131 | 131 |
|
| 132 | 132 |
temporaryFile, err := ioutil.TempFile("", "exportImportTest")
|
| 133 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 133 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create temporary file"))
|
|
| 134 | 134 |
defer os.Remove(temporaryFile.Name()) |
| 135 | 135 |
|
| 136 | 136 |
cli.Docker(cli.Args("export", "test-import"), cli.WithStdout(bufio.NewWriter(temporaryFile))).Assert(c, icmd.Success)
|
| ... | ... |
@@ -53,14 +53,14 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
for _, linePrefix := range stringsToCheck {
|
| 56 |
- c.Assert(out, checker.Contains, linePrefix, check.Commentf("couldn't find string %v in output", linePrefix))
|
|
| 56 |
+ assert.Assert(c, out, checker.Contains, linePrefix, check.Commentf("couldn't find string %v in output", linePrefix))
|
|
| 57 | 57 |
} |
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
// TestInfoFormat tests `docker info --format` |
| 61 | 61 |
func (s *DockerSuite) TestInfoFormat(c *check.C) {
|
| 62 | 62 |
out, status := dockerCmd(c, "info", "--format", "{{json .}}")
|
| 63 |
- c.Assert(status, checker.Equals, 0) |
|
| 63 |
+ assert.Assert(c, status, checker.Equals, 0) |
|
| 64 | 64 |
var m map[string]interface{}
|
| 65 | 65 |
err := json.Unmarshal([]byte(out), &m) |
| 66 | 66 |
assert.NilError(c, err) |
| ... | ... |
@@ -81,8 +81,8 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
|
| 81 | 81 |
|
| 82 | 82 |
out, err := d.Cmd("info")
|
| 83 | 83 |
assert.NilError(c, err) |
| 84 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 85 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise))
|
|
| 84 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 85 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise))
|
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with |
| ... | ... |
@@ -124,8 +124,8 @@ func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
|
| 124 | 124 |
|
| 125 | 125 |
out, err := d.Cmd("info")
|
| 126 | 126 |
assert.NilError(c, err) |
| 127 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 128 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String()))
|
|
| 127 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 128 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String()))
|
|
| 129 | 129 |
} |
| 130 | 130 |
|
| 131 | 131 |
func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *check.C) {
|
| ... | ... |
@@ -135,10 +135,10 @@ func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *check.C) {
|
| 135 | 135 |
|
| 136 | 136 |
dockerCmd(c, "run", "-d", "busybox", "top") |
| 137 | 137 |
out, _ := dockerCmd(c, "info") |
| 138 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 139 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]+1))
|
|
| 140 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 141 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 138 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 139 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]+1))
|
|
| 140 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 141 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 | 144 |
func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *check.C) {
|
| ... | ... |
@@ -152,10 +152,10 @@ func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *check.C) {
|
| 152 | 152 |
dockerCmd(c, "pause", cleanedContainerID) |
| 153 | 153 |
|
| 154 | 154 |
out, _ = dockerCmd(c, "info") |
| 155 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 156 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 157 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]+1))
|
|
| 158 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 155 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 156 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 157 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]+1))
|
|
| 158 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) {
|
| ... | ... |
@@ -169,10 +169,10 @@ func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) {
|
| 169 | 169 |
dockerCmd(c, "stop", cleanedContainerID) |
| 170 | 170 |
|
| 171 | 171 |
out, _ = dockerCmd(c, "info") |
| 172 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 173 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 174 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 175 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]+1))
|
|
| 172 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 173 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 174 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 175 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]+1))
|
|
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 | 178 |
func (s *DockerSuite) TestInfoDebug(c *check.C) {
|
| ... | ... |
@@ -184,13 +184,13 @@ func (s *DockerSuite) TestInfoDebug(c *check.C) {
|
| 184 | 184 |
|
| 185 | 185 |
out, err := d.Cmd("--debug", "info")
|
| 186 | 186 |
assert.NilError(c, err) |
| 187 |
- c.Assert(out, checker.Contains, "Debug Mode (client): true\n") |
|
| 188 |
- c.Assert(out, checker.Contains, "Debug Mode (server): true\n") |
|
| 189 |
- c.Assert(out, checker.Contains, "File Descriptors") |
|
| 190 |
- c.Assert(out, checker.Contains, "Goroutines") |
|
| 191 |
- c.Assert(out, checker.Contains, "System Time") |
|
| 192 |
- c.Assert(out, checker.Contains, "EventsListeners") |
|
| 193 |
- c.Assert(out, checker.Contains, "Docker Root Dir") |
|
| 187 |
+ assert.Assert(c, out, checker.Contains, "Debug Mode (client): true\n") |
|
| 188 |
+ assert.Assert(c, out, checker.Contains, "Debug Mode (server): true\n") |
|
| 189 |
+ assert.Assert(c, out, checker.Contains, "File Descriptors") |
|
| 190 |
+ assert.Assert(c, out, checker.Contains, "Goroutines") |
|
| 191 |
+ assert.Assert(c, out, checker.Contains, "System Time") |
|
| 192 |
+ assert.Assert(c, out, checker.Contains, "EventsListeners") |
|
| 193 |
+ assert.Assert(c, out, checker.Contains, "Docker Root Dir") |
|
| 194 | 194 |
} |
| 195 | 195 |
|
| 196 | 196 |
func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
|
| ... | ... |
@@ -205,9 +205,9 @@ func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
|
| 205 | 205 |
|
| 206 | 206 |
out, err := d.Cmd("info")
|
| 207 | 207 |
assert.NilError(c, err) |
| 208 |
- c.Assert(out, checker.Contains, "Insecure Registries:\n") |
|
| 209 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))
|
|
| 210 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR))
|
|
| 208 |
+ assert.Assert(c, out, checker.Contains, "Insecure Registries:\n") |
|
| 209 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))
|
|
| 210 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR))
|
|
| 211 | 211 |
} |
| 212 | 212 |
|
| 213 | 213 |
func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) {
|
| ... | ... |
@@ -219,9 +219,9 @@ func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) {
|
| 219 | 219 |
|
| 220 | 220 |
out, err := s.d.Cmd("info")
|
| 221 | 221 |
assert.NilError(c, err) |
| 222 |
- c.Assert(out, checker.Contains, "Registry Mirrors:\n") |
|
| 223 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" %s", registryMirror1))
|
|
| 224 |
- c.Assert(out, checker.Contains, fmt.Sprintf(" %s", registryMirror2))
|
|
| 222 |
+ assert.Assert(c, out, checker.Contains, "Registry Mirrors:\n") |
|
| 223 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s", registryMirror1))
|
|
| 224 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s", registryMirror2))
|
|
| 225 | 225 |
} |
| 226 | 226 |
|
| 227 | 227 |
func existingContainerStates(c *check.C) map[string]int {
|
| ... | ... |
@@ -11,5 +11,5 @@ func (s *DockerSuite) TestInfoSecurityOptions(c *check.C) {
|
| 11 | 11 |
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, Apparmor, DaemonIsLinux) |
| 12 | 12 |
|
| 13 | 13 |
out, _ := dockerCmd(c, "info") |
| 14 |
- c.Assert(out, checker.Contains, "Security Options:\n apparmor\n seccomp\n Profile: default\n") |
|
| 14 |
+ assert.Assert(c, out, checker.Contains, "Security Options:\n apparmor\n seccomp\n Profile: default\n") |
|
| 15 | 15 |
} |
| ... | ... |
@@ -33,13 +33,13 @@ func (s *DockerSuite) TestInspectImage(c *check.C) {
|
| 33 | 33 |
imageTestID := "sha256:11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d" |
| 34 | 34 |
id := inspectField(c, imageTest, "Id") |
| 35 | 35 |
|
| 36 |
- c.Assert(id, checker.Equals, imageTestID) |
|
| 36 |
+ assert.Assert(c, id, checker.Equals, imageTestID) |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func (s *DockerSuite) TestInspectInt64(c *check.C) {
|
| 40 | 40 |
dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true") |
| 41 | 41 |
inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory") |
| 42 |
- c.Assert(inspectOut, checker.Equals, "314572800") |
|
| 42 |
+ assert.Assert(c, inspectOut, checker.Equals, "314572800") |
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 | 45 |
func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
| ... | ... |
@@ -50,7 +50,7 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
| 50 | 50 |
containerID := strings.TrimSpace(out) |
| 51 | 51 |
|
| 52 | 52 |
inspectOut := inspectField(c, "busybox", "Id") |
| 53 |
- c.Assert(strings.TrimSpace(inspectOut), checker.Equals, containerID) |
|
| 53 |
+ assert.Assert(c, strings.TrimSpace(inspectOut), checker.Equals, containerID) |
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
| ... | ... |
@@ -58,23 +58,23 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
| 58 | 58 |
out = strings.TrimSpace(out) |
| 59 | 59 |
|
| 60 | 60 |
inspectOut := inspectField(c, out, "State.Status") |
| 61 |
- c.Assert(inspectOut, checker.Equals, "running") |
|
| 61 |
+ assert.Assert(c, inspectOut, checker.Equals, "running") |
|
| 62 | 62 |
|
| 63 | 63 |
// Windows does not support pause/unpause on Windows Server Containers. |
| 64 | 64 |
// (RS1 does for Hyper-V Containers, but production CI is not setup for that) |
| 65 | 65 |
if testEnv.OSType != "windows" {
|
| 66 | 66 |
dockerCmd(c, "pause", out) |
| 67 | 67 |
inspectOut = inspectField(c, out, "State.Status") |
| 68 |
- c.Assert(inspectOut, checker.Equals, "paused") |
|
| 68 |
+ assert.Assert(c, inspectOut, checker.Equals, "paused") |
|
| 69 | 69 |
|
| 70 | 70 |
dockerCmd(c, "unpause", out) |
| 71 | 71 |
inspectOut = inspectField(c, out, "State.Status") |
| 72 |
- c.Assert(inspectOut, checker.Equals, "running") |
|
| 72 |
+ assert.Assert(c, inspectOut, checker.Equals, "running") |
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
dockerCmd(c, "stop", out) |
| 76 | 76 |
inspectOut = inspectField(c, out, "State.Status") |
| 77 |
- c.Assert(inspectOut, checker.Equals, "exited") |
|
| 77 |
+ assert.Assert(c, inspectOut, checker.Equals, "exited") |
|
| 78 | 78 |
|
| 79 | 79 |
} |
| 80 | 80 |
|
| ... | ... |
@@ -109,7 +109,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
|
| 109 | 109 |
|
| 110 | 110 |
out, _ := dockerCmd(c, "inspect", "--type=image", "busybox") |
| 111 | 111 |
// not an image JSON |
| 112 |
- c.Assert(out, checker.Not(checker.Contains), "State") |
|
| 112 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "State") |
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
|
| ... | ... |
@@ -119,9 +119,9 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
|
| 119 | 119 |
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") |
| 120 | 120 |
|
| 121 | 121 |
out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
|
| 122 |
- c.Assert(err, checker.NotNil, check.Commentf("%d", exitCode))
|
|
| 123 |
- c.Assert(exitCode, checker.Equals, 1, check.Commentf("%s", err))
|
|
| 124 |
- c.Assert(out, checker.Contains, "not a valid value for --type") |
|
| 122 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("%d", exitCode))
|
|
| 123 |
+ assert.Assert(c, exitCode, checker.Equals, 1, check.Commentf("%s", err))
|
|
| 124 |
+ assert.Assert(c, out, checker.Contains, "not a valid value for --type") |
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
|
| ... | ... |
@@ -130,14 +130,14 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
|
| 130 | 130 |
out := inspectField(c, imageTest, "Size") |
| 131 | 131 |
|
| 132 | 132 |
size, err := strconv.Atoi(out) |
| 133 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect size of the image: %s, %v", out, err))
|
|
| 133 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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)
|
| 137 | 137 |
out, _ = dockerCmd(c, "inspect", formatStr, imageTest) |
| 138 | 138 |
result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")) |
| 139 | 139 |
assert.NilError(c, err) |
| 140 |
- c.Assert(result, checker.Equals, true) |
|
| 140 |
+ assert.Assert(c, result, checker.Equals, true) |
|
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 | 143 |
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
|
| ... | ... |
@@ -152,14 +152,14 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
|
| 152 | 152 |
out = inspectField(c, id, "State.ExitCode") |
| 153 | 153 |
|
| 154 | 154 |
exitCode, err := strconv.Atoi(out) |
| 155 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect exitcode of the container: %s, %v", out, err))
|
|
| 155 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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)
|
| 159 | 159 |
out, _ = dockerCmd(c, "inspect", formatStr, id) |
| 160 | 160 |
inspectResult, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")) |
| 161 | 161 |
assert.NilError(c, err) |
| 162 |
- c.Assert(inspectResult, checker.Equals, true) |
|
| 162 |
+ assert.Assert(c, inspectResult, checker.Equals, true) |
|
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 | 165 |
func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
|
| ... | ... |
@@ -172,12 +172,12 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
|
| 172 | 172 |
deviceID := inspectField(c, imageTest, "GraphDriver.Data.DeviceId") |
| 173 | 173 |
|
| 174 | 174 |
_, err := strconv.Atoi(deviceID) |
| 175 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 175 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 180 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
|
| ... | ... |
@@ -194,15 +194,15 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
|
| 194 | 194 |
|
| 195 | 195 |
deviceID := inspectField(c, out, "GraphDriver.Data.DeviceId") |
| 196 | 196 |
|
| 197 |
- c.Assert(imageDeviceID, checker.Not(checker.Equals), deviceID) |
|
| 197 |
+ assert.Assert(c, imageDeviceID, checker.Not(checker.Equals), deviceID) |
|
| 198 | 198 |
|
| 199 | 199 |
_, err := strconv.Atoi(deviceID) |
| 200 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
|
|
| 200 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 205 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
|
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
|
| ... | ... |
@@ -223,18 +223,18 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
|
| 223 | 223 |
assert.NilError(c, err) |
| 224 | 224 |
|
| 225 | 225 |
// check that there is only one mountpoint |
| 226 |
- c.Assert(mp, check.HasLen, 1) |
|
| 226 |
+ assert.Assert(c, mp, check.HasLen, 1) |
|
| 227 | 227 |
|
| 228 | 228 |
m := mp[0] |
| 229 | 229 |
|
| 230 |
- c.Assert(m.Name, checker.Equals, "") |
|
| 231 |
- c.Assert(m.Driver, checker.Equals, "") |
|
| 232 |
- c.Assert(m.Source, checker.Equals, prefix+slash+"data") |
|
| 233 |
- c.Assert(m.Destination, checker.Equals, prefix+slash+"data") |
|
| 230 |
+ assert.Assert(c, m.Name, checker.Equals, "") |
|
| 231 |
+ assert.Assert(c, m.Driver, checker.Equals, "") |
|
| 232 |
+ assert.Assert(c, m.Source, checker.Equals, prefix+slash+"data") |
|
| 233 |
+ assert.Assert(c, m.Destination, checker.Equals, prefix+slash+"data") |
|
| 234 | 234 |
if testEnv.OSType != "windows" { // Windows does not set mode
|
| 235 |
- c.Assert(m.Mode, checker.Equals, "ro"+modifier) |
|
| 235 |
+ assert.Assert(c, m.Mode, checker.Equals, "ro"+modifier) |
|
| 236 | 236 |
} |
| 237 |
- c.Assert(m.RW, checker.Equals, false) |
|
| 237 |
+ assert.Assert(c, m.RW, checker.Equals, false) |
|
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 | 240 |
func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
|
| ... | ... |
@@ -249,15 +249,15 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
|
| 249 | 249 |
assert.NilError(c, err) |
| 250 | 250 |
|
| 251 | 251 |
// check that there is only one mountpoint |
| 252 |
- c.Assert(mp, checker.HasLen, 1) |
|
| 252 |
+ assert.Assert(c, mp, checker.HasLen, 1) |
|
| 253 | 253 |
|
| 254 | 254 |
m := mp[0] |
| 255 | 255 |
|
| 256 |
- c.Assert(m.Name, checker.Equals, "data") |
|
| 257 |
- c.Assert(m.Driver, checker.Equals, "local") |
|
| 258 |
- c.Assert(m.Source, checker.Not(checker.Equals), "") |
|
| 259 |
- c.Assert(m.Destination, checker.Equals, prefix+slash+"data") |
|
| 260 |
- c.Assert(m.RW, checker.Equals, true) |
|
| 256 |
+ assert.Assert(c, m.Name, checker.Equals, "data") |
|
| 257 |
+ assert.Assert(c, m.Driver, checker.Equals, "local") |
|
| 258 |
+ assert.Assert(c, m.Source, checker.Not(checker.Equals), "") |
|
| 259 |
+ assert.Assert(c, m.Destination, checker.Equals, prefix+slash+"data") |
|
| 260 |
+ assert.Assert(c, m.RW, checker.Equals, true) |
|
| 261 | 261 |
} |
| 262 | 262 |
|
| 263 | 263 |
// #14947 |
| ... | ... |
@@ -289,10 +289,10 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
|
| 289 | 289 |
out := inspectFieldJSON(c, "test", "HostConfig.LogConfig") |
| 290 | 290 |
|
| 291 | 291 |
err := json.NewDecoder(strings.NewReader(out)).Decode(&logConfig) |
| 292 |
- c.Assert(err, checker.IsNil, check.Commentf("%v", out))
|
|
| 292 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%v", out))
|
|
| 293 | 293 |
|
| 294 |
- c.Assert(logConfig.Type, checker.Equals, "json-file") |
|
| 295 |
- c.Assert(logConfig.Config["max-file"], checker.Equals, "42", check.Commentf("%v", logConfig))
|
|
| 294 |
+ assert.Assert(c, logConfig.Type, checker.Equals, "json-file") |
|
| 295 |
+ assert.Assert(c, logConfig.Config["max-file"], checker.Equals, "42", check.Commentf("%v", logConfig))
|
|
| 296 | 296 |
} |
| 297 | 297 |
|
| 298 | 298 |
func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *check.C) {
|
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *check.C) {
|
| 304 | 304 |
|
| 305 | 305 |
formatStr := "--format={{.SizeRw}},{{.SizeRootFs}}"
|
| 306 | 306 |
out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox") |
| 307 |
- c.Assert(strings.TrimSpace(out), check.Equals, "<nil>,<nil>", check.Commentf("Expected not to display size info: %s", out))
|
|
| 307 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "<nil>,<nil>", check.Commentf("Expected not to display size info: %s", out))
|
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
func (s *DockerSuite) TestInspectSizeFlagContainer(c *check.C) {
|
| ... | ... |
@@ -314,8 +314,8 @@ func (s *DockerSuite) TestInspectSizeFlagContainer(c *check.C) {
|
| 314 | 314 |
out, _ := dockerCmd(c, "inspect", "-s", "--type=container", formatStr, "busybox") |
| 315 | 315 |
sz := strings.Split(out, ",") |
| 316 | 316 |
|
| 317 |
- c.Assert(strings.TrimSpace(sz[0]), check.Not(check.Equals), "<nil>") |
|
| 318 |
- c.Assert(strings.TrimSpace(sz[1]), check.Not(check.Equals), "<nil>") |
|
| 317 |
+ assert.Assert(c, strings.TrimSpace(sz[0]), check.Not(check.Equals), "<nil>") |
|
| 318 |
+ assert.Assert(c, strings.TrimSpace(sz[1]), check.Not(check.Equals), "<nil>") |
|
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
func (s *DockerSuite) TestInspectTemplateError(c *check.C) {
|
| ... | ... |
@@ -324,12 +324,12 @@ func (s *DockerSuite) TestInspectTemplateError(c *check.C) {
|
| 324 | 324 |
runSleepingContainer(c, "--name=container1", "-d") |
| 325 | 325 |
|
| 326 | 326 |
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='Format container: {{.ThisDoesNotExist}}'", "container1")
|
| 327 |
- c.Assert(err, check.Not(check.IsNil)) |
|
| 328 |
- c.Assert(out, checker.Contains, "Template parsing error") |
|
| 327 |
+ assert.Assert(c, err, check.Not(check.IsNil)) |
|
| 328 |
+ assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 329 | 329 |
|
| 330 | 330 |
out, _, err = dockerCmdWithError("inspect", "--type=image", "--format='Format container: {{.ThisDoesNotExist}}'", "busybox")
|
| 331 |
- c.Assert(err, check.Not(check.IsNil)) |
|
| 332 |
- c.Assert(out, checker.Contains, "Template parsing error") |
|
| 331 |
+ assert.Assert(c, err, check.Not(check.IsNil)) |
|
| 332 |
+ assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
func (s *DockerSuite) TestInspectJSONFields(c *check.C) {
|
| ... | ... |
@@ -345,10 +345,10 @@ func (s *DockerSuite) TestInspectByPrefix(c *check.C) {
|
| 345 | 345 |
assert.Assert(c, strings.HasPrefix(id, "sha256:")) |
| 346 | 346 |
|
| 347 | 347 |
id2 := inspectField(c, id[:12], "Id") |
| 348 |
- c.Assert(id, checker.Equals, id2) |
|
| 348 |
+ assert.Assert(c, id, checker.Equals, id2) |
|
| 349 | 349 |
|
| 350 | 350 |
id3 := inspectField(c, strings.TrimPrefix(id, "sha256:")[:12], "Id") |
| 351 |
- c.Assert(id, checker.Equals, id3) |
|
| 351 |
+ assert.Assert(c, id, checker.Equals, id3) |
|
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 | 354 |
func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
|
| ... | ... |
@@ -356,18 +356,18 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
|
| 356 | 356 |
runSleepingContainer(c, "--name=busybox2", "-d") |
| 357 | 357 |
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
|
| 358 | 358 |
|
| 359 |
- c.Assert(result.Error, checker.Not(check.IsNil)) |
|
| 360 |
- c.Assert(result.Stdout(), checker.Contains, "busybox1") |
|
| 361 |
- c.Assert(result.Stdout(), checker.Contains, "busybox2") |
|
| 362 |
- c.Assert(result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 359 |
+ assert.Assert(c, result.Error, checker.Not(check.IsNil)) |
|
| 360 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
|
| 361 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
|
| 362 |
+ assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 363 | 363 |
|
| 364 | 364 |
// test inspect would not fast fail |
| 365 | 365 |
result = dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "missing", "busybox1", "busybox2")
|
| 366 | 366 |
|
| 367 |
- c.Assert(result.Error, checker.Not(check.IsNil)) |
|
| 368 |
- c.Assert(result.Stdout(), checker.Contains, "busybox1") |
|
| 369 |
- c.Assert(result.Stdout(), checker.Contains, "busybox2") |
|
| 370 |
- c.Assert(result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 367 |
+ assert.Assert(c, result.Error, checker.Not(check.IsNil)) |
|
| 368 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
|
| 369 |
+ assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
|
| 370 |
+ assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 371 | 371 |
} |
| 372 | 372 |
|
| 373 | 373 |
func (s *DockerSuite) TestInspectHistory(c *check.C) {
|
| ... | ... |
@@ -375,7 +375,7 @@ func (s *DockerSuite) TestInspectHistory(c *check.C) {
|
| 375 | 375 |
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg") |
| 376 | 376 |
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
|
| 377 | 377 |
assert.NilError(c, err) |
| 378 |
- c.Assert(out, checker.Contains, "test comment") |
|
| 378 |
+ assert.Assert(c, out, checker.Contains, "test comment") |
|
| 379 | 379 |
} |
| 380 | 380 |
|
| 381 | 381 |
func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) {
|
| ... | ... |
@@ -385,7 +385,7 @@ func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) {
|
| 385 | 385 |
dockerCmd(c, "run", "--name", contName, "-d", "busybox", "top") |
| 386 | 386 |
netOut, _ := dockerCmd(c, "network", "inspect", "--format={{.ID}}", "bridge")
|
| 387 | 387 |
out := inspectField(c, contName, "NetworkSettings.Networks") |
| 388 |
- c.Assert(out, checker.Contains, "bridge") |
|
| 388 |
+ assert.Assert(c, out, checker.Contains, "bridge") |
|
| 389 | 389 |
out = inspectField(c, contName, "NetworkSettings.Networks.bridge.NetworkID") |
| 390 | 390 |
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) |
| 391 | 391 |
} |
| ... | ... |
@@ -396,7 +396,7 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
|
| 396 | 396 |
netOut, _ := dockerCmd(c, "network", "create", "net1") |
| 397 | 397 |
dockerCmd(c, "run", "--name=container1", "--net=net1", "-d", "busybox", "top") |
| 398 | 398 |
out := inspectField(c, "container1", "NetworkSettings.Networks") |
| 399 |
- c.Assert(out, checker.Contains, "net1") |
|
| 399 |
+ assert.Assert(c, out, checker.Contains, "net1") |
|
| 400 | 400 |
out = inspectField(c, "container1", "NetworkSettings.Networks.net1.NetworkID") |
| 401 | 401 |
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) |
| 402 | 402 |
} |
| ... | ... |
@@ -416,9 +416,9 @@ func (s *DockerSuite) TestInspectAmpersand(c *check.C) {
|
| 416 | 416 |
|
| 417 | 417 |
name := "test" |
| 418 | 418 |
out, _ := dockerCmd(c, "run", "--name", name, "--env", `TEST_ENV="soanni&rtr"`, "busybox", "env") |
| 419 |
- c.Assert(out, checker.Contains, `soanni&rtr`) |
|
| 419 |
+ assert.Assert(c, out, checker.Contains, `soanni&rtr`) |
|
| 420 | 420 |
out, _ = dockerCmd(c, "inspect", name) |
| 421 |
- c.Assert(out, checker.Contains, `soanni&rtr`) |
|
| 421 |
+ assert.Assert(c, out, checker.Contains, `soanni&rtr`) |
|
| 422 | 422 |
} |
| 423 | 423 |
|
| 424 | 424 |
func (s *DockerSuite) TestInspectPlugin(c *check.C) {
|
| ... | ... |
@@ -448,7 +448,7 @@ func (s *DockerSuite) TestInspectPlugin(c *check.C) {
|
| 448 | 448 |
|
| 449 | 449 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 450 | 450 |
assert.NilError(c, err) |
| 451 |
- c.Assert(out, checker.Contains, pNameWithTag) |
|
| 451 |
+ assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 452 | 452 |
} |
| 453 | 453 |
|
| 454 | 454 |
// Test case for 29185 |
| ... | ... |
@@ -456,6 +456,6 @@ func (s *DockerSuite) TestInspectUnknownObject(c *check.C) {
|
| 456 | 456 |
// This test should work on both Windows and Linux |
| 457 | 457 |
out, _, err := dockerCmdWithError("inspect", "foobar")
|
| 458 | 458 |
assert.ErrorContains(c, err, "") |
| 459 |
- c.Assert(out, checker.Contains, "Error: No such object: foobar") |
|
| 459 |
+ assert.Assert(c, out, checker.Contains, "Error: No such object: foobar") |
|
| 460 | 460 |
assert.ErrorContains(c, err, "Error: No such object: foobar") |
| 461 | 461 |
} |
| ... | ... |
@@ -18,7 +18,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
|
| 18 | 18 |
_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
|
| 19 | 19 |
|
| 20 | 20 |
// run ping failed with error |
| 21 |
- c.Assert(exitCode, checker.Equals, 1, check.Commentf("error: %v", err))
|
|
| 21 |
+ assert.Assert(c, exitCode, checker.Equals, 1, check.Commentf("error: %v", err))
|
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 | 24 |
// Test for appropriate error when calling --link with an invalid target container |
| ... | ... |
@@ -27,11 +27,11 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
|
| 27 | 27 |
out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
|
| 28 | 28 |
|
| 29 | 29 |
// an invalid container target should produce an error |
| 30 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 30 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 31 | 31 |
// an invalid container target should produce an error |
| 32 | 32 |
// note: convert the output to lowercase first as the error string |
| 33 | 33 |
// capitalization was changed after API version 1.32 |
| 34 |
- c.Assert(strings.ToLower(out), checker.Contains, "could not get container") |
|
| 34 |
+ assert.Assert(c, strings.ToLower(out), checker.Contains, "could not get container") |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) {
|
| ... | ... |
@@ -148,12 +148,12 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) {
|
| 148 | 148 |
out, _ = dockerCmd(c, "run", "-itd", "--name", "two", "--link", "one:onetwo", "busybox", "top") |
| 149 | 149 |
idTwo := strings.TrimSpace(out) |
| 150 | 150 |
|
| 151 |
- c.Assert(waitRun(idTwo), checker.IsNil) |
|
| 151 |
+ assert.Assert(c, waitRun(idTwo), checker.IsNil) |
|
| 152 | 152 |
|
| 153 | 153 |
readContainerFileWithExec(c, idOne, "/etc/hosts") |
| 154 | 154 |
contentTwo := readContainerFileWithExec(c, idTwo, "/etc/hosts") |
| 155 | 155 |
// Host is not present in updated hosts file |
| 156 |
- c.Assert(string(contentTwo), checker.Contains, "onetwo") |
|
| 156 |
+ assert.Assert(c, string(contentTwo), checker.Contains, "onetwo") |
|
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 | 159 |
func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
|
| ... | ... |
@@ -169,33 +169,33 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
|
| 169 | 169 |
getIP := func(hosts []byte, hostname string) string {
|
| 170 | 170 |
re := regexp.MustCompile(fmt.Sprintf(`(\S*)\t%s`, regexp.QuoteMeta(hostname))) |
| 171 | 171 |
matches := re.FindSubmatch(hosts) |
| 172 |
- c.Assert(matches, checker.NotNil, check.Commentf("Hostname %s have no matches in hosts", hostname))
|
|
| 172 |
+ assert.Assert(c, matches, checker.NotNil, check.Commentf("Hostname %s have no matches in hosts", hostname))
|
|
| 173 | 173 |
return string(matches[1]) |
| 174 | 174 |
} |
| 175 | 175 |
ip := getIP(content, "one") |
| 176 |
- c.Assert(ip, checker.Equals, realIP) |
|
| 176 |
+ assert.Assert(c, ip, checker.Equals, realIP) |
|
| 177 | 177 |
|
| 178 | 178 |
ip = getIP(content, "onetwo") |
| 179 |
- c.Assert(ip, checker.Equals, realIP) |
|
| 179 |
+ assert.Assert(c, ip, checker.Equals, realIP) |
|
| 180 | 180 |
|
| 181 | 181 |
dockerCmd(c, "restart", "one") |
| 182 | 182 |
realIP = inspectField(c, "one", "NetworkSettings.Networks.bridge.IPAddress") |
| 183 | 183 |
|
| 184 | 184 |
content = readContainerFileWithExec(c, id, "/etc/hosts") |
| 185 | 185 |
ip = getIP(content, "one") |
| 186 |
- c.Assert(ip, checker.Equals, realIP) |
|
| 186 |
+ assert.Assert(c, ip, checker.Equals, realIP) |
|
| 187 | 187 |
|
| 188 | 188 |
ip = getIP(content, "onetwo") |
| 189 |
- c.Assert(ip, checker.Equals, realIP) |
|
| 189 |
+ assert.Assert(c, ip, checker.Equals, realIP) |
|
| 190 | 190 |
} |
| 191 | 191 |
|
| 192 | 192 |
func (s *DockerSuite) TestLinksEnvs(c *check.C) {
|
| 193 | 193 |
testRequires(c, DaemonIsLinux) |
| 194 | 194 |
dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top") |
| 195 | 195 |
out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env") |
| 196 |
- c.Assert(out, checker.Contains, "FIRST_ENV_e1=\n") |
|
| 197 |
- c.Assert(out, checker.Contains, "FIRST_ENV_e2=v2") |
|
| 198 |
- c.Assert(out, checker.Contains, "FIRST_ENV_e3=v3=v3") |
|
| 196 |
+ assert.Assert(c, out, checker.Contains, "FIRST_ENV_e1=\n") |
|
| 197 |
+ assert.Assert(c, out, checker.Contains, "FIRST_ENV_e2=v2") |
|
| 198 |
+ assert.Assert(c, out, checker.Contains, "FIRST_ENV_e3=v3=v3") |
|
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 | 201 |
func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
|
| ... | ... |
@@ -203,15 +203,15 @@ func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
|
| 203 | 203 |
out, _ := dockerCmd(c, "run", "-d", "--name", "shortlinkdef", "busybox", "top") |
| 204 | 204 |
|
| 205 | 205 |
cid := strings.TrimSpace(out) |
| 206 |
- c.Assert(waitRun(cid), checker.IsNil) |
|
| 206 |
+ assert.Assert(c, waitRun(cid), checker.IsNil) |
|
| 207 | 207 |
|
| 208 | 208 |
out, _ = dockerCmd(c, "run", "-d", "--name", "link2", "--link", "shortlinkdef", "busybox", "top") |
| 209 | 209 |
|
| 210 | 210 |
cid2 := strings.TrimSpace(out) |
| 211 |
- c.Assert(waitRun(cid2), checker.IsNil) |
|
| 211 |
+ assert.Assert(c, waitRun(cid2), checker.IsNil) |
|
| 212 | 212 |
|
| 213 | 213 |
links := inspectFieldJSON(c, cid2, "HostConfig.Links") |
| 214 |
- c.Assert(links, checker.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]") |
|
| 214 |
+ assert.Assert(c, links, checker.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]") |
|
| 215 | 215 |
} |
| 216 | 216 |
|
| 217 | 217 |
func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
|
| ... | ... |
@@ -220,16 +220,16 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
|
| 220 | 220 |
out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
|
| 221 | 221 |
|
| 222 | 222 |
// Running container linking to a container with --net host should have failed |
| 223 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 223 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 224 | 224 |
// Running container linking to a container with --net host should have failed |
| 225 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 225 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 | 228 |
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
|
| 229 | 229 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 230 | 230 |
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") |
| 231 | 231 |
// /etc/hosts should be a regular file |
| 232 |
- c.Assert(out, checker.Matches, "^-.+\n") |
|
| 232 |
+ assert.Assert(c, out, checker.Matches, "^-.+\n") |
|
| 233 | 233 |
} |
| 234 | 234 |
|
| 235 | 235 |
func (s *DockerSuite) TestLinksMultipleWithSameName(c *check.C) {
|
| ... | ... |
@@ -19,7 +19,7 @@ const stringCheckPS = "PID USER" |
| 19 | 19 |
// stop the tests. |
| 20 | 20 |
func dockerCmdWithFail(c *check.C, args ...string) (string, int) {
|
| 21 | 21 |
out, status, err := dockerCmdWithError(args...) |
| 22 |
- c.Assert(err, check.NotNil, check.Commentf("%v", out))
|
|
| 22 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("%v", out))
|
|
| 23 | 23 |
return out, status |
| 24 | 24 |
} |
| 25 | 25 |
|
| ... | ... |
@@ -27,70 +27,70 @@ func (s *DockerSuite) TestNetHostnameWithNetHost(c *check.C) {
|
| 27 | 27 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 28 | 28 |
|
| 29 | 29 |
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ps") |
| 30 |
- c.Assert(out, checker.Contains, stringCheckPS) |
|
| 30 |
+ assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
func (s *DockerSuite) TestNetHostname(c *check.C) {
|
| 34 | 34 |
testRequires(c, DaemonIsLinux) |
| 35 | 35 |
|
| 36 | 36 |
out, _ := dockerCmd(c, "run", "-h=name", "busybox", "ps") |
| 37 |
- c.Assert(out, checker.Contains, stringCheckPS) |
|
| 37 |
+ assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 38 | 38 |
|
| 39 | 39 |
out, _ = dockerCmd(c, "run", "-h=name", "--net=bridge", "busybox", "ps") |
| 40 |
- c.Assert(out, checker.Contains, stringCheckPS) |
|
| 40 |
+ assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 41 | 41 |
|
| 42 | 42 |
out, _ = dockerCmd(c, "run", "-h=name", "--net=none", "busybox", "ps") |
| 43 |
- c.Assert(out, checker.Contains, stringCheckPS) |
|
| 43 |
+ assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 44 | 44 |
|
| 45 | 45 |
out, _ = dockerCmdWithFail(c, "run", "-h=name", "--net=container:other", "busybox", "ps") |
| 46 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkHostname.Error()) |
|
| 46 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkHostname.Error()) |
|
| 47 | 47 |
|
| 48 | 48 |
out, _ = dockerCmdWithFail(c, "run", "--net=container", "busybox", "ps") |
| 49 |
- c.Assert(out, checker.Contains, "invalid container format container:<name|id>") |
|
| 49 |
+ assert.Assert(c, out, checker.Contains, "invalid container format container:<name|id>") |
|
| 50 | 50 |
|
| 51 | 51 |
out, _ = dockerCmdWithFail(c, "run", "--net=weird", "busybox", "ps") |
| 52 |
- c.Assert(strings.ToLower(out), checker.Contains, "not found") |
|
| 52 |
+ assert.Assert(c, strings.ToLower(out), checker.Contains, "not found") |
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
|
| 56 | 56 |
testRequires(c, DaemonIsLinux) |
| 57 | 57 |
|
| 58 | 58 |
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps") |
| 59 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictContainerNetworkAndLinks.Error()) |
|
| 59 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndLinks.Error()) |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *check.C) {
|
| 63 | 63 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 64 | 64 |
|
| 65 | 65 |
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps") |
| 66 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 66 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *check.C) {
|
| 70 | 70 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 71 | 71 |
|
| 72 | 72 |
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps") |
| 73 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 73 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *check.C) {
|
| 77 | 77 |
testRequires(c, DaemonIsLinux) |
| 78 | 78 |
|
| 79 | 79 |
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps") |
| 80 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkAndDNS.Error()) |
|
| 80 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkAndDNS.Error()) |
|
| 81 | 81 |
|
| 82 | 82 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--add-host=name:8.8.8.8", "busybox", "ps") |
| 83 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkHosts.Error()) |
|
| 83 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkHosts.Error()) |
|
| 84 | 84 |
|
| 85 | 85 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps") |
| 86 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 86 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 87 | 87 |
|
| 88 | 88 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-P", "busybox", "ps") |
| 89 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 89 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 90 | 90 |
|
| 91 | 91 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-p", "8080", "busybox", "ps") |
| 92 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 92 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 93 | 93 |
|
| 94 | 94 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--expose", "8000-9000", "busybox", "ps") |
| 95 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkExposePorts.Error()) |
|
| 95 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkExposePorts.Error()) |
|
| 96 | 96 |
} |
| ... | ... |
@@ -64,7 +64,7 @@ func (s *DockerNetworkSuite) TearDownTest(c *check.C) {
|
| 64 | 64 |
func (s *DockerNetworkSuite) SetUpSuite(c *check.C) {
|
| 65 | 65 |
mux := http.NewServeMux() |
| 66 | 66 |
s.server = httptest.NewServer(mux) |
| 67 |
- c.Assert(s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
|
| 67 |
+ assert.Assert(c, s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
|
| 68 | 68 |
setupRemoteNetworkDrivers(c, mux, s.server.URL, dummyNetworkDriver, dummyIPAMDriver) |
| 69 | 69 |
} |
| 70 | 70 |
|
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *check.C) {
|
| 304 | 304 |
id := strings.TrimSpace(out) |
| 305 | 305 |
assert.NilError(c, waitRun(id)) |
| 306 | 306 |
out, _ = dockerCmd(c, "ps") |
| 307 |
- c.Assert(out, checker.Contains, "192.168.10.1:5000->5000/tcp") |
|
| 307 |
+ assert.Assert(c, out, checker.Contains, "192.168.10.1:5000->5000/tcp") |
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) {
|
| ... | ... |
@@ -360,7 +360,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
|
| 360 | 360 |
|
| 361 | 361 |
out, _ = dockerCmd(c, "network", "ls", "-f", "label=nonexistent") |
| 362 | 362 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 363 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("%s\n", out))
|
|
| 363 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("%s\n", out))
|
|
| 364 | 364 |
|
| 365 | 365 |
out, _ = dockerCmd(c, "network", "ls", "-f", "driver=null") |
| 366 | 366 |
assertNwList(c, out, []string{"none"})
|
| ... | ... |
@@ -390,7 +390,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *check.C) {
|
| 390 | 390 |
|
| 391 | 391 |
out, _, err := dockerCmdWithError("network", "inspect", "--format={{ .Labels."+testLabel+" }}", testNet)
|
| 392 | 392 |
assert.NilError(c, err) |
| 393 |
- c.Assert(strings.TrimSpace(out), check.Equals, testValue) |
|
| 393 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, testValue) |
|
| 394 | 394 |
|
| 395 | 395 |
dockerCmd(c, "network", "rm", testNet) |
| 396 | 396 |
assertNwNotAvailable(c, testNet) |
| ... | ... |
@@ -416,9 +416,9 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) {
|
| 416 | 416 |
// contains active container, its deletion should fail. |
| 417 | 417 |
out, _, err := dockerCmdWithError("network", "rm", "testDelMulti0", "testDelMulti1", "testDelMulti2")
|
| 418 | 418 |
// err should not be nil due to deleting testDelMulti2 failed. |
| 419 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 419 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 420 | 420 |
// testDelMulti2 should fail due to network has active endpoints |
| 421 |
- c.Assert(out, checker.Contains, "has active endpoints") |
|
| 421 |
+ assert.Assert(c, out, checker.Contains, "has active endpoints") |
|
| 422 | 422 |
assertNwNotAvailable(c, "testDelMulti0") |
| 423 | 423 |
assertNwNotAvailable(c, "testDelMulti1") |
| 424 | 424 |
// testDelMulti2 can't be deleted, so it should exist |
| ... | ... |
@@ -433,7 +433,7 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
|
| 433 | 433 |
assert.Equal(c, len(networkResources), 1) |
| 434 | 434 |
|
| 435 | 435 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Name }}", "host")
|
| 436 |
- c.Assert(strings.TrimSpace(out), check.Equals, "host") |
|
| 436 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "host") |
|
| 437 | 437 |
} |
| 438 | 438 |
|
| 439 | 439 |
func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) {
|
| ... | ... |
@@ -441,10 +441,10 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) {
|
| 441 | 441 |
networkID := strings.TrimSpace(out) |
| 442 | 442 |
assertNwIsAvailable(c, "test2") |
| 443 | 443 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Id }}", "test2")
|
| 444 |
- c.Assert(strings.TrimSpace(out), check.Equals, networkID) |
|
| 444 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, networkID) |
|
| 445 | 445 |
|
| 446 | 446 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .ID }}", "test2")
|
| 447 |
- c.Assert(strings.TrimSpace(out), check.Equals, networkID) |
|
| 447 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, networkID) |
|
| 448 | 448 |
} |
| 449 | 449 |
|
| 450 | 450 |
func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
|
| ... | ... |
@@ -505,7 +505,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
| 505 | 505 |
}() |
| 506 | 506 |
|
| 507 | 507 |
out, _ := dockerCmd(c, "run", "-d", "--name", "testNetInspect1", "--net", "brNetForInspect", "busybox", "top") |
| 508 |
- c.Assert(waitRun("testNetInspect1"), check.IsNil)
|
|
| 508 |
+ assert.Assert(c, waitRun("testNetInspect1"), check.IsNil)
|
|
| 509 | 509 |
containerID := strings.TrimSpace(out) |
| 510 | 510 |
defer func() {
|
| 511 | 511 |
// we don't stop container by name, because we'll rename it later |
| ... | ... |
@@ -530,7 +530,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
| 530 | 530 |
var newNetRes []types.NetworkResource |
| 531 | 531 |
err = json.Unmarshal([]byte(out), &newNetRes) |
| 532 | 532 |
assert.NilError(c, err) |
| 533 |
- c.Assert(newNetRes, checker.HasLen, 1) |
|
| 533 |
+ assert.Assert(c, newNetRes, checker.HasLen, 1) |
|
| 534 | 534 |
container1, ok := newNetRes[0].Containers[containerID] |
| 535 | 535 |
assert.Assert(c, ok) |
| 536 | 536 |
assert.Equal(c, container1.Name, newName) |
| ... | ... |
@@ -541,12 +541,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) {
|
| 541 | 541 |
assertNwIsAvailable(c, "test") |
| 542 | 542 |
nr := getNwResource(c, "test") |
| 543 | 543 |
|
| 544 |
- c.Assert(nr.Name, checker.Equals, "test") |
|
| 545 |
- c.Assert(len(nr.Containers), checker.Equals, 0) |
|
| 544 |
+ assert.Assert(c, nr.Name, checker.Equals, "test") |
|
| 545 |
+ assert.Assert(c, len(nr.Containers), checker.Equals, 0) |
|
| 546 | 546 |
|
| 547 | 547 |
// run a container |
| 548 | 548 |
out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top") |
| 549 |
- c.Assert(waitRun("test"), check.IsNil)
|
|
| 549 |
+ assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 550 | 550 |
containerID := strings.TrimSpace(out) |
| 551 | 551 |
|
| 552 | 552 |
// connect the container to the test network |
| ... | ... |
@@ -554,35 +554,35 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) {
|
| 554 | 554 |
|
| 555 | 555 |
// inspect the network to make sure container is connected |
| 556 | 556 |
nr = getNetworkResource(c, nr.ID) |
| 557 |
- c.Assert(len(nr.Containers), checker.Equals, 1) |
|
| 557 |
+ assert.Assert(c, len(nr.Containers), checker.Equals, 1) |
|
| 558 | 558 |
|
| 559 | 559 |
// check if container IP matches network inspect |
| 560 | 560 |
ip, _, err := net.ParseCIDR(nr.Containers[containerID].IPv4Address) |
| 561 | 561 |
assert.NilError(c, err) |
| 562 | 562 |
containerIP := findContainerIP(c, "test", "test") |
| 563 |
- c.Assert(ip.String(), checker.Equals, containerIP) |
|
| 563 |
+ assert.Assert(c, ip.String(), checker.Equals, containerIP) |
|
| 564 | 564 |
|
| 565 | 565 |
// disconnect container from the network |
| 566 | 566 |
dockerCmd(c, "network", "disconnect", "test", containerID) |
| 567 | 567 |
nr = getNwResource(c, "test") |
| 568 |
- c.Assert(nr.Name, checker.Equals, "test") |
|
| 569 |
- c.Assert(len(nr.Containers), checker.Equals, 0) |
|
| 568 |
+ assert.Assert(c, nr.Name, checker.Equals, "test") |
|
| 569 |
+ assert.Assert(c, len(nr.Containers), checker.Equals, 0) |
|
| 570 | 570 |
|
| 571 | 571 |
// run another container |
| 572 | 572 |
out, _ = dockerCmd(c, "run", "-d", "--net", "test", "--name", "test2", "busybox", "top") |
| 573 |
- c.Assert(waitRun("test2"), check.IsNil)
|
|
| 573 |
+ assert.Assert(c, waitRun("test2"), check.IsNil)
|
|
| 574 | 574 |
containerID = strings.TrimSpace(out) |
| 575 | 575 |
|
| 576 | 576 |
nr = getNwResource(c, "test") |
| 577 |
- c.Assert(nr.Name, checker.Equals, "test") |
|
| 578 |
- c.Assert(len(nr.Containers), checker.Equals, 1) |
|
| 577 |
+ assert.Assert(c, nr.Name, checker.Equals, "test") |
|
| 578 |
+ assert.Assert(c, len(nr.Containers), checker.Equals, 1) |
|
| 579 | 579 |
|
| 580 | 580 |
// force disconnect the container to the test network |
| 581 | 581 |
dockerCmd(c, "network", "disconnect", "-f", "test", containerID) |
| 582 | 582 |
|
| 583 | 583 |
nr = getNwResource(c, "test") |
| 584 |
- c.Assert(nr.Name, checker.Equals, "test") |
|
| 585 |
- c.Assert(len(nr.Containers), checker.Equals, 0) |
|
| 584 |
+ assert.Assert(c, nr.Name, checker.Equals, "test") |
|
| 585 |
+ assert.Assert(c, len(nr.Containers), checker.Equals, 0) |
|
| 586 | 586 |
|
| 587 | 587 |
dockerCmd(c, "network", "rm", "test") |
| 588 | 588 |
assertNwNotAvailable(c, "test") |
| ... | ... |
@@ -637,8 +637,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkCustomIPAM(c *check.C) {
|
| 637 | 637 |
|
| 638 | 638 |
// Verify expected network ipam fields are there |
| 639 | 639 |
nr := getNetworkResource(c, "br0") |
| 640 |
- c.Assert(nr.Driver, checker.Equals, "bridge") |
|
| 641 |
- c.Assert(nr.IPAM.Driver, checker.Equals, dummyIPAMDriver) |
|
| 640 |
+ assert.Assert(c, nr.Driver, checker.Equals, "bridge") |
|
| 641 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, dummyIPAMDriver) |
|
| 642 | 642 |
|
| 643 | 643 |
// remove network and exercise remote ipam driver |
| 644 | 644 |
dockerCmd(c, "network", "rm", "br0") |
| ... | ... |
@@ -654,8 +654,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkIPAMOptions(c *check.C) {
|
| 654 | 654 |
// Verify expected network ipam options |
| 655 | 655 |
nr := getNetworkResource(c, "br0") |
| 656 | 656 |
opts := nr.IPAM.Options |
| 657 |
- c.Assert(opts["opt1"], checker.Equals, "drv1") |
|
| 658 |
- c.Assert(opts["opt2"], checker.Equals, "drv2") |
|
| 657 |
+ assert.Assert(c, opts["opt1"], checker.Equals, "drv1") |
|
| 658 |
+ assert.Assert(c, opts["opt2"], checker.Equals, "drv2") |
|
| 659 | 659 |
} |
| 660 | 660 |
|
| 661 | 661 |
func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *check.C) {
|
| ... | ... |
@@ -668,36 +668,36 @@ func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *check.C) {
|
| 668 | 668 |
// Verify the inspect data contains the default subnet provided by the null |
| 669 | 669 |
// ipam driver and no gateway, as the null ipam driver does not provide one |
| 670 | 670 |
nr := getNetworkResource(c, "test000") |
| 671 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "null") |
|
| 672 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 1) |
|
| 673 |
- c.Assert(nr.IPAM.Config[0].Subnet, checker.Equals, "0.0.0.0/0") |
|
| 674 |
- c.Assert(nr.IPAM.Config[0].Gateway, checker.Equals, "") |
|
| 671 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "null") |
|
| 672 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 1) |
|
| 673 |
+ assert.Assert(c, nr.IPAM.Config[0].Subnet, checker.Equals, "0.0.0.0/0") |
|
| 674 |
+ assert.Assert(c, nr.IPAM.Config[0].Gateway, checker.Equals, "") |
|
| 675 | 675 |
} |
| 676 | 676 |
|
| 677 | 677 |
func (s *DockerNetworkSuite) TestDockerNetworkInspectDefault(c *check.C) {
|
| 678 | 678 |
nr := getNetworkResource(c, "none") |
| 679 |
- c.Assert(nr.Driver, checker.Equals, "null") |
|
| 680 |
- c.Assert(nr.Scope, checker.Equals, "local") |
|
| 681 |
- c.Assert(nr.Internal, checker.Equals, false) |
|
| 682 |
- c.Assert(nr.EnableIPv6, checker.Equals, false) |
|
| 683 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "default") |
|
| 684 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 0) |
|
| 679 |
+ assert.Assert(c, nr.Driver, checker.Equals, "null") |
|
| 680 |
+ assert.Assert(c, nr.Scope, checker.Equals, "local") |
|
| 681 |
+ assert.Assert(c, nr.Internal, checker.Equals, false) |
|
| 682 |
+ assert.Assert(c, nr.EnableIPv6, checker.Equals, false) |
|
| 683 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "default") |
|
| 684 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 0) |
|
| 685 | 685 |
|
| 686 | 686 |
nr = getNetworkResource(c, "host") |
| 687 |
- c.Assert(nr.Driver, checker.Equals, "host") |
|
| 688 |
- c.Assert(nr.Scope, checker.Equals, "local") |
|
| 689 |
- c.Assert(nr.Internal, checker.Equals, false) |
|
| 690 |
- c.Assert(nr.EnableIPv6, checker.Equals, false) |
|
| 691 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "default") |
|
| 692 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 0) |
|
| 687 |
+ assert.Assert(c, nr.Driver, checker.Equals, "host") |
|
| 688 |
+ assert.Assert(c, nr.Scope, checker.Equals, "local") |
|
| 689 |
+ assert.Assert(c, nr.Internal, checker.Equals, false) |
|
| 690 |
+ assert.Assert(c, nr.EnableIPv6, checker.Equals, false) |
|
| 691 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "default") |
|
| 692 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 0) |
|
| 693 | 693 |
|
| 694 | 694 |
nr = getNetworkResource(c, "bridge") |
| 695 |
- c.Assert(nr.Driver, checker.Equals, "bridge") |
|
| 696 |
- c.Assert(nr.Scope, checker.Equals, "local") |
|
| 697 |
- c.Assert(nr.Internal, checker.Equals, false) |
|
| 698 |
- c.Assert(nr.EnableIPv6, checker.Equals, false) |
|
| 699 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "default") |
|
| 700 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 1) |
|
| 695 |
+ assert.Assert(c, nr.Driver, checker.Equals, "bridge") |
|
| 696 |
+ assert.Assert(c, nr.Scope, checker.Equals, "local") |
|
| 697 |
+ assert.Assert(c, nr.Internal, checker.Equals, false) |
|
| 698 |
+ assert.Assert(c, nr.EnableIPv6, checker.Equals, false) |
|
| 699 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "default") |
|
| 700 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 1) |
|
| 701 | 701 |
} |
| 702 | 702 |
|
| 703 | 703 |
func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomUnspecified(c *check.C) {
|
| ... | ... |
@@ -706,12 +706,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomUnspecified(c *check. |
| 706 | 706 |
assertNwIsAvailable(c, "test01") |
| 707 | 707 |
|
| 708 | 708 |
nr := getNetworkResource(c, "test01") |
| 709 |
- c.Assert(nr.Driver, checker.Equals, "bridge") |
|
| 710 |
- c.Assert(nr.Scope, checker.Equals, "local") |
|
| 711 |
- c.Assert(nr.Internal, checker.Equals, false) |
|
| 712 |
- c.Assert(nr.EnableIPv6, checker.Equals, false) |
|
| 713 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "default") |
|
| 714 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 1) |
|
| 709 |
+ assert.Assert(c, nr.Driver, checker.Equals, "bridge") |
|
| 710 |
+ assert.Assert(c, nr.Scope, checker.Equals, "local") |
|
| 711 |
+ assert.Assert(c, nr.Internal, checker.Equals, false) |
|
| 712 |
+ assert.Assert(c, nr.EnableIPv6, checker.Equals, false) |
|
| 713 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "default") |
|
| 714 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 1) |
|
| 715 | 715 |
|
| 716 | 716 |
dockerCmd(c, "network", "rm", "test01") |
| 717 | 717 |
assertNwNotAvailable(c, "test01") |
| ... | ... |
@@ -722,15 +722,15 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *check.C) |
| 722 | 722 |
assertNwIsAvailable(c, "br0") |
| 723 | 723 |
|
| 724 | 724 |
nr := getNetworkResource(c, "br0") |
| 725 |
- c.Assert(nr.Driver, checker.Equals, "bridge") |
|
| 726 |
- c.Assert(nr.Scope, checker.Equals, "local") |
|
| 727 |
- c.Assert(nr.Internal, checker.Equals, false) |
|
| 728 |
- c.Assert(nr.EnableIPv6, checker.Equals, true) |
|
| 729 |
- c.Assert(nr.IPAM.Driver, checker.Equals, "default") |
|
| 730 |
- c.Assert(len(nr.IPAM.Config), checker.Equals, 2) |
|
| 731 |
- c.Assert(nr.IPAM.Config[0].Subnet, checker.Equals, "172.28.0.0/16") |
|
| 732 |
- c.Assert(nr.IPAM.Config[0].IPRange, checker.Equals, "172.28.5.0/24") |
|
| 733 |
- c.Assert(nr.IPAM.Config[0].Gateway, checker.Equals, "172.28.5.254") |
|
| 725 |
+ assert.Assert(c, nr.Driver, checker.Equals, "bridge") |
|
| 726 |
+ assert.Assert(c, nr.Scope, checker.Equals, "local") |
|
| 727 |
+ assert.Assert(c, nr.Internal, checker.Equals, false) |
|
| 728 |
+ assert.Assert(c, nr.EnableIPv6, checker.Equals, true) |
|
| 729 |
+ assert.Assert(c, nr.IPAM.Driver, checker.Equals, "default") |
|
| 730 |
+ assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 2) |
|
| 731 |
+ assert.Assert(c, nr.IPAM.Config[0].Subnet, checker.Equals, "172.28.0.0/16") |
|
| 732 |
+ assert.Assert(c, nr.IPAM.Config[0].IPRange, checker.Equals, "172.28.5.0/24") |
|
| 733 |
+ assert.Assert(c, nr.IPAM.Config[0].Gateway, checker.Equals, "172.28.5.254") |
|
| 734 | 734 |
assert.Equal(c, nr.Internal, false) |
| 735 | 735 |
dockerCmd(c, "network", "rm", "br0") |
| 736 | 736 |
assertNwNotAvailable(c, "br0") |
| ... | ... |
@@ -765,11 +765,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *check.C) {
|
| 765 | 765 |
dockerCmd(c, "network", "create", "-d", dummyNetworkDriver, "-o", "opt1=drv1", "-o", "opt2=drv2", "testopt") |
| 766 | 766 |
assertNwIsAvailable(c, "testopt") |
| 767 | 767 |
gopts := remoteDriverNetworkRequest.Options[netlabel.GenericData] |
| 768 |
- c.Assert(gopts, checker.NotNil) |
|
| 768 |
+ assert.Assert(c, gopts, checker.NotNil) |
|
| 769 | 769 |
opts, ok := gopts.(map[string]interface{})
|
| 770 |
- c.Assert(ok, checker.Equals, true) |
|
| 771 |
- c.Assert(opts["opt1"], checker.Equals, "drv1") |
|
| 772 |
- c.Assert(opts["opt2"], checker.Equals, "drv2") |
|
| 770 |
+ assert.Assert(c, ok, checker.Equals, true) |
|
| 771 |
+ assert.Assert(c, opts["opt1"], checker.Equals, "drv1") |
|
| 772 |
+ assert.Assert(c, opts["opt2"], checker.Equals, "drv2") |
|
| 773 | 773 |
dockerCmd(c, "network", "rm", "testopt") |
| 774 | 774 |
assertNwNotAvailable(c, "testopt") |
| 775 | 775 |
|
| ... | ... |
@@ -788,9 +788,9 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) {
|
| 788 | 788 |
|
| 789 | 789 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 790 | 790 |
assert.NilError(c, err) |
| 791 |
- c.Assert(out, checker.Contains, npName) |
|
| 792 |
- c.Assert(out, checker.Contains, npTag) |
|
| 793 |
- c.Assert(out, checker.Contains, "true") |
|
| 791 |
+ assert.Assert(c, out, checker.Contains, npName) |
|
| 792 |
+ assert.Assert(c, out, checker.Contains, npTag) |
|
| 793 |
+ assert.Assert(c, out, checker.Contains, "true") |
|
| 794 | 794 |
|
| 795 | 795 |
dockerCmd(c, "network", "create", "-d", npNameWithTag, "v2net") |
| 796 | 796 |
assertNwIsAvailable(c, "v2net") |
| ... | ... |
@@ -826,14 +826,14 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 826 | 826 |
// verify first container's etc/hosts file has not changed after spawning the second named container |
| 827 | 827 |
hostsPost, err := s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 828 | 828 |
assert.NilError(c, err) |
| 829 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 829 |
+ assert.Assert(c, string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 830 | 830 |
// stop container 2 and verify first container's etc/hosts has not changed |
| 831 | 831 |
_, err = s.d.Cmd("stop", cid2)
|
| 832 | 832 |
assert.NilError(c, err) |
| 833 | 833 |
|
| 834 | 834 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 835 | 835 |
assert.NilError(c, err) |
| 836 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 836 |
+ assert.Assert(c, string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second container creation", hostsFile))
|
|
| 837 | 837 |
// but discovery is on when connecting to non default bridge network |
| 838 | 838 |
network := "anotherbridge" |
| 839 | 839 |
out, err = s.d.Cmd("network", "create", network)
|
| ... | ... |
@@ -848,7 +848,7 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * |
| 848 | 848 |
|
| 849 | 849 |
hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
|
| 850 | 850 |
assert.NilError(c, err) |
| 851 |
- c.Assert(string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile))
|
|
| 851 |
+ assert.Assert(c, string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile))
|
|
| 852 | 852 |
} |
| 853 | 853 |
|
| 854 | 854 |
func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| ... | ... |
@@ -871,7 +871,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 871 | 871 |
|
| 872 | 872 |
// verify first container etc/hosts file has not changed |
| 873 | 873 |
hosts1post := readContainerFileWithExec(c, cid1, hostsFile) |
| 874 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 874 |
+ assert.Assert(c, string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on anonymous container creation", hostsFile))
|
|
| 875 | 875 |
// Connect the 2nd container to a new network and verify the |
| 876 | 876 |
// first container /etc/hosts file still hasn't changed. |
| 877 | 877 |
dockerCmd(c, "network", "create", "-d", "bridge", cstmBridgeNw1) |
| ... | ... |
@@ -881,7 +881,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 881 | 881 |
|
| 882 | 882 |
hosts2 := readContainerFileWithExec(c, cid2, hostsFile) |
| 883 | 883 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 884 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on container connect", hostsFile))
|
|
| 884 |
+ assert.Assert(c, string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on container connect", hostsFile))
|
|
| 885 | 885 |
// start a named container |
| 886 | 886 |
cName := "AnyName" |
| 887 | 887 |
out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "--name", cName, "busybox", "top") |
| ... | ... |
@@ -894,9 +894,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
|
| 894 | 894 |
// Stop named container and verify first two containers' etc/hosts file hasn't changed |
| 895 | 895 |
dockerCmd(c, "stop", cid3) |
| 896 | 896 |
hosts1post = readContainerFileWithExec(c, cid1, hostsFile) |
| 897 |
- c.Assert(string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 897 |
+ assert.Assert(c, string(hosts1), checker.Equals, string(hosts1post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 898 | 898 |
hosts2post := readContainerFileWithExec(c, cid2, hostsFile) |
| 899 |
- c.Assert(string(hosts2), checker.Equals, string(hosts2post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 899 |
+ assert.Assert(c, string(hosts2), checker.Equals, string(hosts2post), check.Commentf("Unexpected %s change on name container creation", hostsFile))
|
|
| 900 | 900 |
// verify that container 1 and 2 can't ping the named container now |
| 901 | 901 |
_, _, err := dockerCmdWithError("exec", cid1, "ping", "-c", "1", cName)
|
| 902 | 902 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -952,9 +952,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *check.C) {
|
| 952 | 952 |
unpPort2 := fmt.Sprintf("%d/tcp", port2)
|
| 953 | 953 |
out, _ := dockerCmd(c, "ps", "-n=1") |
| 954 | 954 |
// Missing unpublished ports in docker ps output |
| 955 |
- c.Assert(out, checker.Contains, unpPort1) |
|
| 955 |
+ assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 956 | 956 |
// Missing unpublished ports in docker ps output |
| 957 |
- c.Assert(out, checker.Contains, unpPort2) |
|
| 957 |
+ assert.Assert(c, out, checker.Contains, unpPort2) |
|
| 958 | 958 |
} |
| 959 | 959 |
|
| 960 | 960 |
func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C) {
|
| ... | ... |
@@ -974,7 +974,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C |
| 974 | 974 |
assert.NilError(c, err) |
| 975 | 975 |
|
| 976 | 976 |
// Kill daemon and restart |
| 977 |
- c.Assert(s.d.Kill(), checker.IsNil) |
|
| 977 |
+ assert.Assert(c, s.d.Kill(), checker.IsNil) |
|
| 978 | 978 |
|
| 979 | 979 |
server.Close() |
| 980 | 980 |
|
| ... | ... |
@@ -1010,7 +1010,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *check.C) {
|
| 1010 | 1010 |
dockerCmd(c, "run", "-d", "--net", nwn, "--name", ctn, "busybox", "top") |
| 1011 | 1011 |
|
| 1012 | 1012 |
mac := inspectField(c, ctn, "NetworkSettings.Networks."+nwn+".MacAddress") |
| 1013 |
- c.Assert(mac, checker.Equals, "a0:b1:c2:d3:e4:f5") |
|
| 1013 |
+ assert.Assert(c, mac, checker.Equals, "a0:b1:c2:d3:e4:f5") |
|
| 1014 | 1014 |
} |
| 1015 | 1015 |
|
| 1016 | 1016 |
func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
|
| ... | ... |
@@ -1034,11 +1034,11 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
|
| 1034 | 1034 |
var inspect121 types.ContainerJSON |
| 1035 | 1035 |
err = json.Unmarshal(body, &inspect121) |
| 1036 | 1036 |
assert.NilError(c, err) |
| 1037 |
- c.Assert(inspect121.NetworkSettings.Networks, checker.HasLen, 3) |
|
| 1037 |
+ assert.Assert(c, inspect121.NetworkSettings.Networks, checker.HasLen, 3) |
|
| 1038 | 1038 |
|
| 1039 | 1039 |
bridge := inspect121.NetworkSettings.Networks["bridge"] |
| 1040 |
- c.Assert(bridge.IPAddress, checker.Equals, versionedIP) |
|
| 1041 |
- c.Assert(bridge.IPAddress, checker.Equals, inspect121.NetworkSettings.IPAddress) |
|
| 1040 |
+ assert.Assert(c, bridge.IPAddress, checker.Equals, versionedIP) |
|
| 1041 |
+ assert.Assert(c, bridge.IPAddress, checker.Equals, inspect121.NetworkSettings.IPAddress) |
|
| 1042 | 1042 |
} |
| 1043 | 1043 |
|
| 1044 | 1044 |
func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) {
|
| ... | ... |
@@ -1060,7 +1060,7 @@ func verifyContainerIsConnectedToNetworks(c *check.C, d *daemon.Daemon, cName st |
| 1060 | 1060 |
for _, nw := range nws {
|
| 1061 | 1061 |
out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName)
|
| 1062 | 1062 |
assert.NilError(c, err, out) |
| 1063 |
- c.Assert(out, checker.Not(checker.Equals), "<no value>\n") |
|
| 1063 |
+ assert.Assert(c, out, checker.Not(checker.Equals), "<no value>\n") |
|
| 1064 | 1064 |
} |
| 1065 | 1065 |
} |
| 1066 | 1066 |
|
| ... | ... |
@@ -1094,7 +1094,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRe |
| 1094 | 1094 |
verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList) |
| 1095 | 1095 |
|
| 1096 | 1096 |
// Kill daemon and restart |
| 1097 |
- c.Assert(s.d.Kill(), checker.IsNil) |
|
| 1097 |
+ assert.Assert(c, s.d.Kill(), checker.IsNil) |
|
| 1098 | 1098 |
s.d.Restart(c) |
| 1099 | 1099 |
|
| 1100 | 1100 |
// Restart container |
| ... | ... |
@@ -1107,7 +1107,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRe |
| 1107 | 1107 |
func (s *DockerNetworkSuite) TestDockerNetworkRunNetByID(c *check.C) {
|
| 1108 | 1108 |
out, _ := dockerCmd(c, "network", "create", "one") |
| 1109 | 1109 |
containerOut, _, err := dockerCmdWithError("run", "-d", "--net", strings.TrimSpace(out), "busybox", "top")
|
| 1110 |
- c.Assert(err, checker.IsNil, check.Commentf(containerOut)) |
|
| 1110 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf(containerOut)) |
|
| 1111 | 1111 |
} |
| 1112 | 1112 |
|
| 1113 | 1113 |
func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c *check.C) {
|
| ... | ... |
@@ -1126,7 +1126,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c |
| 1126 | 1126 |
} |
| 1127 | 1127 |
|
| 1128 | 1128 |
// Kill daemon ungracefully and restart |
| 1129 |
- c.Assert(s.d.Kill(), checker.IsNil) |
|
| 1129 |
+ assert.Assert(c, s.d.Kill(), checker.IsNil) |
|
| 1130 | 1130 |
s.d.Restart(c) |
| 1131 | 1131 |
|
| 1132 | 1132 |
// make sure all the containers are up and running |
| ... | ... |
@@ -1138,35 +1138,35 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c |
| 1138 | 1138 |
|
| 1139 | 1139 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *check.C) {
|
| 1140 | 1140 |
dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") |
| 1141 |
- c.Assert(waitRun("container1"), check.IsNil)
|
|
| 1141 |
+ assert.Assert(c, waitRun("container1"), check.IsNil)
|
|
| 1142 | 1142 |
dockerCmd(c, "network", "disconnect", "bridge", "container1") |
| 1143 | 1143 |
out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
|
| 1144 | 1144 |
assert.ErrorContains(c, err, "", out) |
| 1145 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1145 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1146 | 1146 |
} |
| 1147 | 1147 |
|
| 1148 | 1148 |
func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *check.C) {
|
| 1149 | 1149 |
dockerCmd(c, "run", "-d", "--name", "container1", "--net=host", "busybox", "top") |
| 1150 |
- c.Assert(waitRun("container1"), check.IsNil)
|
|
| 1150 |
+ assert.Assert(c, waitRun("container1"), check.IsNil)
|
|
| 1151 | 1151 |
out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1")
|
| 1152 |
- c.Assert(err, checker.NotNil, check.Commentf("Should err out disconnect from host"))
|
|
| 1153 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1152 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Should err out disconnect from host"))
|
|
| 1153 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1154 | 1154 |
} |
| 1155 | 1155 |
|
| 1156 | 1156 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *check.C) {
|
| 1157 | 1157 |
testRequires(c, NotArm) |
| 1158 | 1158 |
dockerCmd(c, "network", "create", "test1") |
| 1159 | 1159 |
dockerCmd(c, "run", "-d", "--name", "c1", "-p", "5000:5000", "busybox", "top") |
| 1160 |
- c.Assert(waitRun("c1"), check.IsNil)
|
|
| 1160 |
+ assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 1161 | 1161 |
dockerCmd(c, "network", "connect", "test1", "c1") |
| 1162 | 1162 |
} |
| 1163 | 1163 |
|
| 1164 | 1164 |
func verifyPortMap(c *check.C, container, port, originalMapping string, mustBeEqual bool) {
|
| 1165 | 1165 |
currentMapping, _ := dockerCmd(c, "port", container, port) |
| 1166 | 1166 |
if mustBeEqual {
|
| 1167 |
- c.Assert(currentMapping, checker.Equals, originalMapping) |
|
| 1167 |
+ assert.Assert(c, currentMapping, checker.Equals, originalMapping) |
|
| 1168 | 1168 |
} else {
|
| 1169 |
- c.Assert(currentMapping, checker.Not(checker.Equals), originalMapping) |
|
| 1169 |
+ assert.Assert(c, currentMapping, checker.Not(checker.Equals), originalMapping) |
|
| 1170 | 1170 |
} |
| 1171 | 1171 |
} |
| 1172 | 1172 |
|
| ... | ... |
@@ -1181,7 +1181,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectWithPortMapping(c |
| 1181 | 1181 |
dockerCmd(c, "network", "create", "ccc") |
| 1182 | 1182 |
|
| 1183 | 1183 |
dockerCmd(c, "run", "-d", "--name", cnt, "-p", "9000:90", "-p", "70", "busybox", "top") |
| 1184 |
- c.Assert(waitRun(cnt), check.IsNil) |
|
| 1184 |
+ assert.Assert(c, waitRun(cnt), check.IsNil) |
|
| 1185 | 1185 |
curPortMap, _ := dockerCmd(c, "port", cnt, "70") |
| 1186 | 1186 |
curExplPortMap, _ := dockerCmd(c, "port", cnt, "90") |
| 1187 | 1187 |
|
| ... | ... |
@@ -1211,29 +1211,29 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *check.C) {
|
| 1211 | 1211 |
macAddress := "02:42:ac:11:00:02" |
| 1212 | 1212 |
dockerCmd(c, "network", "create", "mynetwork") |
| 1213 | 1213 |
dockerCmd(c, "run", "--name=test", "-d", "--mac-address", macAddress, "busybox", "top") |
| 1214 |
- c.Assert(waitRun("test"), check.IsNil)
|
|
| 1214 |
+ assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 1215 | 1215 |
mac1 := inspectField(c, "test", "NetworkSettings.Networks.bridge.MacAddress") |
| 1216 |
- c.Assert(strings.TrimSpace(mac1), checker.Equals, macAddress) |
|
| 1216 |
+ assert.Assert(c, strings.TrimSpace(mac1), checker.Equals, macAddress) |
|
| 1217 | 1217 |
dockerCmd(c, "network", "connect", "mynetwork", "test") |
| 1218 | 1218 |
mac2 := inspectField(c, "test", "NetworkSettings.Networks.mynetwork.MacAddress") |
| 1219 |
- c.Assert(strings.TrimSpace(mac2), checker.Not(checker.Equals), strings.TrimSpace(mac1)) |
|
| 1219 |
+ assert.Assert(c, strings.TrimSpace(mac2), checker.Not(checker.Equals), strings.TrimSpace(mac1)) |
|
| 1220 | 1220 |
} |
| 1221 | 1221 |
|
| 1222 | 1222 |
func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *check.C) {
|
| 1223 | 1223 |
dockerCmd(c, "create", "--name", "test", "busybox") |
| 1224 | 1224 |
networks := inspectField(c, "test", "NetworkSettings.Networks") |
| 1225 |
- c.Assert(networks, checker.Contains, "bridge", check.Commentf("Should return 'bridge' network"))
|
|
| 1225 |
+ assert.Assert(c, networks, checker.Contains, "bridge", check.Commentf("Should return 'bridge' network"))
|
|
| 1226 | 1226 |
} |
| 1227 | 1227 |
|
| 1228 | 1228 |
func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *check.C) {
|
| 1229 | 1229 |
dockerCmd(c, "network", "create", "test") |
| 1230 | 1230 |
dockerCmd(c, "run", "--name=foo", "-d", "busybox", "top") |
| 1231 |
- c.Assert(waitRun("foo"), checker.IsNil)
|
|
| 1231 |
+ assert.Assert(c, waitRun("foo"), checker.IsNil)
|
|
| 1232 | 1232 |
dockerCmd(c, "network", "connect", "test", "foo") |
| 1233 | 1233 |
dockerCmd(c, "restart", "foo") |
| 1234 | 1234 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1235 |
- c.Assert(networks, checker.Contains, "bridge", check.Commentf("Should contain 'bridge' network"))
|
|
| 1236 |
- c.Assert(networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1235 |
+ assert.Assert(c, networks, checker.Contains, "bridge", check.Commentf("Should contain 'bridge' network"))
|
|
| 1236 |
+ assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1237 | 1237 |
} |
| 1238 | 1238 |
|
| 1239 | 1239 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContainer(c *check.C) {
|
| ... | ... |
@@ -1242,16 +1242,16 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine |
| 1242 | 1242 |
dockerCmd(c, "create", "--name=foo", "busybox", "top") |
| 1243 | 1243 |
dockerCmd(c, "network", "connect", "test", "foo") |
| 1244 | 1244 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1245 |
- c.Assert(networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1245 |
+ assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1246 | 1246 |
|
| 1247 | 1247 |
// Restart docker daemon to test the config has persisted to disk |
| 1248 | 1248 |
s.d.Restart(c) |
| 1249 | 1249 |
networks = inspectField(c, "foo", "NetworkSettings.Networks") |
| 1250 |
- c.Assert(networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1250 |
+ assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1251 | 1251 |
|
| 1252 | 1252 |
// start the container and test if we can ping it from another container in the same network |
| 1253 | 1253 |
dockerCmd(c, "start", "foo") |
| 1254 |
- c.Assert(waitRun("foo"), checker.IsNil)
|
|
| 1254 |
+ assert.Assert(c, waitRun("foo"), checker.IsNil)
|
|
| 1255 | 1255 |
ip := inspectField(c, "foo", "NetworkSettings.Networks.test.IPAddress") |
| 1256 | 1256 |
ip = strings.TrimSpace(ip) |
| 1257 | 1257 |
dockerCmd(c, "run", "--net=test", "busybox", "sh", "-c", fmt.Sprintf("ping -c 1 %s", ip))
|
| ... | ... |
@@ -1261,12 +1261,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine |
| 1261 | 1261 |
// Test disconnect |
| 1262 | 1262 |
dockerCmd(c, "network", "disconnect", "test", "foo") |
| 1263 | 1263 |
networks = inspectField(c, "foo", "NetworkSettings.Networks") |
| 1264 |
- c.Assert(networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1264 |
+ assert.Assert(c, networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1265 | 1265 |
|
| 1266 | 1266 |
// Restart docker daemon to test the config has persisted to disk |
| 1267 | 1267 |
s.d.Restart(c) |
| 1268 | 1268 |
networks = inspectField(c, "foo", "NetworkSettings.Networks") |
| 1269 |
- c.Assert(networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1269 |
+ assert.Assert(c, networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1270 | 1270 |
|
| 1271 | 1271 |
} |
| 1272 | 1272 |
|
| ... | ... |
@@ -1274,7 +1274,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetw |
| 1274 | 1274 |
dockerCmd(c, "network", "create", "test") |
| 1275 | 1275 |
dockerCmd(c, "run", "--net=test", "-d", "--name=foo", "busybox", "top") |
| 1276 | 1276 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1277 |
- c.Assert(networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1277 |
+ assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1278 | 1278 |
|
| 1279 | 1279 |
// Stop container and remove network |
| 1280 | 1280 |
dockerCmd(c, "stop", "foo") |
| ... | ... |
@@ -1283,7 +1283,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetw |
| 1283 | 1283 |
// Test disconnecting stopped container from nonexisting network |
| 1284 | 1284 |
dockerCmd(c, "network", "disconnect", "-f", "test", "foo") |
| 1285 | 1285 |
networks = inspectField(c, "foo", "NetworkSettings.Networks") |
| 1286 |
- c.Assert(networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1286 |
+ assert.Assert(c, networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network"))
|
|
| 1287 | 1287 |
} |
| 1288 | 1288 |
|
| 1289 | 1289 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *check.C) {
|
| ... | ... |
@@ -1296,7 +1296,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *check.C) {
|
| 1296 | 1296 |
|
| 1297 | 1297 |
// run a container on first network specifying the ip addresses |
| 1298 | 1298 |
dockerCmd(c, "run", "-d", "--name", "c0", "--net=n0", "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top") |
| 1299 |
- c.Assert(waitRun("c0"), check.IsNil)
|
|
| 1299 |
+ assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1300 | 1300 |
verifyIPAddressConfig(c, "c0", "n0", "172.28.99.88", "2001:db8:1234::9988") |
| 1301 | 1301 |
verifyIPAddresses(c, "c0", "n0", "172.28.99.88", "2001:db8:1234::9988") |
| 1302 | 1302 |
|
| ... | ... |
@@ -1317,8 +1317,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *check.C) {
|
| 1317 | 1317 |
|
| 1318 | 1318 |
// Still it should fail to connect to the default network with a specified IP (whatever ip) |
| 1319 | 1319 |
out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0")
|
| 1320 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1321 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1320 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1321 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1322 | 1322 |
|
| 1323 | 1323 |
} |
| 1324 | 1324 |
|
| ... | ... |
@@ -1336,7 +1336,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer |
| 1336 | 1336 |
|
| 1337 | 1337 |
// start the container, verify config has not changed and ip addresses are assigned |
| 1338 | 1338 |
dockerCmd(c, "start", "c0") |
| 1339 |
- c.Assert(waitRun("c0"), check.IsNil)
|
|
| 1339 |
+ assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1340 | 1340 |
verifyIPAddressConfig(c, "c0", "n0", "172.30.55.44", "2001:db8:abcd::5544") |
| 1341 | 1341 |
verifyIPAddresses(c, "c0", "n0", "172.30.55.44", "2001:db8:abcd::5544") |
| 1342 | 1342 |
|
| ... | ... |
@@ -1356,12 +1356,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *check.C) |
| 1356 | 1356 |
assertNwIsAvailable(c, "n0") |
| 1357 | 1357 |
|
| 1358 | 1358 |
out, _, err := dockerCmdWithError("run", "-d", "--ip", "172.28.99.88", "--net", "n0", "busybox", "top")
|
| 1359 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1360 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1359 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1360 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1361 | 1361 |
|
| 1362 | 1362 |
out, _, err = dockerCmdWithError("run", "-d", "--ip6", "2001:db8:1234::9988", "--net", "n0", "busybox", "top")
|
| 1363 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1364 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1363 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1364 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1365 | 1365 |
|
| 1366 | 1366 |
dockerCmd(c, "network", "rm", "n0") |
| 1367 | 1367 |
assertNwNotAvailable(c, "n0") |
| ... | ... |
@@ -1369,28 +1369,28 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *check.C) |
| 1369 | 1369 |
|
| 1370 | 1370 |
func checkUnsupportedNetworkAndIP(c *check.C, nwMode string) {
|
| 1371 | 1371 |
out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1372 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1373 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1372 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1373 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1374 | 1374 |
} |
| 1375 | 1375 |
|
| 1376 | 1376 |
func verifyIPAddressConfig(c *check.C, cName, nwname, ipv4, ipv6 string) {
|
| 1377 | 1377 |
if ipv4 != "" {
|
| 1378 | 1378 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAMConfig.IPv4Address", nwname))
|
| 1379 |
- c.Assert(strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1379 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1380 | 1380 |
} |
| 1381 | 1381 |
|
| 1382 | 1382 |
if ipv6 != "" {
|
| 1383 | 1383 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAMConfig.IPv6Address", nwname))
|
| 1384 |
- c.Assert(strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1384 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1385 | 1385 |
} |
| 1386 | 1386 |
} |
| 1387 | 1387 |
|
| 1388 | 1388 |
func verifyIPAddresses(c *check.C, cName, nwname, ipv4, ipv6 string) {
|
| 1389 | 1389 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAddress", nwname))
|
| 1390 |
- c.Assert(strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1390 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1391 | 1391 |
|
| 1392 | 1392 |
out = inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.GlobalIPv6Address", nwname))
|
| 1393 |
- c.Assert(strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1393 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1394 | 1394 |
} |
| 1395 | 1395 |
|
| 1396 | 1396 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) {
|
| ... | ... |
@@ -1406,13 +1406,13 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) {
|
| 1406 | 1406 |
|
| 1407 | 1407 |
// run two containers with link-local ip on the test network |
| 1408 | 1408 |
dockerCmd(c, "run", "-d", "--name", "c0", "--net=n0", "--link-local-ip", "169.254.7.7", "--link-local-ip", "fe80::254:77", "busybox", "top") |
| 1409 |
- c.Assert(waitRun("c0"), check.IsNil)
|
|
| 1409 |
+ assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1410 | 1410 |
dockerCmd(c, "run", "-d", "--name", "c1", "--net=n0", "--link-local-ip", "169.254.8.8", "--link-local-ip", "fe80::254:88", "busybox", "top") |
| 1411 |
- c.Assert(waitRun("c1"), check.IsNil)
|
|
| 1411 |
+ assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 1412 | 1412 |
|
| 1413 | 1413 |
// run a container on the default network and connect it to the test network specifying a link-local address |
| 1414 | 1414 |
dockerCmd(c, "run", "-d", "--name", "c2", "busybox", "top") |
| 1415 |
- c.Assert(waitRun("c2"), check.IsNil)
|
|
| 1415 |
+ assert.Assert(c, waitRun("c2"), check.IsNil)
|
|
| 1416 | 1416 |
dockerCmd(c, "network", "connect", "--link-local-ip", "169.254.9.9", "n0", "c2") |
| 1417 | 1417 |
|
| 1418 | 1418 |
// verify the three containers can ping each other via the link-local addresses |
| ... | ... |
@@ -1446,13 +1446,13 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) {
|
| 1446 | 1446 |
dockerCmd(c, "network", "create", "-d", "bridge", "foo2") |
| 1447 | 1447 |
|
| 1448 | 1448 |
dockerCmd(c, "run", "-d", "--net=foo1", "--name=first", "busybox", "top") |
| 1449 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 1449 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1450 | 1450 |
|
| 1451 | 1451 |
// run a container in a user-defined network with a link for an existing container |
| 1452 | 1452 |
// and a link for a container that doesn't exist |
| 1453 | 1453 |
dockerCmd(c, "run", "-d", "--net=foo1", "--name=second", "--link=first:FirstInFoo1", |
| 1454 | 1454 |
"--link=third:bar", "busybox", "top") |
| 1455 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 1455 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1456 | 1456 |
|
| 1457 | 1457 |
// ping to first and its alias FirstInFoo1 must succeed |
| 1458 | 1458 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -1494,11 +1494,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *check.C) {
|
| 1494 | 1494 |
dockerCmd(c, "network", "disconnect", "bridge", containerName) |
| 1495 | 1495 |
|
| 1496 | 1496 |
dockerCmd(c, "start", containerName) |
| 1497 |
- c.Assert(waitRun(containerName), checker.IsNil) |
|
| 1497 |
+ assert.Assert(c, waitRun(containerName), checker.IsNil) |
|
| 1498 | 1498 |
networks := inspectField(c, containerName, "NetworkSettings.Networks") |
| 1499 |
- c.Assert(networks, checker.Contains, netWorkName1, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1500 |
- c.Assert(networks, checker.Contains, netWorkName2, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1501 |
- c.Assert(networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network"))
|
|
| 1499 |
+ assert.Assert(c, networks, checker.Contains, netWorkName1, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1500 |
+ assert.Assert(c, networks, checker.Contains, netWorkName2, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1501 |
+ assert.Assert(c, networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network"))
|
|
| 1502 | 1502 |
} |
| 1503 | 1503 |
|
| 1504 | 1504 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(c *check.C) {
|
| ... | ... |
@@ -1510,7 +1510,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks( |
| 1510 | 1510 |
for _, net := range defaults {
|
| 1511 | 1511 |
res, _, err := dockerCmdWithError("network", "connect", "--alias", "alias"+net, net, containerID)
|
| 1512 | 1512 |
assert.ErrorContains(c, err, "") |
| 1513 |
- c.Assert(res, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1513 |
+ assert.Assert(c, res, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1514 | 1514 |
} |
| 1515 | 1515 |
} |
| 1516 | 1516 |
|
| ... | ... |
@@ -1520,10 +1520,10 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) {
|
| 1520 | 1520 |
dockerCmd(c, "network", "create", "-d", "bridge", "net2") |
| 1521 | 1521 |
|
| 1522 | 1522 |
cid, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=first", "--net-alias=foo", "busybox:glibc", "top") |
| 1523 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 1523 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1524 | 1524 |
|
| 1525 | 1525 |
dockerCmd(c, "run", "-d", "--net=net1", "--name=second", "busybox:glibc", "top") |
| 1526 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 1526 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1527 | 1527 |
|
| 1528 | 1528 |
// ping first container and its alias |
| 1529 | 1529 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -1560,13 +1560,13 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) {
|
| 1560 | 1560 |
|
| 1561 | 1561 |
// verify the alias option is rejected when running on predefined network |
| 1562 | 1562 |
out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top")
|
| 1563 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1564 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1563 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1564 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1565 | 1565 |
|
| 1566 | 1566 |
// verify the alias option is rejected when connecting to predefined network |
| 1567 | 1567 |
out, _, err = dockerCmdWithError("network", "connect", "--alias=any", "bridge", "first")
|
| 1568 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1569 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1568 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 1569 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1570 | 1570 |
} |
| 1571 | 1571 |
|
| 1572 | 1572 |
func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *check.C) {
|
| ... | ... |
@@ -1574,10 +1574,10 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *check.C) {
|
| 1574 | 1574 |
dockerCmd(c, "network", "create", "-d", "bridge", "br.net1") |
| 1575 | 1575 |
|
| 1576 | 1576 |
dockerCmd(c, "run", "-d", "--net=br.net1", "--name=c1.net1", "busybox:glibc", "top") |
| 1577 |
- c.Assert(waitRun("c1.net1"), check.IsNil)
|
|
| 1577 |
+ assert.Assert(c, waitRun("c1.net1"), check.IsNil)
|
|
| 1578 | 1578 |
|
| 1579 | 1579 |
dockerCmd(c, "run", "-d", "--net=br.net1", "--name=c2.net1", "busybox:glibc", "top") |
| 1580 |
- c.Assert(waitRun("c2.net1"), check.IsNil)
|
|
| 1580 |
+ assert.Assert(c, waitRun("c2.net1"), check.IsNil)
|
|
| 1581 | 1581 |
|
| 1582 | 1582 |
// ping first container by its unqualified name |
| 1583 | 1583 |
_, _, err := dockerCmdWithError("exec", "c2.net1", "ping", "-c", "1", "c1.net1")
|
| ... | ... |
@@ -1602,7 +1602,7 @@ func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *check.C) {
|
| 1602 | 1602 |
|
| 1603 | 1603 |
func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *check.C) {
|
| 1604 | 1604 |
dockerCmd(c, "run", "-d", "--name=bb", "busybox", "top") |
| 1605 |
- c.Assert(waitRun("bb"), check.IsNil)
|
|
| 1605 |
+ assert.Assert(c, waitRun("bb"), check.IsNil)
|
|
| 1606 | 1606 |
defer dockerCmd(c, "stop", "bb") |
| 1607 | 1607 |
|
| 1608 | 1608 |
ns0 := inspectField(c, "bb", "NetworkSettings.Networks.bridge") |
| ... | ... |
@@ -1612,22 +1612,22 @@ func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *check.C) {
|
| 1612 | 1612 |
assert.ErrorContains(c, err, "") |
| 1613 | 1613 |
|
| 1614 | 1614 |
ns1 := inspectField(c, "bb", "NetworkSettings.Networks.bridge") |
| 1615 |
- c.Assert(ns1, check.Equals, ns0) |
|
| 1615 |
+ assert.Assert(c, ns1, check.Equals, ns0) |
|
| 1616 | 1616 |
} |
| 1617 | 1617 |
|
| 1618 | 1618 |
func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) {
|
| 1619 | 1619 |
dockerCmd(c, "network", "create", "--driver=bridge", "--internal", "internal") |
| 1620 | 1620 |
assertNwIsAvailable(c, "internal") |
| 1621 | 1621 |
nr := getNetworkResource(c, "internal") |
| 1622 |
- c.Assert(nr.Internal, checker.True) |
|
| 1622 |
+ assert.Assert(c, nr.Internal, checker.True) |
|
| 1623 | 1623 |
|
| 1624 | 1624 |
dockerCmd(c, "run", "-d", "--net=internal", "--name=first", "busybox:glibc", "top") |
| 1625 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 1625 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1626 | 1626 |
dockerCmd(c, "run", "-d", "--net=internal", "--name=second", "busybox:glibc", "top") |
| 1627 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 1627 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1628 | 1628 |
out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "8.8.8.8")
|
| 1629 | 1629 |
assert.ErrorContains(c, err, "") |
| 1630 |
- c.Assert(out, checker.Contains, "100% packet loss") |
|
| 1630 |
+ assert.Assert(c, out, checker.Contains, "100% packet loss") |
|
| 1631 | 1631 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| 1632 | 1632 |
assert.NilError(c, err) |
| 1633 | 1633 |
} |
| ... | ... |
@@ -1717,13 +1717,13 @@ func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *check.C) {
|
| 1717 | 1717 |
func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *check.C) {
|
| 1718 | 1718 |
dockerCmd(c, "network", "create", "user") |
| 1719 | 1719 |
output, status := dockerCmd(c, "run", "--rm", "--network=user", "--network-alias=foo", "busybox", "true") |
| 1720 |
- c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1720 |
+ assert.Assert(c, status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1721 | 1721 |
|
| 1722 | 1722 |
output, status, _ = dockerCmdWithError("run", "--rm", "--net=user", "--network=user", "busybox", "true")
|
| 1723 |
- c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1723 |
+ assert.Assert(c, status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1724 | 1724 |
|
| 1725 | 1725 |
output, status, _ = dockerCmdWithError("run", "--rm", "--network=user", "--net-alias=foo", "--network-alias=bar", "busybox", "true")
|
| 1726 |
- c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1726 |
+ assert.Assert(c, status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1727 | 1727 |
} |
| 1728 | 1728 |
|
| 1729 | 1729 |
func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) {
|
| ... | ... |
@@ -1733,7 +1733,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) {
|
| 1733 | 1733 |
|
| 1734 | 1734 |
_, _, err = dockerCmdWithError("run", "-d", "--name", "mynet0", "--net=mynet", "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1735 | 1735 |
assert.NilError(c, err) |
| 1736 |
- c.Assert(waitRun("mynet0"), check.IsNil)
|
|
| 1736 |
+ assert.Assert(c, waitRun("mynet0"), check.IsNil)
|
|
| 1737 | 1737 |
verifyIPAddressConfig(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988") |
| 1738 | 1738 |
verifyIPAddresses(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988") |
| 1739 | 1739 |
|
| ... | ... |
@@ -36,8 +36,8 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
|
| 36 | 36 |
|
| 37 | 37 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 38 | 38 |
assert.NilError(c, err) |
| 39 |
- c.Assert(out, checker.Contains, plugin) |
|
| 40 |
- c.Assert(out, checker.Contains, "true") |
|
| 39 |
+ assert.Assert(c, out, checker.Contains, plugin) |
|
| 40 |
+ assert.Assert(c, out, checker.Contains, "true") |
|
| 41 | 41 |
|
| 42 | 42 |
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", plugin)
|
| 43 | 43 |
id = strings.TrimSpace(id) |
| ... | ... |
@@ -45,14 +45,14 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
|
| 45 | 45 |
|
| 46 | 46 |
out, _, err = dockerCmdWithError("plugin", "remove", plugin)
|
| 47 | 47 |
assert.ErrorContains(c, err, "") |
| 48 |
- c.Assert(out, checker.Contains, "is enabled") |
|
| 48 |
+ assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 49 | 49 |
|
| 50 | 50 |
_, _, err = dockerCmdWithError("plugin", "disable", plugin)
|
| 51 | 51 |
assert.NilError(c, err) |
| 52 | 52 |
|
| 53 | 53 |
out, _, err = dockerCmdWithError("plugin", "remove", plugin)
|
| 54 | 54 |
assert.NilError(c, err) |
| 55 |
- c.Assert(out, checker.Contains, plugin) |
|
| 55 |
+ assert.Assert(c, out, checker.Contains, plugin) |
|
| 56 | 56 |
|
| 57 | 57 |
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id)) |
| 58 | 58 |
if !os.IsNotExist(err) {
|
| ... | ... |
@@ -67,11 +67,11 @@ func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) {
|
| 67 | 67 |
assert.NilError(c, err) |
| 68 | 68 |
|
| 69 | 69 |
out, _, _ := dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 70 |
- c.Assert(out, checker.Contains, "is enabled") |
|
| 70 |
+ assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 71 | 71 |
|
| 72 | 72 |
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
|
| 73 | 73 |
assert.NilError(c, err) |
| 74 |
- c.Assert(out, checker.Contains, pNameWithTag) |
|
| 74 |
+ assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
func (s *DockerSuite) TestPluginActive(c *check.C) {
|
| ... | ... |
@@ -84,7 +84,7 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
|
| 84 | 84 |
assert.NilError(c, err) |
| 85 | 85 |
|
| 86 | 86 |
out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
|
| 87 |
- c.Assert(out, checker.Contains, "in use") |
|
| 87 |
+ assert.Assert(c, out, checker.Contains, "in use") |
|
| 88 | 88 |
|
| 89 | 89 |
_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
|
| 90 | 90 |
assert.NilError(c, err) |
| ... | ... |
@@ -94,7 +94,7 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
|
| 94 | 94 |
|
| 95 | 95 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 96 | 96 |
assert.NilError(c, err) |
| 97 |
- c.Assert(out, checker.Contains, pNameWithTag) |
|
| 97 |
+ assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
|
| ... | ... |
@@ -108,20 +108,20 @@ func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
|
| 108 | 108 |
nID := strings.TrimSpace(out) |
| 109 | 109 |
|
| 110 | 110 |
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 111 |
- c.Assert(out, checker.Contains, "is in use") |
|
| 111 |
+ assert.Assert(c, out, checker.Contains, "is in use") |
|
| 112 | 112 |
|
| 113 | 113 |
_, _, err = dockerCmdWithError("network", "rm", nID)
|
| 114 | 114 |
assert.NilError(c, err) |
| 115 | 115 |
|
| 116 | 116 |
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 117 |
- c.Assert(out, checker.Contains, "is enabled") |
|
| 117 |
+ assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 118 | 118 |
|
| 119 | 119 |
_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
|
| 120 | 120 |
assert.NilError(c, err) |
| 121 | 121 |
|
| 122 | 122 |
out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 123 | 123 |
assert.NilError(c, err) |
| 124 |
- c.Assert(out, checker.Contains, npNameWithTag) |
|
| 124 |
+ assert.Assert(c, out, checker.Contains, npNameWithTag) |
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
func (ps *DockerPluginSuite) TestPluginInstallDisable(c *check.C) {
|
| ... | ... |
@@ -129,30 +129,30 @@ func (ps *DockerPluginSuite) TestPluginInstallDisable(c *check.C) {
|
| 129 | 129 |
|
| 130 | 130 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
|
| 131 | 131 |
assert.NilError(c, err) |
| 132 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 132 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 133 | 133 |
|
| 134 | 134 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 135 | 135 |
assert.NilError(c, err) |
| 136 |
- c.Assert(out, checker.Contains, "false") |
|
| 136 |
+ assert.Assert(c, out, checker.Contains, "false") |
|
| 137 | 137 |
|
| 138 | 138 |
out, _, err = dockerCmdWithError("plugin", "enable", pName)
|
| 139 | 139 |
assert.NilError(c, err) |
| 140 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 140 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 141 | 141 |
|
| 142 | 142 |
out, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 143 | 143 |
assert.NilError(c, err) |
| 144 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 144 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 145 | 145 |
|
| 146 | 146 |
out, _, err = dockerCmdWithError("plugin", "remove", pName)
|
| 147 | 147 |
assert.NilError(c, err) |
| 148 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 148 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 149 | 149 |
} |
| 150 | 150 |
|
| 151 | 151 |
func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *check.C) {
|
| 152 | 152 |
testRequires(c, DaemonIsLinux, IsAmd64, Network) |
| 153 | 153 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
|
| 154 | 154 |
assert.NilError(c, err) |
| 155 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 155 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 156 | 156 |
|
| 157 | 157 |
dockerCmd(c, "volume", "ls") |
| 158 | 158 |
} |
| ... | ... |
@@ -180,31 +180,31 @@ func (ps *DockerPluginSuite) TestPluginSet(c *check.C) {
|
| 180 | 180 |
{Name: "pdev2", Settable: []string{"path"}}, // Device without Path is invalid.
|
| 181 | 181 |
} |
| 182 | 182 |
}) |
| 183 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 183 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 184 | 184 |
|
| 185 | 185 |
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", name)
|
| 186 |
- c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=0]") |
|
| 186 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=0]") |
|
| 187 | 187 |
|
| 188 | 188 |
dockerCmd(c, "plugin", "set", name, "DEBUG=1") |
| 189 | 189 |
|
| 190 | 190 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", name)
|
| 191 |
- c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 191 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 192 | 192 |
|
| 193 | 193 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name)
|
| 194 |
- c.Assert(strings.TrimSpace(env), checker.Contains, mntSrc) |
|
| 194 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Contains, mntSrc) |
|
| 195 | 195 |
|
| 196 | 196 |
dockerCmd(c, "plugin", "set", name, "pmount1.source=bar") |
| 197 | 197 |
|
| 198 | 198 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name)
|
| 199 |
- c.Assert(strings.TrimSpace(env), checker.Contains, "bar") |
|
| 199 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Contains, "bar") |
|
| 200 | 200 |
|
| 201 | 201 |
out, _, err := dockerCmdWithError("plugin", "set", name, "pmount2.source=bar2")
|
| 202 | 202 |
assert.ErrorContains(c, err, "") |
| 203 |
- c.Assert(out, checker.Contains, "Plugin config has no mount source") |
|
| 203 |
+ assert.Assert(c, out, checker.Contains, "Plugin config has no mount source") |
|
| 204 | 204 |
|
| 205 | 205 |
out, _, err = dockerCmdWithError("plugin", "set", name, "pdev2.path=/dev/bar2")
|
| 206 | 206 |
assert.ErrorContains(c, err, "") |
| 207 |
- c.Assert(out, checker.Contains, "Plugin config has no device path") |
|
| 207 |
+ assert.Assert(c, out, checker.Contains, "Plugin config has no device path") |
|
| 208 | 208 |
|
| 209 | 209 |
} |
| 210 | 210 |
|
| ... | ... |
@@ -218,10 +218,10 @@ func (ps *DockerPluginSuite) TestPluginInstallArgs(c *check.C) {
|
| 218 | 218 |
}) |
| 219 | 219 |
|
| 220 | 220 |
out, _ := dockerCmd(c, "plugin", "install", "--grant-all-permissions", "--disable", pName, "DEBUG=1") |
| 221 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 221 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 222 | 222 |
|
| 223 | 223 |
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pName)
|
| 224 |
- c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 224 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 225 | 225 |
} |
| 226 | 226 |
|
| 227 | 227 |
func (ps *DockerPluginSuite) TestPluginInstallImage(c *check.C) {
|
| ... | ... |
@@ -235,7 +235,7 @@ func (ps *DockerPluginSuite) TestPluginInstallImage(c *check.C) {
|
| 235 | 235 |
|
| 236 | 236 |
out, _, err := dockerCmdWithError("plugin", "install", repoName)
|
| 237 | 237 |
assert.ErrorContains(c, err, "") |
| 238 |
- c.Assert(out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) |
|
| 238 |
+ assert.Assert(c, out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) |
|
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 | 241 |
func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *check.C) {
|
| ... | ... |
@@ -243,18 +243,18 @@ func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *check.C) {
|
| 243 | 243 |
|
| 244 | 244 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pName)
|
| 245 | 245 |
assert.NilError(c, err) |
| 246 |
- c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
|
| 246 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 247 | 247 |
|
| 248 | 248 |
out, _, err = dockerCmdWithError("plugin", "enable", pName)
|
| 249 | 249 |
assert.ErrorContains(c, err, "") |
| 250 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "already enabled") |
|
| 250 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "already enabled") |
|
| 251 | 251 |
|
| 252 | 252 |
_, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 253 | 253 |
assert.NilError(c, err) |
| 254 | 254 |
|
| 255 | 255 |
out, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 256 | 256 |
assert.ErrorContains(c, err, "") |
| 257 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "already disabled") |
|
| 257 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "already disabled") |
|
| 258 | 258 |
|
| 259 | 259 |
_, _, err = dockerCmdWithError("plugin", "remove", pName)
|
| 260 | 260 |
assert.NilError(c, err) |
| ... | ... |
@@ -275,21 +275,21 @@ func (ps *DockerPluginSuite) TestPluginCreate(c *check.C) {
|
| 275 | 275 |
|
| 276 | 276 |
out, _, err := dockerCmdWithError("plugin", "create", name, temp)
|
| 277 | 277 |
assert.NilError(c, err) |
| 278 |
- c.Assert(out, checker.Contains, name) |
|
| 278 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 279 | 279 |
|
| 280 | 280 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 281 | 281 |
assert.NilError(c, err) |
| 282 |
- c.Assert(out, checker.Contains, name) |
|
| 282 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 283 | 283 |
|
| 284 | 284 |
out, _, err = dockerCmdWithError("plugin", "create", name, temp)
|
| 285 | 285 |
assert.ErrorContains(c, err, "") |
| 286 |
- c.Assert(out, checker.Contains, "already exist") |
|
| 286 |
+ assert.Assert(c, out, checker.Contains, "already exist") |
|
| 287 | 287 |
|
| 288 | 288 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 289 | 289 |
assert.NilError(c, err) |
| 290 |
- c.Assert(out, checker.Contains, name) |
|
| 290 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 291 | 291 |
// The output will consists of one HEADER line and one line of foo/bar-driver |
| 292 |
- c.Assert(len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2) |
|
| 292 |
+ assert.Assert(c, len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2) |
|
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) {
|
| ... | ... |
@@ -300,8 +300,8 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) {
|
| 300 | 300 |
|
| 301 | 301 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 302 | 302 |
assert.NilError(c, err) |
| 303 |
- c.Assert(out, checker.Contains, pNameWithTag) |
|
| 304 |
- c.Assert(out, checker.Contains, "true") |
|
| 303 |
+ assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 304 |
+ assert.Assert(c, out, checker.Contains, "true") |
|
| 305 | 305 |
|
| 306 | 306 |
// Find the ID first |
| 307 | 307 |
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
|
| ... | ... |
@@ -334,7 +334,7 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) {
|
| 334 | 334 |
|
| 335 | 335 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 336 | 336 |
assert.NilError(c, err) |
| 337 |
- c.Assert(out, checker.Contains, pNameWithTag) |
|
| 337 |
+ assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 338 | 338 |
|
| 339 | 339 |
// After remove nothing should be found |
| 340 | 340 |
_, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
|
| ... | ... |
@@ -348,7 +348,7 @@ func (s *DockerSuite) TestPluginInspectOnWindows(c *check.C) {
|
| 348 | 348 |
|
| 349 | 349 |
out, _, err := dockerCmdWithError("plugin", "inspect", "foobar")
|
| 350 | 350 |
assert.ErrorContains(c, err, "") |
| 351 |
- c.Assert(out, checker.Contains, "plugins are not supported on this platform") |
|
| 351 |
+ assert.Assert(c, out, checker.Contains, "plugins are not supported on this platform") |
|
| 352 | 352 |
assert.ErrorContains(c, err, "plugins are not supported on this platform") |
| 353 | 353 |
} |
| 354 | 354 |
|
| ... | ... |
@@ -363,7 +363,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
|
| 363 | 363 |
}) |
| 364 | 364 |
cancel() |
| 365 | 365 |
|
| 366 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 366 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 367 | 367 |
|
| 368 | 368 |
// Find ID first |
| 369 | 369 |
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", name)
|
| ... | ... |
@@ -373,32 +373,32 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
|
| 373 | 373 |
// List current state |
| 374 | 374 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 375 | 375 |
assert.NilError(c, err) |
| 376 |
- c.Assert(out, checker.Contains, name) |
|
| 377 |
- c.Assert(out, checker.Contains, "false") |
|
| 376 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 377 |
+ assert.Assert(c, out, checker.Contains, "false") |
|
| 378 | 378 |
|
| 379 | 379 |
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", id[:5])
|
| 380 |
- c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=0]") |
|
| 380 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=0]") |
|
| 381 | 381 |
|
| 382 | 382 |
dockerCmd(c, "plugin", "set", id[:5], "DEBUG=1") |
| 383 | 383 |
|
| 384 | 384 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", id[:5])
|
| 385 |
- c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 385 |
+ assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
|
| 386 | 386 |
|
| 387 | 387 |
// Enable |
| 388 | 388 |
_, _, err = dockerCmdWithError("plugin", "enable", id[:5])
|
| 389 | 389 |
assert.NilError(c, err) |
| 390 | 390 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 391 | 391 |
assert.NilError(c, err) |
| 392 |
- c.Assert(out, checker.Contains, name) |
|
| 393 |
- c.Assert(out, checker.Contains, "true") |
|
| 392 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 393 |
+ assert.Assert(c, out, checker.Contains, "true") |
|
| 394 | 394 |
|
| 395 | 395 |
// Disable |
| 396 | 396 |
_, _, err = dockerCmdWithError("plugin", "disable", id[:5])
|
| 397 | 397 |
assert.NilError(c, err) |
| 398 | 398 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 399 | 399 |
assert.NilError(c, err) |
| 400 |
- c.Assert(out, checker.Contains, name) |
|
| 401 |
- c.Assert(out, checker.Contains, "false") |
|
| 400 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 401 |
+ assert.Assert(c, out, checker.Contains, "false") |
|
| 402 | 402 |
|
| 403 | 403 |
// Remove |
| 404 | 404 |
_, _, err = dockerCmdWithError("plugin", "remove", id[:5])
|
| ... | ... |
@@ -406,7 +406,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
|
| 406 | 406 |
// List returns none |
| 407 | 407 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 408 | 408 |
assert.NilError(c, err) |
| 409 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 409 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 410 | 410 |
} |
| 411 | 411 |
|
| 412 | 412 |
func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *check.C) {
|
| ... | ... |
@@ -425,7 +425,7 @@ func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *check.C) {
|
| 425 | 425 |
err = plugin.Create(ctx, client, name, func(cfg *plugin.Config) {
|
| 426 | 426 |
cfg.Description = "test plugin" |
| 427 | 427 |
}) |
| 428 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 428 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create test plugin"))
|
|
| 429 | 429 |
|
| 430 | 430 |
out, _ := dockerCmd(c, "plugin", "inspect", "--format", "{{.ID}}", name)
|
| 431 | 431 |
id := strings.TrimSpace(out) |
| ... | ... |
@@ -437,7 +437,7 @@ description: test plugin |
| 437 | 437 |
enabled: false`, id, name) |
| 438 | 438 |
|
| 439 | 439 |
out, _ = dockerCmd(c, "--config", config, "plugin", "ls", "--no-trunc") |
| 440 |
- c.Assert(strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 440 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 441 | 441 |
} |
| 442 | 442 |
|
| 443 | 443 |
func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
|
| ... | ... |
@@ -451,14 +451,14 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
|
| 451 | 451 |
|
| 452 | 452 |
out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", plugin, pluginV2)
|
| 453 | 453 |
assert.ErrorContains(c, err, "", out) |
| 454 |
- c.Assert(out, checker.Contains, "disabled before upgrading") |
|
| 454 |
+ assert.Assert(c, out, checker.Contains, "disabled before upgrading") |
|
| 455 | 455 |
|
| 456 | 456 |
out, _ = dockerCmd(c, "plugin", "inspect", "--format={{.ID}}", plugin)
|
| 457 | 457 |
id := strings.TrimSpace(out) |
| 458 | 458 |
|
| 459 | 459 |
// make sure "v2" does not exists |
| 460 | 460 |
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2")) |
| 461 |
- c.Assert(os.IsNotExist(err), checker.True, check.Commentf("%s", out))
|
|
| 461 |
+ assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("%s", out))
|
|
| 462 | 462 |
|
| 463 | 463 |
dockerCmd(c, "plugin", "disable", "-f", plugin) |
| 464 | 464 |
dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2) |
| ... | ... |
@@ -480,7 +480,7 @@ func (s *DockerSuite) TestPluginMetricsCollector(c *check.C) {
|
| 480 | 480 |
|
| 481 | 481 |
name := "cpuguy83/docker-metrics-plugin-test:latest" |
| 482 | 482 |
r := cli.Docker(cli.Args("plugin", "install", "--grant-all-permissions", name), cli.Daemon(d))
|
| 483 |
- c.Assert(r.Error, checker.IsNil, check.Commentf(r.Combined())) |
|
| 483 |
+ assert.Assert(c, r.Error, checker.IsNil, check.Commentf(r.Combined())) |
|
| 484 | 484 |
|
| 485 | 485 |
// plugin lisens on localhost:19393 and proxies the metrics |
| 486 | 486 |
resp, err := http.Get("http://localhost:19393/metrics")
|
| ... | ... |
@@ -490,5 +490,5 @@ func (s *DockerSuite) TestPluginMetricsCollector(c *check.C) {
|
| 490 | 490 |
b, err := ioutil.ReadAll(resp.Body) |
| 491 | 491 |
assert.NilError(c, err) |
| 492 | 492 |
// check that a known metric is there... don't expect this metric to change over time.. probably safe |
| 493 |
- c.Assert(string(b), checker.Contains, "container_actions") |
|
| 493 |
+ assert.Assert(c, string(b), checker.Contains, "container_actions") |
|
| 494 | 494 |
} |
| ... | ... |
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
|
| 105 | 105 |
"-p", "9090-9092:80", |
| 106 | 106 |
"busybox", "top") |
| 107 | 107 |
// Exhausted port range did not return an error |
| 108 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 108 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("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 *check.C) {
|
| 121 | 121 |
"-p", invalidRange, |
| 122 | 122 |
"busybox", "top") |
| 123 | 123 |
// Port range should have returned an error |
| 124 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 124 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
// test host range:container range spec. |
| ... | ... |
@@ -224,9 +224,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
|
| 224 | 224 |
unpPort2 := fmt.Sprintf("%d/tcp", port2)
|
| 225 | 225 |
out, _ := dockerCmd(c, "ps", "-n=1") |
| 226 | 226 |
// Missing unpublished ports in docker ps output |
| 227 |
- c.Assert(out, checker.Contains, unpPort1) |
|
| 227 |
+ assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 228 | 228 |
// Missing unpublished ports in docker ps output |
| 229 |
- c.Assert(out, checker.Contains, unpPort2) |
|
| 229 |
+ assert.Assert(c, out, checker.Contains, unpPort2) |
|
| 230 | 230 |
|
| 231 | 231 |
// Run the container forcing to publish the exposed ports |
| 232 | 232 |
dockerCmd(c, "run", "-d", "-P", expose1, expose2, "busybox", "sleep", "5") |
| ... | ... |
@@ -236,9 +236,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
|
| 236 | 236 |
expBndRegx2 := regexp.MustCompile(`0.0.0.0:\d\d\d\d\d->` + unpPort2) |
| 237 | 237 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 238 | 238 |
// Cannot find expected port binding port (0.0.0.0:xxxxx->unpPort1) in docker ps output |
| 239 |
- c.Assert(expBndRegx1.MatchString(out), checker.Equals, true, check.Commentf("out: %s; unpPort1: %s", out, unpPort1))
|
|
| 239 |
+ assert.Assert(c, expBndRegx1.MatchString(out), checker.Equals, true, check.Commentf("out: %s; unpPort1: %s", out, unpPort1))
|
|
| 240 | 240 |
// Cannot find expected port binding port (0.0.0.0:xxxxx->unpPort2) in docker ps output |
| 241 |
- c.Assert(expBndRegx2.MatchString(out), checker.Equals, true, check.Commentf("out: %s; unpPort2: %s", out, unpPort2))
|
|
| 241 |
+ assert.Assert(c, expBndRegx2.MatchString(out), checker.Equals, true, check.Commentf("out: %s; unpPort2: %s", out, unpPort2))
|
|
| 242 | 242 |
|
| 243 | 243 |
// Run the container specifying explicit port bindings for the exposed ports |
| 244 | 244 |
offset := 10000 |
| ... | ... |
@@ -252,9 +252,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
|
| 252 | 252 |
expBnd2 := fmt.Sprintf("0.0.0.0:%d->%s", offset+port2, unpPort2)
|
| 253 | 253 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 254 | 254 |
// Cannot find expected port binding (expBnd1) in docker ps output |
| 255 |
- c.Assert(out, checker.Contains, expBnd1) |
|
| 255 |
+ assert.Assert(c, out, checker.Contains, expBnd1) |
|
| 256 | 256 |
// Cannot find expected port binding (expBnd2) in docker ps output |
| 257 |
- c.Assert(out, checker.Contains, expBnd2) |
|
| 257 |
+ assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 258 | 258 |
|
| 259 | 259 |
// Remove container now otherwise it will interfere with next test |
| 260 | 260 |
stopRemoveContainer(id, c) |
| ... | ... |
@@ -266,9 +266,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
|
| 266 | 266 |
// Check docker ps o/p for last created container reports the specified port mappings |
| 267 | 267 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 268 | 268 |
// Cannot find expected port binding (expBnd1) in docker ps output |
| 269 |
- c.Assert(out, checker.Contains, expBnd1) |
|
| 269 |
+ assert.Assert(c, out, checker.Contains, expBnd1) |
|
| 270 | 270 |
// Cannot find expected port binding (expBnd2) in docker ps output |
| 271 |
- c.Assert(out, checker.Contains, expBnd2) |
|
| 271 |
+ assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 272 | 272 |
// Remove container now otherwise it will interfere with next test |
| 273 | 273 |
stopRemoveContainer(id, c) |
| 274 | 274 |
|
| ... | ... |
@@ -278,9 +278,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
|
| 278 | 278 |
// Check docker ps o/p for last created container reports the specified unpublished port and port mapping |
| 279 | 279 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 280 | 280 |
// Missing unpublished exposed ports (unpPort1) in docker ps output |
| 281 |
- c.Assert(out, checker.Contains, unpPort1) |
|
| 281 |
+ assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 282 | 282 |
// Missing port binding (expBnd2) in docker ps output |
| 283 |
- c.Assert(out, checker.Contains, expBnd2) |
|
| 283 |
+ assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 284 | 284 |
} |
| 285 | 285 |
|
| 286 | 286 |
func (s *DockerSuite) TestPortHostBinding(c *check.C) {
|
| ... | ... |
@@ -302,7 +302,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) {
|
| 302 | 302 |
|
| 303 | 303 |
out, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "9876")
|
| 304 | 304 |
// Port is still bound after the Container is removed |
| 305 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 305 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 306 | 306 |
} |
| 307 | 307 |
|
| 308 | 308 |
func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
|
| ... | ... |
@@ -314,7 +314,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
|
| 314 | 314 |
out, _ = dockerCmd(c, "port", firstID, "80") |
| 315 | 315 |
|
| 316 | 316 |
_, exposedPort, err := net.SplitHostPort(out) |
| 317 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %s", out))
|
|
| 317 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %s", out))
|
|
| 318 | 318 |
|
| 319 | 319 |
dockerCmd(c, "run", "--net=host", "busybox", |
| 320 | 320 |
"nc", "localhost", strings.TrimSpace(exposedPort)) |
| ... | ... |
@@ -324,25 +324,25 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
|
| 324 | 324 |
out, _, err = dockerCmdWithError("run", "--net=host", "busybox",
|
| 325 | 325 |
"nc", "localhost", strings.TrimSpace(exposedPort)) |
| 326 | 326 |
// Port is still bound after the Container is removed |
| 327 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 327 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 328 | 328 |
} |
| 329 | 329 |
|
| 330 | 330 |
func (s *DockerSuite) TestPortBindingOnSandbox(c *check.C) {
|
| 331 | 331 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 332 | 332 |
dockerCmd(c, "network", "create", "--internal", "-d", "bridge", "internal-net") |
| 333 | 333 |
nr := getNetworkResource(c, "internal-net") |
| 334 |
- c.Assert(nr.Internal, checker.Equals, true) |
|
| 334 |
+ assert.Assert(c, nr.Internal, checker.Equals, true) |
|
| 335 | 335 |
|
| 336 | 336 |
dockerCmd(c, "run", "--net", "internal-net", "-d", "--name", "c1", |
| 337 | 337 |
"-p", "8080:8080", "busybox", "nc", "-l", "-p", "8080") |
| 338 |
- c.Assert(waitRun("c1"), check.IsNil)
|
|
| 338 |
+ assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 339 | 339 |
|
| 340 | 340 |
_, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 341 |
- c.Assert(err, check.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 341 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 342 | 342 |
// Connect container to another normal bridge network |
| 343 | 343 |
dockerCmd(c, "network", "create", "-d", "bridge", "foo-net") |
| 344 | 344 |
dockerCmd(c, "network", "connect", "foo-net", "c1") |
| 345 | 345 |
|
| 346 | 346 |
_, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 347 |
- c.Assert(err, check.IsNil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 347 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 348 | 348 |
} |
| ... | ... |
@@ -92,23 +92,23 @@ func (s *DockerDaemonSuite) TestPruneImageDangling(c *check.C) {
|
| 92 | 92 |
|
| 93 | 93 |
out, err := s.d.Cmd("images", "-q", "--no-trunc")
|
| 94 | 94 |
assert.NilError(c, err) |
| 95 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id) |
|
| 95 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 96 | 96 |
|
| 97 | 97 |
out, err = s.d.Cmd("image", "prune", "--force")
|
| 98 | 98 |
assert.NilError(c, err) |
| 99 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id) |
|
| 99 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id) |
|
| 100 | 100 |
|
| 101 | 101 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 102 | 102 |
assert.NilError(c, err) |
| 103 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id) |
|
| 103 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 104 | 104 |
|
| 105 | 105 |
out, err = s.d.Cmd("image", "prune", "--force", "--all")
|
| 106 | 106 |
assert.NilError(c, err) |
| 107 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id) |
|
| 107 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 108 | 108 |
|
| 109 | 109 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 110 | 110 |
assert.NilError(c, err) |
| 111 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id) |
|
| 111 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id) |
|
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 | 114 |
func (s *DockerSuite) TestPruneContainerUntil(c *check.C) {
|
| ... | ... |
@@ -123,12 +123,12 @@ func (s *DockerSuite) TestPruneContainerUntil(c *check.C) {
|
| 123 | 123 |
cli.WaitExited(c, id2, 5*time.Second) |
| 124 | 124 |
|
| 125 | 125 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "until="+until).Combined() |
| 126 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 127 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 126 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 127 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 128 | 128 |
|
| 129 | 129 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 130 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 131 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 130 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 131 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 | 134 |
func (s *DockerSuite) TestPruneContainerLabel(c *check.C) {
|
| ... | ... |
@@ -158,53 +158,53 @@ func (s *DockerSuite) TestPruneContainerLabel(c *check.C) {
|
| 158 | 158 |
|
| 159 | 159 |
// With config.json only, prune based on label=foobar |
| 160 | 160 |
out = cli.DockerCmd(c, "--config", d, "container", "prune", "--force").Combined() |
| 161 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 162 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 163 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 164 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id4) |
|
| 161 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 162 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 163 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 164 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id4) |
|
| 165 | 165 |
|
| 166 | 166 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "label=foo").Combined() |
| 167 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 168 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 169 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 167 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 168 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 169 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 170 | 170 |
|
| 171 | 171 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 172 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 173 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 174 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id3) |
|
| 172 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 173 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 174 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 175 | 175 |
|
| 176 | 176 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "label!=bar").Combined() |
| 177 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 178 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id3) |
|
| 177 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 178 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 179 | 179 |
|
| 180 | 180 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 181 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 182 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 181 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 182 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 183 | 183 |
|
| 184 | 184 |
// With config.json label=foobar and CLI label!=foobar, CLI label!=foobar supersede |
| 185 | 185 |
out = cli.DockerCmd(c, "--config", d, "container", "prune", "--force", "--filter", "label!=foobar").Combined() |
| 186 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 186 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 187 | 187 |
|
| 188 | 188 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 189 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 189 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 190 | 190 |
} |
| 191 | 191 |
|
| 192 | 192 |
func (s *DockerSuite) TestPruneVolumeLabel(c *check.C) {
|
| 193 | 193 |
out, _ := dockerCmd(c, "volume", "create", "--label", "foo") |
| 194 | 194 |
id1 := strings.TrimSpace(out) |
| 195 |
- c.Assert(id1, checker.Not(checker.Equals), "") |
|
| 195 |
+ assert.Assert(c, id1, checker.Not(checker.Equals), "") |
|
| 196 | 196 |
|
| 197 | 197 |
out, _ = dockerCmd(c, "volume", "create", "--label", "bar") |
| 198 | 198 |
id2 := strings.TrimSpace(out) |
| 199 |
- c.Assert(id2, checker.Not(checker.Equals), "") |
|
| 199 |
+ assert.Assert(c, id2, checker.Not(checker.Equals), "") |
|
| 200 | 200 |
|
| 201 | 201 |
out, _ = dockerCmd(c, "volume", "create") |
| 202 | 202 |
id3 := strings.TrimSpace(out) |
| 203 |
- c.Assert(id3, checker.Not(checker.Equals), "") |
|
| 203 |
+ assert.Assert(c, id3, checker.Not(checker.Equals), "") |
|
| 204 | 204 |
|
| 205 | 205 |
out, _ = dockerCmd(c, "volume", "create", "--label", "foobar") |
| 206 | 206 |
id4 := strings.TrimSpace(out) |
| 207 |
- c.Assert(id4, checker.Not(checker.Equals), "") |
|
| 207 |
+ assert.Assert(c, id4, checker.Not(checker.Equals), "") |
|
| 208 | 208 |
|
| 209 | 209 |
// Add a config file of label=foobar, that will have no impact if cli is label!=foobar |
| 210 | 210 |
config := `{"pruneFilters": ["label=foobar"]}`
|
| ... | ... |
@@ -216,35 +216,35 @@ func (s *DockerSuite) TestPruneVolumeLabel(c *check.C) {
|
| 216 | 216 |
|
| 217 | 217 |
// With config.json only, prune based on label=foobar |
| 218 | 218 |
out, _ = dockerCmd(c, "--config", d, "volume", "prune", "--force") |
| 219 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 220 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 221 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 222 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id4) |
|
| 219 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 220 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 221 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 222 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id4) |
|
| 223 | 223 |
|
| 224 | 224 |
out, _ = dockerCmd(c, "volume", "prune", "--force", "--filter", "label=foo") |
| 225 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 226 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 227 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 225 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 226 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 227 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 228 | 228 |
|
| 229 | 229 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 230 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 231 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 232 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id3) |
|
| 230 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 231 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 232 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 233 | 233 |
|
| 234 | 234 |
out, _ = dockerCmd(c, "volume", "prune", "--force", "--filter", "label!=bar") |
| 235 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 236 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id3) |
|
| 235 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 236 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 237 | 237 |
|
| 238 | 238 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 239 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 240 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 239 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 240 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id3) |
|
| 241 | 241 |
|
| 242 | 242 |
// With config.json label=foobar and CLI label!=foobar, CLI label!=foobar supersede |
| 243 | 243 |
out, _ = dockerCmd(c, "--config", d, "volume", "prune", "--force", "--filter", "label!=foobar") |
| 244 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 244 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 245 | 245 |
|
| 246 | 246 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 247 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 247 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
func (s *DockerSuite) TestPruneNetworkLabel(c *check.C) {
|
| ... | ... |
@@ -253,19 +253,19 @@ func (s *DockerSuite) TestPruneNetworkLabel(c *check.C) {
|
| 253 | 253 |
dockerCmd(c, "network", "create", "n3") |
| 254 | 254 |
|
| 255 | 255 |
out, _ := dockerCmd(c, "network", "prune", "--force", "--filter", "label=foo") |
| 256 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "n1") |
|
| 257 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n2") |
|
| 258 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n3") |
|
| 256 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n1") |
|
| 257 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n2") |
|
| 258 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n3") |
|
| 259 | 259 |
|
| 260 | 260 |
out, _ = dockerCmd(c, "network", "prune", "--force", "--filter", "label!=bar") |
| 261 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n1") |
|
| 262 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n2") |
|
| 263 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "n3") |
|
| 261 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n1") |
|
| 262 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n2") |
|
| 263 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n3") |
|
| 264 | 264 |
|
| 265 | 265 |
out, _ = dockerCmd(c, "network", "prune", "--force") |
| 266 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n1") |
|
| 267 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "n2") |
|
| 268 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), "n3") |
|
| 266 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n1") |
|
| 267 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n2") |
|
| 268 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n3") |
|
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 | 271 |
func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) {
|
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) {
|
| 280 | 280 |
id1 := strings.TrimSpace(result.Combined()) |
| 281 | 281 |
out, err := s.d.Cmd("images", "-q", "--no-trunc")
|
| 282 | 282 |
assert.NilError(c, err) |
| 283 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 283 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 284 | 284 |
|
| 285 | 285 |
result = cli.BuildCmd(c, "test2", cli.Daemon(s.d), |
| 286 | 286 |
build.WithDockerfile(`FROM busybox |
| ... | ... |
@@ -291,20 +291,20 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) {
|
| 291 | 291 |
id2 := strings.TrimSpace(result.Combined()) |
| 292 | 292 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 293 | 293 |
assert.NilError(c, err) |
| 294 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 294 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 295 | 295 |
|
| 296 | 296 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=foo=bar")
|
| 297 | 297 |
assert.NilError(c, err) |
| 298 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 299 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 298 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 299 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 300 | 300 |
|
| 301 | 301 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label!=bar=foo")
|
| 302 | 302 |
assert.NilError(c, err) |
| 303 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 304 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 303 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 304 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) |
|
| 305 | 305 |
|
| 306 | 306 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=bar=foo")
|
| 307 | 307 |
assert.NilError(c, err) |
| 308 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 309 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 308 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id1) |
|
| 309 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 310 | 310 |
} |
| ... | ... |
@@ -35,89 +35,89 @@ func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
|
| 35 | 35 |
fourthID := strings.TrimSpace(out) |
| 36 | 36 |
|
| 37 | 37 |
// make sure the second is running |
| 38 |
- c.Assert(waitRun(secondID), checker.IsNil) |
|
| 38 |
+ assert.Assert(c, waitRun(secondID), checker.IsNil) |
|
| 39 | 39 |
|
| 40 | 40 |
// make sure third one is not running |
| 41 | 41 |
dockerCmd(c, "wait", thirdID) |
| 42 | 42 |
|
| 43 | 43 |
// make sure the forth is running |
| 44 |
- c.Assert(waitRun(fourthID), checker.IsNil) |
|
| 44 |
+ assert.Assert(c, waitRun(fourthID), checker.IsNil) |
|
| 45 | 45 |
|
| 46 | 46 |
// all |
| 47 | 47 |
out, _ = dockerCmd(c, "ps", "-a") |
| 48 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, thirdID, secondID, firstID}), checker.Equals, true, check.Commentf("ALL: Container list is not in the correct order: \n%s", out))
|
|
| 48 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, thirdID, secondID, firstID}), checker.Equals, true, check.Commentf("ALL: Container list is not in the correct order: \n%s", out))
|
|
| 49 | 49 |
|
| 50 | 50 |
// running |
| 51 | 51 |
out, _ = dockerCmd(c, "ps") |
| 52 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, secondID, firstID}), checker.Equals, true, check.Commentf("RUNNING: Container list is not in the correct order: \n%s", out))
|
|
| 52 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{fourthID, secondID, firstID}), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 57 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 58 | 58 |
|
| 59 | 59 |
out, _ = dockerCmd(c, "ps", "-n=2") |
| 60 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 60 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 65 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 69 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 73 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 78 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 82 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter: Container list is not in the correct order: \n%s", out))
|
|
| 86 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, BEFORE filter & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 91 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, BEFORE filter: Container list is not in the correct order: \n%s", out))
|
|
| 95 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 101 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 104 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 109 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 112 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, BEFORE filter, LIMIT & ALL: Container list is not in the correct order: \n%s", out))
|
|
| 117 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 |
- c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("SINCE filter, BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
|
|
| 120 |
+ assert.Assert(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), checker.Equals, true, check.Commentf("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 *check.C) {
|
| 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 |
- c.Assert(foundID, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
|
| 176 |
+ assert.Assert(c, foundID, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
|
| 177 | 177 |
expectedSize := fmt.Sprintf("%dB", 2+baseBytes)
|
| 178 | 178 |
foundSize := lines[1][sizeIndex:] |
| 179 |
- c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 179 |
+ assert.Assert(c, foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
| ... | ... |
@@ -196,11 +196,11 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
| 196 | 196 |
// filter containers by exited |
| 197 | 197 |
out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "--filter=status=exited").Combined() |
| 198 | 198 |
containerOut := strings.TrimSpace(out) |
| 199 |
- c.Assert(RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, firstID) |
|
| 199 |
+ assert.Assert(c, RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, firstID) |
|
| 200 | 200 |
|
| 201 | 201 |
out = cli.DockerCmd(c, "ps", "-a", "--no-trunc", "-q", "--filter=status=running").Combined() |
| 202 | 202 |
containerOut = strings.TrimSpace(out) |
| 203 |
- c.Assert(RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, secondID) |
|
| 203 |
+ assert.Assert(c, RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, secondID) |
|
| 204 | 204 |
|
| 205 | 205 |
result := cli.Docker(cli.Args("ps", "-a", "-q", "--filter=status=rubbish"), cli.WithTimeout(time.Second*60))
|
| 206 | 206 |
err := "Invalid filter 'status=rubbish'" |
| ... | ... |
@@ -222,7 +222,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
| 222 | 222 |
|
| 223 | 223 |
out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "--filter=status=paused").Combined() |
| 224 | 224 |
containerOut = strings.TrimSpace(out) |
| 225 |
- c.Assert(RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, pausedID) |
|
| 225 |
+ assert.Assert(c, RemoveOutputForExistingElements(containerOut, existingContainers), checker.Equals, pausedID) |
|
| 226 | 226 |
} |
| 227 | 227 |
} |
| 228 | 228 |
|
| ... | ... |
@@ -236,7 +236,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
|
| 236 | 236 |
|
| 237 | 237 |
out = cli.DockerCmd(c, "ps", "-q", "-l", "--no-trunc", "--filter=health=none").Combined() |
| 238 | 238 |
containerOut := strings.TrimSpace(out) |
| 239 |
- c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected id %s, got %s for legacy none filter, output: %q", containerID, containerOut, out))
|
|
| 239 |
+ assert.Assert(c, containerOut, checker.Equals, containerID, check.Commentf("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 *check.C) {
|
| 246 | 246 |
|
| 247 | 247 |
out = cli.DockerCmd(c, "ps", "-q", "-l", "--no-trunc", "--filter=health=none").Combined() |
| 248 | 248 |
containerOut = strings.TrimSpace(out) |
| 249 |
- c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected id %s, got %s for none filter, output: %q", containerID, containerOut, out))
|
|
| 249 |
+ assert.Assert(c, containerOut, checker.Equals, containerID, check.Commentf("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 *check.C) {
|
| 256 | 256 |
|
| 257 | 257 |
out = cli.DockerCmd(c, "ps", "-q", "--no-trunc", "--filter=health=unhealthy").Combined() |
| 258 | 258 |
containerOut = strings.TrimSpace(out) |
| 259 |
- c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected containerID %s, got %s for unhealthy filter, output: %q", containerID, containerOut, out))
|
|
| 259 |
+ assert.Assert(c, containerOut, checker.Equals, containerID, check.Commentf("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 *check.C) {
|
| 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 |
- c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out))
|
|
| 269 |
+ assert.Assert(c, containerOut, checker.Equals, containerID, check.Commentf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out))
|
|
| 270 | 270 |
} |
| 271 | 271 |
|
| 272 | 272 |
func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
|
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
|
| 280 | 280 |
// filter containers by id |
| 281 | 281 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--filter=id="+firstID) |
| 282 | 282 |
containerOut := strings.TrimSpace(out) |
| 283 |
- c.Assert(containerOut, checker.Equals, firstID[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out))
|
|
| 283 |
+ assert.Assert(c, containerOut, checker.Equals, firstID[:12], check.Commentf("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 *check.C) {
|
| ... | ... |
@@ -294,7 +294,7 @@ func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
|
| 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 |
- c.Assert(containerOut, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", id[:12], containerOut, out))
|
|
| 297 |
+ assert.Assert(c, containerOut, checker.Equals, id[:12], check.Commentf("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 *check.C, out string, filterName string, expe |
| 386 | 386 |
sort.Strings(actualIDs) |
| 387 | 387 |
sort.Strings(expectedIDs) |
| 388 | 388 |
|
| 389 |
- c.Assert(actualIDs, checker.HasLen, 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.Assert(c, actualIDs, checker.HasLen, 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))
|
|
| 390 | 390 |
if len(expectedIDs) > 0 {
|
| 391 | 391 |
same := true |
| 392 | 392 |
for i := range expectedIDs {
|
| ... | ... |
@@ -396,7 +396,7 @@ func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expe |
| 396 | 396 |
break |
| 397 | 397 |
} |
| 398 | 398 |
} |
| 399 |
- c.Assert(same, checker.Equals, true, check.Commentf("Expected filtered container(s) for %s ancestor filter to be %v, got %v", filterName, expectedIDs, actualIDs))
|
|
| 399 |
+ assert.Assert(c, same, checker.Equals, true, check.Commentf("Expected filtered container(s) for %s ancestor filter to be %v, got %v", filterName, expectedIDs, actualIDs))
|
|
| 400 | 400 |
} |
| 401 | 401 |
} |
| 402 | 402 |
|
| ... | ... |
@@ -416,24 +416,24 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
|
| 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 |
- c.Assert(containerOut, checker.Equals, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 419 |
+ assert.Assert(c, containerOut, checker.Equals, firstID, check.Commentf("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 |
- c.Assert(containerOut, checker.Equals, firstID, check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID, containerOut, out))
|
|
| 424 |
+ assert.Assert(c, containerOut, checker.Equals, firstID, check.Commentf("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 |
- c.Assert(containerOut, checker.Equals, "", check.Commentf("Expected nothing, got %s for exited filter, output: %q", containerOut, out))
|
|
| 429 |
+ assert.Assert(c, containerOut, checker.Equals, "", check.Commentf("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") |
| 433 | 433 |
containerOut = strings.TrimSpace(out) |
| 434 |
- c.Assert(containerOut, checker.Contains, firstID) |
|
| 435 |
- c.Assert(containerOut, checker.Contains, secondID) |
|
| 436 |
- c.Assert(containerOut, checker.Not(checker.Contains), thirdID) |
|
| 434 |
+ assert.Assert(c, containerOut, checker.Contains, firstID) |
|
| 435 |
+ assert.Assert(c, containerOut, checker.Contains, secondID) |
|
| 436 |
+ assert.Assert(c, containerOut, checker.Not(checker.Contains), thirdID) |
|
| 437 | 437 |
} |
| 438 | 438 |
|
| 439 | 439 |
func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
|
| ... | ... |
@@ -443,25 +443,25 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
|
| 443 | 443 |
secondZero, _ := dockerCmd(c, "run", "-d", "busybox", "true") |
| 444 | 444 |
|
| 445 | 445 |
out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false")
|
| 446 |
- c.Assert(err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
|
|
| 446 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
|
|
| 447 | 447 |
firstNonZero := getIDByName(c, "nonzero1") |
| 448 | 448 |
|
| 449 | 449 |
out, _, err = dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false")
|
| 450 |
- c.Assert(err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
|
|
| 450 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
|
|
| 451 | 451 |
secondNonZero := getIDByName(c, "nonzero2") |
| 452 | 452 |
|
| 453 | 453 |
// filter containers by exited=0 |
| 454 | 454 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=exited=0") |
| 455 |
- c.Assert(out, checker.Contains, strings.TrimSpace(firstZero)) |
|
| 456 |
- c.Assert(out, checker.Contains, strings.TrimSpace(secondZero)) |
|
| 457 |
- c.Assert(out, checker.Not(checker.Contains), strings.TrimSpace(firstNonZero)) |
|
| 458 |
- c.Assert(out, checker.Not(checker.Contains), strings.TrimSpace(secondNonZero)) |
|
| 455 |
+ assert.Assert(c, out, checker.Contains, strings.TrimSpace(firstZero)) |
|
| 456 |
+ assert.Assert(c, out, checker.Contains, strings.TrimSpace(secondZero)) |
|
| 457 |
+ assert.Assert(c, out, checker.Not(checker.Contains), strings.TrimSpace(firstNonZero)) |
|
| 458 |
+ assert.Assert(c, out, checker.Not(checker.Contains), strings.TrimSpace(secondNonZero)) |
|
| 459 | 459 |
|
| 460 | 460 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=exited=1") |
| 461 |
- c.Assert(out, checker.Contains, strings.TrimSpace(firstNonZero)) |
|
| 462 |
- c.Assert(out, checker.Contains, strings.TrimSpace(secondNonZero)) |
|
| 463 |
- c.Assert(out, checker.Not(checker.Contains), strings.TrimSpace(firstZero)) |
|
| 464 |
- c.Assert(out, checker.Not(checker.Contains), strings.TrimSpace(secondZero)) |
|
| 461 |
+ assert.Assert(c, out, checker.Contains, strings.TrimSpace(firstNonZero)) |
|
| 462 |
+ assert.Assert(c, out, checker.Contains, strings.TrimSpace(secondNonZero)) |
|
| 463 |
+ assert.Assert(c, out, checker.Not(checker.Contains), strings.TrimSpace(firstZero)) |
|
| 464 |
+ assert.Assert(c, out, checker.Not(checker.Contains), strings.TrimSpace(secondZero)) |
|
| 465 | 465 |
} |
| 466 | 466 |
|
| 467 | 467 |
func (s *DockerSuite) TestPsRightTagName(c *check.C) {
|
| ... | ... |
@@ -499,11 +499,11 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
|
| 499 | 499 |
f := strings.Fields(line) |
| 500 | 500 |
switch f[0] {
|
| 501 | 501 |
case id1: |
| 502 |
- c.Assert(f[1], checker.Equals, "busybox", check.Commentf("Expected %s tag for id %s, got %s", "busybox", id1, f[1]))
|
|
| 502 |
+ assert.Assert(c, f[1], checker.Equals, "busybox", check.Commentf("Expected %s tag for id %s, got %s", "busybox", id1, f[1]))
|
|
| 503 | 503 |
case id2: |
| 504 |
- c.Assert(f[1], checker.Equals, tag, check.Commentf("Expected %s tag for id %s, got %s", tag, id2, f[1]))
|
|
| 504 |
+ assert.Assert(c, f[1], checker.Equals, tag, check.Commentf("Expected %s tag for id %s, got %s", tag, id2, f[1]))
|
|
| 505 | 505 |
case id3: |
| 506 |
- c.Assert(f[1], checker.Equals, imageID, check.Commentf("Expected %s imageID for id %s, got %s", tag, id3, f[1]))
|
|
| 506 |
+ assert.Assert(c, f[1], checker.Equals, imageID, check.Commentf("Expected %s imageID for id %s, got %s", tag, id3, f[1]))
|
|
| 507 | 507 |
default: |
| 508 | 508 |
c.Fatalf("Unexpected id %s, expected %s and %s and %s", f[0], id1, id2, id3)
|
| 509 | 509 |
} |
| ... | ... |
@@ -518,7 +518,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
|
| 518 | 518 |
|
| 519 | 519 |
// Make sure it DOESN'T show up w/o a '-a' for normal 'ps' |
| 520 | 520 |
out, _ = dockerCmd(c, "ps", "-q") |
| 521 |
- c.Assert(out, checker.Not(checker.Contains), shortCID, check.Commentf("Should have not seen '%s' in ps output:\n%s", shortCID, out))
|
|
| 521 |
+ assert.Assert(c, out, checker.Not(checker.Contains), shortCID, check.Commentf("Should have not seen '%s' in ps output:\n%s", shortCID, out))
|
|
| 522 | 522 |
|
| 523 | 523 |
// Make sure it DOES show up as 'Created' for 'ps -a' |
| 524 | 524 |
out, _ = dockerCmd(c, "ps", "-a") |
| ... | ... |
@@ -529,10 +529,10 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
|
| 529 | 529 |
continue |
| 530 | 530 |
} |
| 531 | 531 |
hits++ |
| 532 |
- c.Assert(line, checker.Contains, "Created", check.Commentf("Missing 'Created' on '%s'", line))
|
|
| 532 |
+ assert.Assert(c, line, checker.Contains, "Created", check.Commentf("Missing 'Created' on '%s'", line))
|
|
| 533 | 533 |
} |
| 534 | 534 |
|
| 535 |
- c.Assert(hits, checker.Equals, 1, check.Commentf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out))
|
|
| 535 |
+ assert.Assert(c, hits, checker.Equals, 1, check.Commentf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out))
|
|
| 536 | 536 |
|
| 537 | 537 |
// filter containers by 'create' - note, no -a needed |
| 538 | 538 |
out, _ = dockerCmd(c, "ps", "-q", "-f", "status=created") |
| ... | ... |
@@ -564,11 +564,11 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
|
| 564 | 564 |
lines = RemoveLinesForExistingElements(lines, existingContainers) |
| 565 | 565 |
// skip header |
| 566 | 566 |
lines = lines[1:] |
| 567 |
- c.Assert(len(lines), checker.Equals, 1) |
|
| 567 |
+ assert.Assert(c, len(lines), checker.Equals, 1) |
|
| 568 | 568 |
|
| 569 | 569 |
for _, line := range lines {
|
| 570 | 570 |
f := strings.Fields(line) |
| 571 |
- c.Assert(f[1], checker.Equals, originalImageName) |
|
| 571 |
+ assert.Assert(c, f[1], checker.Equals, originalImageName) |
|
| 572 | 572 |
} |
| 573 | 573 |
|
| 574 | 574 |
icmd.RunCommand(dockerBinary, "commit", containerID, updatedImageName).Assert(c, icmd.Success) |
| ... | ... |
@@ -581,11 +581,11 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
|
| 581 | 581 |
lines = RemoveLinesForExistingElements(lines, existingContainers) |
| 582 | 582 |
// skip header |
| 583 | 583 |
lines = lines[1:] |
| 584 |
- c.Assert(len(lines), checker.Equals, 1) |
|
| 584 |
+ assert.Assert(c, len(lines), checker.Equals, 1) |
|
| 585 | 585 |
|
| 586 | 586 |
for _, line := range lines {
|
| 587 | 587 |
f := strings.Fields(line) |
| 588 |
- c.Assert(f[1], checker.Equals, originalImageID) |
|
| 588 |
+ assert.Assert(c, f[1], checker.Equals, originalImageID) |
|
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 | 591 |
} |
| ... | ... |
@@ -593,19 +593,19 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
|
| 593 | 593 |
func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *check.C) {
|
| 594 | 594 |
testRequires(c, DaemonIsLinux) |
| 595 | 595 |
dockerCmd(c, "run", "--name=foo", "-d", "-p", "5000:5000", "busybox", "top") |
| 596 |
- c.Assert(waitRun("foo"), checker.IsNil)
|
|
| 596 |
+ assert.Assert(c, waitRun("foo"), checker.IsNil)
|
|
| 597 | 597 |
out, _ := dockerCmd(c, "ps") |
| 598 | 598 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
| 599 | 599 |
expected := "0.0.0.0:5000->5000/tcp" |
| 600 | 600 |
fields := strings.Fields(lines[1]) |
| 601 |
- c.Assert(fields[len(fields)-2], checker.Equals, expected, check.Commentf("Expected: %v, got: %v", expected, fields[len(fields)-2]))
|
|
| 601 |
+ assert.Assert(c, fields[len(fields)-2], checker.Equals, expected, check.Commentf("Expected: %v, got: %v", expected, fields[len(fields)-2]))
|
|
| 602 | 602 |
|
| 603 | 603 |
dockerCmd(c, "kill", "foo") |
| 604 | 604 |
dockerCmd(c, "wait", "foo") |
| 605 | 605 |
out, _ = dockerCmd(c, "ps", "-l") |
| 606 | 606 |
lines = strings.Split(strings.TrimSpace(string(out)), "\n") |
| 607 | 607 |
fields = strings.Fields(lines[1]) |
| 608 |
- c.Assert(fields[len(fields)-2], checker.Not(checker.Equals), expected, check.Commentf("Should not got %v", expected))
|
|
| 608 |
+ assert.Assert(c, fields[len(fields)-2], checker.Not(checker.Equals), expected, check.Commentf("Should not got %v", expected))
|
|
| 609 | 609 |
} |
| 610 | 610 |
|
| 611 | 611 |
func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| ... | ... |
@@ -618,9 +618,9 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 618 | 618 |
dockerCmd(c, "volume", "create", "ps-volume-test") |
| 619 | 619 |
// volume mount containers |
| 620 | 620 |
runSleepingContainer(c, "--name=volume-test-1", "--volume", "ps-volume-test:"+mp) |
| 621 |
- c.Assert(waitRun("volume-test-1"), checker.IsNil)
|
|
| 621 |
+ assert.Assert(c, waitRun("volume-test-1"), checker.IsNil)
|
|
| 622 | 622 |
runSleepingContainer(c, "--name=volume-test-2", "--volume", mp) |
| 623 |
- c.Assert(waitRun("volume-test-2"), checker.IsNil)
|
|
| 623 |
+ assert.Assert(c, waitRun("volume-test-2"), checker.IsNil)
|
|
| 624 | 624 |
// bind mount container |
| 625 | 625 |
var bindMountSource string |
| 626 | 626 |
var bindMountDestination string |
| ... | ... |
@@ -632,7 +632,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 632 | 632 |
bindMountDestination = "/t" |
| 633 | 633 |
} |
| 634 | 634 |
runSleepingContainer(c, "--name=bind-mount-test", "-v", bindMountSource+":"+bindMountDestination) |
| 635 |
- c.Assert(waitRun("bind-mount-test"), checker.IsNil)
|
|
| 635 |
+ assert.Assert(c, waitRun("bind-mount-test"), checker.IsNil)
|
|
| 636 | 636 |
|
| 637 | 637 |
out, _ := dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}")
|
| 638 | 638 |
|
| ... | ... |
@@ -642,8 +642,8 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 642 | 642 |
|
| 643 | 643 |
fields := strings.Fields(lines[0]) |
| 644 | 644 |
assert.Equal(c, len(fields), 2) |
| 645 |
- c.Assert(fields[0], checker.Equals, "bind-mount-test") |
|
| 646 |
- c.Assert(fields[1], checker.Equals, bindMountSource) |
|
| 645 |
+ assert.Assert(c, fields[0], checker.Equals, "bind-mount-test") |
|
| 646 |
+ assert.Assert(c, fields[1], checker.Equals, bindMountSource) |
|
| 647 | 647 |
|
| 648 | 648 |
fields = strings.Fields(lines[1]) |
| 649 | 649 |
assert.Equal(c, len(fields), 2) |
| ... | ... |
@@ -651,7 +651,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 651 | 651 |
anonymousVolumeID := fields[1] |
| 652 | 652 |
|
| 653 | 653 |
fields = strings.Fields(lines[2]) |
| 654 |
- c.Assert(fields[1], checker.Equals, "ps-volume-test") |
|
| 654 |
+ assert.Assert(c, fields[1], checker.Equals, "ps-volume-test") |
|
| 655 | 655 |
|
| 656 | 656 |
// filter by volume name |
| 657 | 657 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume=ps-volume-test")
|
| ... | ... |
@@ -661,11 +661,11 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 661 | 661 |
assert.Equal(c, len(lines), 1) |
| 662 | 662 |
|
| 663 | 663 |
fields = strings.Fields(lines[0]) |
| 664 |
- c.Assert(fields[1], checker.Equals, "ps-volume-test") |
|
| 664 |
+ assert.Assert(c, fields[1], checker.Equals, "ps-volume-test") |
|
| 665 | 665 |
|
| 666 | 666 |
// empty results filtering by unknown volume |
| 667 | 667 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume=this-volume-should-not-exist")
|
| 668 |
- c.Assert(strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 668 |
+ assert.Assert(c, strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 669 | 669 |
|
| 670 | 670 |
// filter by mount destination |
| 671 | 671 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+mp)
|
| ... | ... |
@@ -675,9 +675,9 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 675 | 675 |
assert.Equal(c, len(lines), 2) |
| 676 | 676 |
|
| 677 | 677 |
fields = strings.Fields(lines[0]) |
| 678 |
- c.Assert(fields[1], checker.Equals, anonymousVolumeID) |
|
| 678 |
+ assert.Assert(c, fields[1], checker.Equals, anonymousVolumeID) |
|
| 679 | 679 |
fields = strings.Fields(lines[1]) |
| 680 |
- c.Assert(fields[1], checker.Equals, "ps-volume-test") |
|
| 680 |
+ assert.Assert(c, fields[1], checker.Equals, "ps-volume-test") |
|
| 681 | 681 |
|
| 682 | 682 |
// filter by bind mount source |
| 683 | 683 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+bindMountSource)
|
| ... | ... |
@@ -688,8 +688,8 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 688 | 688 |
|
| 689 | 689 |
fields = strings.Fields(lines[0]) |
| 690 | 690 |
assert.Equal(c, len(fields), 2) |
| 691 |
- c.Assert(fields[0], checker.Equals, "bind-mount-test") |
|
| 692 |
- c.Assert(fields[1], checker.Equals, bindMountSource) |
|
| 691 |
+ assert.Assert(c, fields[0], checker.Equals, "bind-mount-test") |
|
| 692 |
+ assert.Assert(c, fields[1], checker.Equals, bindMountSource) |
|
| 693 | 693 |
|
| 694 | 694 |
// filter by bind mount destination |
| 695 | 695 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+bindMountDestination)
|
| ... | ... |
@@ -700,12 +700,12 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
|
| 700 | 700 |
|
| 701 | 701 |
fields = strings.Fields(lines[0]) |
| 702 | 702 |
assert.Equal(c, len(fields), 2) |
| 703 |
- c.Assert(fields[0], checker.Equals, "bind-mount-test") |
|
| 704 |
- c.Assert(fields[1], checker.Equals, bindMountSource) |
|
| 703 |
+ assert.Assert(c, fields[0], checker.Equals, "bind-mount-test") |
|
| 704 |
+ assert.Assert(c, fields[1], checker.Equals, bindMountSource) |
|
| 705 | 705 |
|
| 706 | 706 |
// empty results filtering by unknown mount point |
| 707 | 707 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+prefix+slash+"this-path-was-never-mounted")
|
| 708 |
- c.Assert(strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 708 |
+ assert.Assert(c, strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 709 | 709 |
} |
| 710 | 710 |
|
| 711 | 711 |
func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| ... | ... |
@@ -743,7 +743,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| 743 | 743 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1) |
| 744 | 744 |
|
| 745 | 745 |
// Making sure onbridgenetwork is on the output |
| 746 |
- c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 746 |
+ assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 747 | 747 |
|
| 748 | 748 |
// Filter docker ps on networks bridge and none |
| 749 | 749 |
out, _ = dockerCmd(c, "ps", "--filter", "network=bridge", "--filter", "network=none") |
| ... | ... |
@@ -758,8 +758,8 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| 758 | 758 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2) |
| 759 | 759 |
|
| 760 | 760 |
// Making sure onbridgenetwork and onnonenetwork is on the output |
| 761 |
- c.Assert(containerOut, checker.Contains, "onnonenetwork", check.Commentf("Missing the container on none network\n"))
|
|
| 762 |
- c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on bridge network\n"))
|
|
| 761 |
+ assert.Assert(c, containerOut, checker.Contains, "onnonenetwork", check.Commentf("Missing the container on none network\n"))
|
|
| 762 |
+ assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on bridge network\n"))
|
|
| 763 | 763 |
|
| 764 | 764 |
nwID, _ := dockerCmd(c, "network", "inspect", "--format", "{{.ID}}", "bridge")
|
| 765 | 765 |
|
| ... | ... |
@@ -784,7 +784,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| 784 | 784 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1) |
| 785 | 785 |
|
| 786 | 786 |
// Making sure onbridgenetwork is on the output |
| 787 |
- c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 787 |
+ assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 788 | 788 |
|
| 789 | 789 |
} |
| 790 | 790 |
|
| ... | ... |
@@ -818,28 +818,28 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *check.C) {
|
| 818 | 818 |
id2 := strings.TrimSpace(out) |
| 819 | 819 |
|
| 820 | 820 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q") |
| 821 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id1) |
|
| 822 |
- c.Assert(strings.TrimSpace(out), checker.Contains, id2) |
|
| 821 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 822 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 823 | 823 |
|
| 824 | 824 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-8080/udp") |
| 825 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 826 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 825 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 826 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 827 | 827 |
|
| 828 | 828 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=8081") |
| 829 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 830 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 829 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 830 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 831 | 831 |
|
| 832 | 832 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-81") |
| 833 | 833 |
assert.Equal(c, strings.TrimSpace(out), id1) |
| 834 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 834 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 835 | 835 |
|
| 836 | 836 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=80/tcp") |
| 837 | 837 |
assert.Equal(c, strings.TrimSpace(out), id1) |
| 838 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 838 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2) |
|
| 839 | 839 |
|
| 840 | 840 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=8080/tcp") |
| 841 | 841 |
out = RemoveOutputForExistingElements(out, existingContainers) |
| 842 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 842 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1) |
|
| 843 | 843 |
assert.Equal(c, strings.TrimSpace(out), id2) |
| 844 | 844 |
} |
| 845 | 845 |
|
| ... | ... |
@@ -340,10 +340,10 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
|
| 340 | 340 |
// Add to revision store |
| 341 | 341 |
revisionDir := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "revisions", "sha256", hexDigest) |
| 342 | 342 |
err = os.Mkdir(revisionDir, 0755) |
| 343 |
- c.Assert(err, checker.IsNil, check.Commentf("error creating revision dir"))
|
|
| 343 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error creating revision dir"))
|
|
| 344 | 344 |
revisionPath := filepath.Join(revisionDir, "link") |
| 345 | 345 |
err = ioutil.WriteFile(revisionPath, []byte(manifestListDigest.String()), 0644) |
| 346 |
- c.Assert(err, checker.IsNil, check.Commentf("error writing revision link"))
|
|
| 346 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error writing revision link"))
|
|
| 347 | 347 |
|
| 348 | 348 |
// Update tag |
| 349 | 349 |
tagPath := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "tags", "latest", "current", "link") |
| ... | ... |
@@ -355,7 +355,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
|
| 355 | 355 |
|
| 356 | 356 |
// The pull output includes "Digest: <digest>", so find that |
| 357 | 357 |
matches := digestRegex.FindStringSubmatch(out) |
| 358 |
- c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 358 |
+ assert.Assert(c, matches, checker.HasLen, 2, check.Commentf("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 |
| ... | ... |
@@ -395,7 +395,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem |
| 395 | 395 |
|
| 396 | 396 |
b, err := ioutil.ReadFile(configPath) |
| 397 | 397 |
assert.NilError(c, err) |
| 398 |
- c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 398 |
+ assert.Assert(c, string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 399 | 399 |
|
| 400 | 400 |
dockerCmd(c, "--config", tmp, "tag", "busybox", repoName) |
| 401 | 401 |
dockerCmd(c, "--config", tmp, "push", repoName) |
| ... | ... |
@@ -440,7 +440,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) {
|
| 440 | 440 |
|
| 441 | 441 |
b, err := ioutil.ReadFile(configPath) |
| 442 | 442 |
assert.NilError(c, err) |
| 443 |
- c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 443 |
+ assert.Assert(c, string(b), checker.Not(checker.Contains), "\"auth\":") |
|
| 444 | 444 |
|
| 445 | 445 |
dockerCmd(c, "--config", tmp, "tag", "busybox", repoName) |
| 446 | 446 |
dockerCmd(c, "--config", tmp, "push", repoName) |
| ... | ... |
@@ -462,10 +462,10 @@ func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *check.C) {
|
| 462 | 462 |
dockerCmd(c, "rmi", repoTag2) |
| 463 | 463 |
|
| 464 | 464 |
out, _ := dockerCmd(c, "run", repo) |
| 465 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Unable to find image '%s:latest' locally", repo))
|
|
| 465 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Unable to find image '%s:latest' locally", repo))
|
|
| 466 | 466 |
|
| 467 | 467 |
// There should be only one line for repo, the one with repo:latest |
| 468 | 468 |
outImageCmd, _ := dockerCmd(c, "images", repo) |
| 469 | 469 |
splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n") |
| 470 |
- c.Assert(splitOutImageCmd, checker.HasLen, 2) |
|
| 470 |
+ assert.Assert(c, splitOutImageCmd, checker.HasLen, 2) |
|
| 471 | 471 |
} |
| ... | ... |
@@ -27,12 +27,12 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
|
| 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 |
- c.Assert(out, checker.Contains, errSubstr, check.Commentf("Container: %q", cleanedContainerID))
|
|
| 30 |
+ assert.Assert(c, out, checker.Contains, errSubstr, check.Commentf("Container: %q", cleanedContainerID))
|
|
| 31 | 31 |
|
| 32 | 32 |
// make sure it didn't delete the busybox name |
| 33 | 33 |
images, _ := dockerCmd(c, "images") |
| 34 | 34 |
// The name 'busybox' should not have been removed from images |
| 35 |
- c.Assert(images, checker.Contains, "busybox") |
|
| 35 |
+ assert.Assert(c, images, checker.Contains, "busybox") |
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
func (s *DockerSuite) TestRmiTag(c *check.C) {
|
| ... | ... |
@@ -42,23 +42,23 @@ func (s *DockerSuite) TestRmiTag(c *check.C) {
|
| 42 | 42 |
dockerCmd(c, "tag", "busybox", "utest:5000/docker:tag3") |
| 43 | 43 |
{
|
| 44 | 44 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 45 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+3, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 45 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+3, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 46 | 46 |
} |
| 47 | 47 |
dockerCmd(c, "rmi", "utest/docker:tag2") |
| 48 | 48 |
{
|
| 49 | 49 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 50 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+2, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 50 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+2, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 51 | 51 |
} |
| 52 | 52 |
dockerCmd(c, "rmi", "utest:5000/docker:tag3") |
| 53 | 53 |
{
|
| 54 | 54 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 55 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+1, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 55 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+1, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 56 | 56 |
|
| 57 | 57 |
} |
| 58 | 58 |
dockerCmd(c, "rmi", "utest:tag1") |
| 59 | 59 |
{
|
| 60 | 60 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |
| 61 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n"), check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 61 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n"), check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 62 | 62 |
|
| 63 | 63 |
} |
| 64 | 64 |
} |
| ... | ... |
@@ -81,7 +81,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 81 | 81 |
|
| 82 | 82 |
imagesAfter := cli.DockerCmd(c, "images", "-a").Combined() |
| 83 | 83 |
// tag busybox to create 2 more images with same imageID |
| 84 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+2, check.Commentf("docker images shows: %q\n", imagesAfter))
|
|
| 84 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+2, check.Commentf("docker images shows: %q\n", imagesAfter))
|
|
| 85 | 85 |
|
| 86 | 86 |
imgID := inspectField(c, "busybox-one:tag1", "Id") |
| 87 | 87 |
|
| ... | ... |
@@ -101,7 +101,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 101 | 101 |
|
| 102 | 102 |
imagesAfter = cli.DockerCmd(c, "images", "-a").Combined() |
| 103 | 103 |
// rmi -f failed, image still exists |
| 104 |
- c.Assert(imagesAfter, checker.Not(checker.Contains), imgID[:12], check.Commentf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter))
|
|
| 104 |
+ assert.Assert(c, imagesAfter, checker.Not(checker.Contains), imgID[:12], check.Commentf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter))
|
|
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 | 107 |
func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| ... | ... |
@@ -123,7 +123,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| 123 | 123 |
cli.DockerCmd(c, "tag", "busybox-test", "utest:5000/docker:tag4") |
| 124 | 124 |
{
|
| 125 | 125 |
imagesAfter := cli.DockerCmd(c, "images", "-a").Combined() |
| 126 |
- c.Assert(strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+4, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 126 |
+ assert.Assert(c, strings.Count(imagesAfter, "\n"), checker.Equals, strings.Count(imagesBefore, "\n")+4, check.Commentf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
|
|
| 127 | 127 |
} |
| 128 | 128 |
imgID := inspectField(c, "busybox-test", "Id") |
| 129 | 129 |
|
| ... | ... |
@@ -137,7 +137,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| 137 | 137 |
{
|
| 138 | 138 |
imagesAfter := cli.DockerCmd(c, "images", "-a").Combined() |
| 139 | 139 |
// rmi failed, image still exists |
| 140 |
- c.Assert(imagesAfter, checker.Not(checker.Contains), imgID[:12]) |
|
| 140 |
+ assert.Assert(c, imagesAfter, checker.Not(checker.Contains), imgID[:12]) |
|
| 141 | 141 |
} |
| 142 | 142 |
} |
| 143 | 143 |
|
| ... | ... |
@@ -154,7 +154,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c |
| 154 | 154 |
out, _, err := dockerCmdWithError("rmi", "-f", imgID)
|
| 155 | 155 |
// rmi -f should not delete image with running containers |
| 156 | 156 |
assert.ErrorContains(c, err, "") |
| 157 |
- c.Assert(out, checker.Contains, "(cannot be forced) - image is being used by running container") |
|
| 157 |
+ assert.Assert(c, out, checker.Contains, "(cannot be forced) - image is being used by running container") |
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
|
| ... | ... |
@@ -166,7 +166,7 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
|
| 166 | 166 |
dockerCmd(c, "run", "--name", container, bb, "/bin/true") |
| 167 | 167 |
|
| 168 | 168 |
out, _ := dockerCmd(c, "rmi", newtag) |
| 169 |
- c.Assert(strings.Count(out, "Untagged: "), checker.Equals, 1) |
|
| 169 |
+ assert.Assert(c, strings.Count(out, "Untagged: "), checker.Equals, 1) |
|
| 170 | 170 |
} |
| 171 | 171 |
|
| 172 | 172 |
func (s *DockerSuite) TestRmiForceWithExistingContainers(c *check.C) {
|
| ... | ... |
@@ -194,7 +194,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
|
| 194 | 194 |
dockerCmd(c, "commit", "test", newTag) |
| 195 | 195 |
|
| 196 | 196 |
out, _ := dockerCmd(c, "rmi", newTag) |
| 197 |
- c.Assert(out, checker.Contains, "Untagged: "+newTag) |
|
| 197 |
+ assert.Assert(c, out, checker.Contains, "Untagged: "+newTag) |
|
| 198 | 198 |
} |
| 199 | 199 |
|
| 200 | 200 |
func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) {
|
| ... | ... |
@@ -207,12 +207,12 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) {
|
| 207 | 207 |
dockerCmd(c, "tag", tag1, tag2) |
| 208 | 208 |
|
| 209 | 209 |
out, _ := dockerCmd(c, "rmi", "-f", tag2) |
| 210 |
- c.Assert(out, checker.Contains, "Untagged: "+tag2) |
|
| 211 |
- c.Assert(out, checker.Not(checker.Contains), "Untagged: "+tag1) |
|
| 210 |
+ assert.Assert(c, out, checker.Contains, "Untagged: "+tag2) |
|
| 211 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "Untagged: "+tag1) |
|
| 212 | 212 |
|
| 213 | 213 |
// Check built image still exists |
| 214 | 214 |
images, _ := dockerCmd(c, "images", "-a") |
| 215 |
- c.Assert(images, checker.Contains, imageName, check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
| 215 |
+ assert.Assert(c, images, checker.Contains, imageName, check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 | 218 |
func (s *DockerSuite) TestRmiBlank(c *check.C) {
|
| ... | ... |
@@ -220,9 +220,9 @@ func (s *DockerSuite) TestRmiBlank(c *check.C) {
|
| 220 | 220 |
// Should have failed to delete ' ' image |
| 221 | 221 |
assert.ErrorContains(c, err, "") |
| 222 | 222 |
// Wrong error message generated |
| 223 |
- c.Assert(out, checker.Not(checker.Contains), "no such id", check.Commentf("out: %s", out))
|
|
| 223 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "no such id", check.Commentf("out: %s", out))
|
|
| 224 | 224 |
// Expected error message not generated |
| 225 |
- c.Assert(out, checker.Contains, "image name cannot be blank", check.Commentf("out: %s", out))
|
|
| 225 |
+ assert.Assert(c, out, checker.Contains, "image name cannot be blank", check.Commentf("out: %s", out))
|
|
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 | 228 |
func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
|
| ... | ... |
@@ -247,7 +247,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
|
| 247 | 247 |
out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
|
| 248 | 248 |
// The image of the running container should not be removed. |
| 249 | 249 |
assert.ErrorContains(c, err, "") |
| 250 |
- c.Assert(out, checker.Contains, "image is being used by running container", check.Commentf("out: %s", out))
|
|
| 250 |
+ assert.Assert(c, out, checker.Contains, "image is being used by running container", check.Commentf("out: %s", out))
|
|
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 | 253 |
// #13422 |
| ... | ... |
@@ -274,7 +274,7 @@ RUN echo 2 #layer2 |
| 274 | 274 |
// See if the "tmp2" can be untagged. |
| 275 | 275 |
out, _ = dockerCmd(c, "rmi", newTag) |
| 276 | 276 |
// Expected 1 untagged entry |
| 277 |
- c.Assert(strings.Count(out, "Untagged: "), checker.Equals, 1, check.Commentf("out: %s", out))
|
|
| 277 |
+ assert.Assert(c, strings.Count(out, "Untagged: "), checker.Equals, 1, check.Commentf("out: %s", out))
|
|
| 278 | 278 |
|
| 279 | 279 |
// Now let's add the tag again and create a container based on it. |
| 280 | 280 |
dockerCmd(c, "tag", idToTag, newTag) |
| ... | ... |
@@ -286,13 +286,13 @@ RUN echo 2 #layer2 |
| 286 | 286 |
out, _, err := dockerCmdWithError("rmi", newTag)
|
| 287 | 287 |
// should not be untagged without the -f flag |
| 288 | 288 |
assert.ErrorContains(c, err, "") |
| 289 |
- c.Assert(out, checker.Contains, cid[:12]) |
|
| 290 |
- c.Assert(out, checker.Contains, "(must force)") |
|
| 289 |
+ assert.Assert(c, out, checker.Contains, cid[:12]) |
|
| 290 |
+ assert.Assert(c, out, checker.Contains, "(must force)") |
|
| 291 | 291 |
|
| 292 | 292 |
// Add the -f flag and test again. |
| 293 | 293 |
out, _ = dockerCmd(c, "rmi", "-f", newTag) |
| 294 | 294 |
// should be allowed to untag with the -f flag |
| 295 |
- c.Assert(out, checker.Contains, fmt.Sprintf("Untagged: %s:latest", newTag))
|
|
| 295 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("Untagged: %s:latest", newTag))
|
|
| 296 | 296 |
} |
| 297 | 297 |
|
| 298 | 298 |
func (*DockerSuite) TestRmiParentImageFail(c *check.C) {
|
| ... | ... |
@@ -335,5 +335,5 @@ func (s *DockerSuite) TestRmiByIDHardConflict(c *check.C) {
|
| 335 | 335 |
|
| 336 | 336 |
// check that tag was not removed |
| 337 | 337 |
imgID2 := inspectField(c, "busybox:latest", "Id") |
| 338 |
- c.Assert(imgID, checker.Equals, imgID2) |
|
| 338 |
+ assert.Assert(c, imgID, checker.Equals, imgID2) |
|
| 339 | 339 |
} |
| ... | ... |
@@ -211,13 +211,13 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) {
|
| 211 | 211 |
dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") |
| 212 | 212 |
|
| 213 | 213 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=first", "busybox", "top") |
| 214 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 214 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 215 | 215 |
|
| 216 | 216 |
// run a container in user-defined network udlinkNet with a link for an existing container |
| 217 | 217 |
// and a link for a container that doesn't exist |
| 218 | 218 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=second", "--link=first:foo", |
| 219 | 219 |
"--link=third:bar", "busybox", "top") |
| 220 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 220 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 221 | 221 |
|
| 222 | 222 |
// ping to first and its alias foo must succeed |
| 223 | 223 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -233,7 +233,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) {
|
| 233 | 233 |
|
| 234 | 234 |
// start third container now |
| 235 | 235 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=third", "busybox", "top") |
| 236 |
- c.Assert(waitRun("third"), check.IsNil)
|
|
| 236 |
+ assert.Assert(c, waitRun("third"), check.IsNil)
|
|
| 237 | 237 |
|
| 238 | 238 |
// ping to third and its alias must succeed now |
| 239 | 239 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "third")
|
| ... | ... |
@@ -247,11 +247,11 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
|
| 247 | 247 |
dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") |
| 248 | 248 |
|
| 249 | 249 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=first", "busybox", "top") |
| 250 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 250 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 251 | 251 |
|
| 252 | 252 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=second", "--link=first:foo", |
| 253 | 253 |
"busybox", "top") |
| 254 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 254 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 255 | 255 |
|
| 256 | 256 |
// ping to first and its alias foo must succeed |
| 257 | 257 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -261,7 +261,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
|
| 261 | 261 |
|
| 262 | 262 |
// Restart first container |
| 263 | 263 |
dockerCmd(c, "restart", "first") |
| 264 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 264 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 265 | 265 |
|
| 266 | 266 |
// ping to first and its alias foo must still succeed |
| 267 | 267 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -271,7 +271,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
|
| 271 | 271 |
|
| 272 | 272 |
// Restart second container |
| 273 | 273 |
dockerCmd(c, "restart", "second") |
| 274 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 274 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 275 | 275 |
|
| 276 | 276 |
// ping to first and its alias foo must still succeed |
| 277 | 277 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -287,7 +287,7 @@ func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *check.C) {
|
| 287 | 287 |
for _, net := range defaults {
|
| 288 | 288 |
out, _, err := dockerCmdWithError("run", "-d", "--net", net, "--net-alias", "alias_"+net, "busybox", "top")
|
| 289 | 289 |
assert.ErrorContains(c, err, "") |
| 290 |
- c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 290 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 291 | 291 |
} |
| 292 | 292 |
} |
| 293 | 293 |
|
| ... | ... |
@@ -296,20 +296,20 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) {
|
| 296 | 296 |
dockerCmd(c, "network", "create", "-d", "bridge", "net1") |
| 297 | 297 |
|
| 298 | 298 |
cid1, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=first", "--net-alias=foo1", "--net-alias=foo2", "busybox:glibc", "top") |
| 299 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 299 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 300 | 300 |
|
| 301 | 301 |
// Check if default short-id alias is added automatically |
| 302 | 302 |
id := strings.TrimSpace(cid1) |
| 303 | 303 |
aliases := inspectField(c, id, "NetworkSettings.Networks.net1.Aliases") |
| 304 |
- c.Assert(aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 304 |
+ assert.Assert(c, aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 305 | 305 |
|
| 306 | 306 |
cid2, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=second", "busybox:glibc", "top") |
| 307 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 307 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 308 | 308 |
|
| 309 | 309 |
// Check if default short-id alias is added automatically |
| 310 | 310 |
id = strings.TrimSpace(cid2) |
| 311 | 311 |
aliases = inspectField(c, id, "NetworkSettings.Networks.net1.Aliases") |
| 312 |
- c.Assert(aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 312 |
+ assert.Assert(c, aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 313 | 313 |
|
| 314 | 314 |
// ping to first and its network-scoped aliases |
| 315 | 315 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -324,7 +324,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) {
|
| 324 | 324 |
|
| 325 | 325 |
// Restart first container |
| 326 | 326 |
dockerCmd(c, "restart", "first") |
| 327 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 327 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 328 | 328 |
|
| 329 | 329 |
// ping to first and its network-scoped aliases must succeed |
| 330 | 330 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -342,7 +342,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) {
|
| 342 | 342 |
func (s *DockerSuite) TestRunWithDaemonFlags(c *check.C) {
|
| 343 | 343 |
out, _, err := dockerCmdWithError("--exec-opt", "foo=bar", "run", "-i", "busybox", "true")
|
| 344 | 344 |
assert.ErrorContains(c, err, "") |
| 345 |
- c.Assert(out, checker.Contains, "unknown flag: --exec-opt") |
|
| 345 |
+ assert.Assert(c, out, checker.Contains, "unknown flag: --exec-opt") |
|
| 346 | 346 |
} |
| 347 | 347 |
|
| 348 | 348 |
// Regression test for #4979 |
| ... | ... |
@@ -2292,8 +2292,8 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *check.C) {
|
| 2292 | 2292 |
|
| 2293 | 2293 |
func (s *DockerSuite) TestRunExposePort(c *check.C) {
|
| 2294 | 2294 |
out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
|
| 2295 |
- c.Assert(err, checker.NotNil, check.Commentf("--expose with an invalid port should error out"))
|
|
| 2296 |
- c.Assert(out, checker.Contains, "invalid range format for --expose") |
|
| 2295 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("--expose with an invalid port should error out"))
|
|
| 2296 |
+ assert.Assert(c, out, checker.Contains, "invalid range format for --expose") |
|
| 2297 | 2297 |
} |
| 2298 | 2298 |
|
| 2299 | 2299 |
func (s *DockerSuite) TestRunModeIpcHost(c *check.C) {
|
| ... | ... |
@@ -2476,7 +2476,7 @@ func (s *DockerSuite) TestRunModeUTSHost(c *check.C) {
|
| 2476 | 2476 |
} |
| 2477 | 2477 |
|
| 2478 | 2478 |
out, _ = dockerCmdWithFail(c, "run", "-h=name", "--uts=host", "busybox", "ps") |
| 2479 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictUTSHostname.Error()) |
|
| 2479 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictUTSHostname.Error()) |
|
| 2480 | 2480 |
} |
| 2481 | 2481 |
|
| 2482 | 2482 |
func (s *DockerSuite) TestRunTLSVerify(c *check.C) {
|
| ... | ... |
@@ -2813,7 +2813,7 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *check.C) {
|
| 2813 | 2813 |
name := "ibuildthecloud" |
| 2814 | 2814 |
dockerCmd(c, "run", "-d", "--pid=host", "--name", name, "busybox", "sh", "-c", "sleep 30; echo hi") |
| 2815 | 2815 |
|
| 2816 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 2816 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 2817 | 2817 |
|
| 2818 | 2818 |
errchan := make(chan error) |
| 2819 | 2819 |
go func() {
|
| ... | ... |
@@ -3208,11 +3208,11 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *check.C) {
|
| 3208 | 3208 |
testRequires(c, DaemonIsLinux) |
| 3209 | 3209 |
name := "unique_name" |
| 3210 | 3210 |
_, _, err := dockerCmdWithError("run", "--name", name, "--link", "nothing:nothing", "busybox")
|
| 3211 |
- c.Assert(err, check.NotNil, check.Commentf("Expected docker run to fail!"))
|
|
| 3211 |
+ assert.Assert(c, err, check.NotNil, check.Commentf("Expected docker run to fail!"))
|
|
| 3212 | 3212 |
|
| 3213 | 3213 |
containerID, err := inspectFieldWithError(name, "Id") |
| 3214 |
- c.Assert(err, checker.NotNil, check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3215 |
- c.Assert(containerID, check.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3214 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3215 |
+ assert.Assert(c, containerID, check.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3216 | 3216 |
} |
| 3217 | 3217 |
|
| 3218 | 3218 |
func (s *DockerSuite) TestRunNamedVolume(c *check.C) {
|
| ... | ... |
@@ -3221,10 +3221,10 @@ func (s *DockerSuite) TestRunNamedVolume(c *check.C) {
|
| 3221 | 3221 |
dockerCmd(c, "run", "--name=test", "-v", "testing:"+prefix+"/foo", "busybox", "sh", "-c", "echo hello > "+prefix+"/foo/bar") |
| 3222 | 3222 |
|
| 3223 | 3223 |
out, _ := dockerCmd(c, "run", "--volumes-from", "test", "busybox", "sh", "-c", "cat "+prefix+"/foo/bar") |
| 3224 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello") |
|
| 3224 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3225 | 3225 |
|
| 3226 | 3226 |
out, _ = dockerCmd(c, "run", "-v", "testing:"+prefix+"/foo", "busybox", "sh", "-c", "cat "+prefix+"/foo/bar") |
| 3227 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello") |
|
| 3227 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3228 | 3228 |
} |
| 3229 | 3229 |
|
| 3230 | 3230 |
func (s *DockerSuite) TestRunWithUlimits(c *check.C) {
|
| ... | ... |
@@ -3464,7 +3464,7 @@ func (s *DockerSuite) TestContainersInUserDefinedNetwork(c *check.C) {
|
| 3464 | 3464 |
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) |
| 3465 | 3465 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork") |
| 3466 | 3466 |
dockerCmd(c, "run", "-d", "--net=testnetwork", "--name=first", "busybox", "top") |
| 3467 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3467 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3468 | 3468 |
dockerCmd(c, "run", "-t", "--net=testnetwork", "--name=second", "busybox", "ping", "-c", "1", "first") |
| 3469 | 3469 |
} |
| 3470 | 3470 |
|
| ... | ... |
@@ -3475,9 +3475,9 @@ func (s *DockerSuite) TestContainersInMultipleNetworks(c *check.C) {
|
| 3475 | 3475 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork2") |
| 3476 | 3476 |
// Run and connect containers to testnetwork1 |
| 3477 | 3477 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3478 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3478 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3479 | 3479 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3480 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3480 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3481 | 3481 |
// Check connectivity between containers in testnetwork2 |
| 3482 | 3482 |
dockerCmd(c, "exec", "first", "ping", "-c", "1", "second.testnetwork1") |
| 3483 | 3483 |
// Connect containers to testnetwork2 |
| ... | ... |
@@ -3494,9 +3494,9 @@ func (s *DockerSuite) TestContainersNetworkIsolation(c *check.C) {
|
| 3494 | 3494 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork2") |
| 3495 | 3495 |
// Run 1 container in testnetwork1 and another in testnetwork2 |
| 3496 | 3496 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3497 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3497 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3498 | 3498 |
dockerCmd(c, "run", "-d", "--net=testnetwork2", "--name=second", "busybox", "top") |
| 3499 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3499 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3500 | 3500 |
|
| 3501 | 3501 |
// Check Isolation between containers : ping must fail |
| 3502 | 3502 |
_, _, err := dockerCmdWithError("exec", "first", "ping", "-c", "1", "second")
|
| ... | ... |
@@ -3520,9 +3520,9 @@ func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *check.C) {
|
| 3520 | 3520 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| 3521 | 3521 |
// Run and connect containers to testnetwork1 |
| 3522 | 3522 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3523 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3523 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3524 | 3524 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3525 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3525 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3526 | 3526 |
// Network delete with active containers must fail |
| 3527 | 3527 |
_, _, err := dockerCmdWithError("network", "rm", "testnetwork1")
|
| 3528 | 3528 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -3540,9 +3540,9 @@ func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *check.C) {
|
| 3540 | 3540 |
|
| 3541 | 3541 |
// Run and connect containers to testnetwork1 |
| 3542 | 3542 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3543 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3543 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3544 | 3544 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3545 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3545 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3546 | 3546 |
// Check connectivity between containers in testnetwork2 |
| 3547 | 3547 |
dockerCmd(c, "exec", "first", "ping", "-c", "1", "second.testnetwork1") |
| 3548 | 3548 |
// Connect containers to testnetwork2 |
| ... | ... |
@@ -3568,7 +3568,7 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *check.C) {
|
| 3568 | 3568 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 3569 | 3569 |
// Run a container with --net=host |
| 3570 | 3570 |
dockerCmd(c, "run", "-d", "--net=host", "--name=first", "busybox", "top") |
| 3571 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3571 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3572 | 3572 |
|
| 3573 | 3573 |
// Create a network using bridge driver |
| 3574 | 3574 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3581,10 +3581,10 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *check.C) {
|
| 3581 | 3581 |
func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) {
|
| 3582 | 3582 |
testRequires(c, DaemonIsLinux) |
| 3583 | 3583 |
dockerCmd(c, "run", "-d", "--name=first", "busybox", "top") |
| 3584 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3584 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3585 | 3585 |
// Run second container in first container's network namespace |
| 3586 | 3586 |
dockerCmd(c, "run", "-d", "--net=container:first", "--name=second", "busybox", "top") |
| 3587 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3587 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3588 | 3588 |
|
| 3589 | 3589 |
// Create a network using bridge driver |
| 3590 | 3590 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3592,13 +3592,13 @@ func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) {
|
| 3592 | 3592 |
// Connecting to the user defined network must fail |
| 3593 | 3593 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "second")
|
| 3594 | 3594 |
assert.ErrorContains(c, err, "") |
| 3595 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictSharedNetwork.Error()) |
|
| 3595 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictSharedNetwork.Error()) |
|
| 3596 | 3596 |
} |
| 3597 | 3597 |
|
| 3598 | 3598 |
func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) {
|
| 3599 | 3599 |
testRequires(c, DaemonIsLinux) |
| 3600 | 3600 |
dockerCmd(c, "run", "-d", "--net=none", "--name=first", "busybox", "top") |
| 3601 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 3601 |
+ assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3602 | 3602 |
|
| 3603 | 3603 |
// Create a network using bridge driver |
| 3604 | 3604 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3606,11 +3606,11 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) {
|
| 3606 | 3606 |
// Connecting to the user defined network must fail |
| 3607 | 3607 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
|
| 3608 | 3608 |
assert.ErrorContains(c, err, "") |
| 3609 |
- c.Assert(out, checker.Contains, runconfig.ErrConflictNoNetwork.Error()) |
|
| 3609 |
+ assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNoNetwork.Error()) |
|
| 3610 | 3610 |
|
| 3611 | 3611 |
// create a container connected to testnetwork1 |
| 3612 | 3612 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3613 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 3613 |
+ assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3614 | 3614 |
|
| 3615 | 3615 |
// Connect second container to none network. it must fail as well |
| 3616 | 3616 |
_, _, err = dockerCmdWithError("network", "connect", "none", "second")
|
| ... | ... |
@@ -3626,7 +3626,7 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) {
|
| 3626 | 3626 |
stdout := bytes.NewBuffer(nil) |
| 3627 | 3627 |
cmd.Stdout = stdout |
| 3628 | 3628 |
cmd.Stderr = stdout |
| 3629 |
- c.Assert(cmd.Start(), check.IsNil) |
|
| 3629 |
+ assert.Assert(c, cmd.Start(), check.IsNil) |
|
| 3630 | 3630 |
|
| 3631 | 3631 |
waitChan := make(chan error) |
| 3632 | 3632 |
go func() {
|
| ... | ... |
@@ -3635,7 +3635,7 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) {
|
| 3635 | 3635 |
|
| 3636 | 3636 |
select {
|
| 3637 | 3637 |
case err := <-waitChan: |
| 3638 |
- c.Assert(err, check.IsNil, check.Commentf(stdout.String())) |
|
| 3638 |
+ assert.Assert(c, err, check.IsNil, check.Commentf(stdout.String())) |
|
| 3639 | 3639 |
case <-time.After(30 * time.Second): |
| 3640 | 3640 |
c.Fatal("timeout waiting for command to exit")
|
| 3641 | 3641 |
} |
| ... | ... |
@@ -3855,8 +3855,8 @@ func (s *DockerSuite) TestRunVolumesMountedAsSlave(c *check.C) {
|
| 3855 | 3855 |
func (s *DockerSuite) TestRunNamedVolumesMountedAsShared(c *check.C) {
|
| 3856 | 3856 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 3857 | 3857 |
out, exitCode, _ := dockerCmdWithError("run", "-v", "foo:/test:shared", "busybox", "touch", "/test/somefile")
|
| 3858 |
- c.Assert(exitCode, checker.Not(checker.Equals), 0) |
|
| 3859 |
- c.Assert(out, checker.Contains, "invalid mount config") |
|
| 3858 |
+ assert.Assert(c, exitCode, checker.Not(checker.Equals), 0) |
|
| 3859 |
+ assert.Assert(c, out, checker.Contains, "invalid mount config") |
|
| 3860 | 3860 |
} |
| 3861 | 3861 |
|
| 3862 | 3862 |
func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *check.C) {
|
| ... | ... |
@@ -3870,7 +3870,7 @@ func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *check.C) {
|
| 3870 | 3870 |
|
| 3871 | 3871 |
dockerCmd(c, "run", "-v", "foo:/foo", testImg) |
| 3872 | 3872 |
out, _ := dockerCmd(c, "run", "-v", "foo:/foo", "busybox", "cat", "/foo/hello") |
| 3873 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello") |
|
| 3873 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3874 | 3874 |
} |
| 3875 | 3875 |
|
| 3876 | 3876 |
func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) {
|
| ... | ... |
@@ -3909,7 +3909,7 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
|
| 3909 | 3909 |
vname = v.Name |
| 3910 | 3910 |
} |
| 3911 | 3911 |
} |
| 3912 |
- c.Assert(vname, checker.Not(checker.Equals), "") |
|
| 3912 |
+ assert.Assert(c, vname, checker.Not(checker.Equals), "") |
|
| 3913 | 3913 |
|
| 3914 | 3914 |
// Remove the parent so there are not other references to the volumes |
| 3915 | 3915 |
dockerCmd(c, "rm", "-f", "parent") |
| ... | ... |
@@ -3918,7 +3918,7 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
|
| 3918 | 3918 |
dockerCmd(c, "volume", "inspect", "test") |
| 3919 | 3919 |
out, _ := dockerCmd(c, "volume", "ls", "-q") |
| 3920 | 3920 |
assert.Assert(c, strings.Contains(out, "test")) |
| 3921 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), vname) |
|
| 3921 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), vname) |
|
| 3922 | 3922 |
} |
| 3923 | 3923 |
|
| 3924 | 3924 |
func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
|
| ... | ... |
@@ -3942,16 +3942,16 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
|
| 3942 | 3942 |
runSleepingContainer(c, "--name=test", "-p", "8000:8000") |
| 3943 | 3943 |
|
| 3944 | 3944 |
// Wait until container is fully up and running |
| 3945 |
- c.Assert(waitRun("test"), check.IsNil)
|
|
| 3945 |
+ assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 3946 | 3946 |
|
| 3947 | 3947 |
out, _, err := dockerCmdWithError("run", "--name=fail", "-p", "8000:8000", "busybox", "true")
|
| 3948 | 3948 |
// We will need the following `inspect` to diagnose the issue if test fails (#21247) |
| 3949 | 3949 |
out1, err1 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "test")
|
| 3950 | 3950 |
out2, err2 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "fail")
|
| 3951 |
- c.Assert(err, checker.NotNil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
|
|
| 3951 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
|
|
| 3952 | 3952 |
// check for windows error as well |
| 3953 | 3953 |
// TODO Windows Post TP5. Fix the error message string |
| 3954 |
- c.Assert(strings.Contains(string(out), "port is already allocated") || |
|
| 3954 |
+ assert.Assert(c, strings.Contains(string(out), "port is already allocated") || |
|
| 3955 | 3955 |
strings.Contains(string(out), "were not connected because a duplicate name exists") || |
| 3956 | 3956 |
strings.Contains(string(out), "The specified port already exists") || |
| 3957 | 3957 |
strings.Contains(string(out), "HNS failed with error : Failed to create endpoint") || |
| ... | ... |
@@ -3959,7 +3959,7 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
|
| 3959 | 3959 |
dockerCmd(c, "rm", "-f", "test") |
| 3960 | 3960 |
|
| 3961 | 3961 |
// NGoroutines is not updated right away, so we need to wait before failing |
| 3962 |
- c.Assert(waitForGoroutines(nroutines), checker.IsNil) |
|
| 3962 |
+ assert.Assert(c, waitForGoroutines(nroutines), checker.IsNil) |
|
| 3963 | 3963 |
} |
| 3964 | 3964 |
|
| 3965 | 3965 |
// Test for one character directory name case (#20122) |
| ... | ... |
@@ -4034,9 +4034,9 @@ func (s *DockerSuite) TestRunDNSInHostMode(c *check.C) {
|
| 4034 | 4034 |
expectedOutput2 := "search example.com" |
| 4035 | 4035 |
expectedOutput3 := "options timeout:3" |
| 4036 | 4036 |
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() |
| 4037 |
- c.Assert(out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4038 |
- c.Assert(out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4039 |
- c.Assert(out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4037 |
+ assert.Assert(c, out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4038 |
+ assert.Assert(c, out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4039 |
+ assert.Assert(c, out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4040 | 4040 |
} |
| 4041 | 4041 |
|
| 4042 | 4042 |
// Test case for #21976 |
| ... | ... |
@@ -4045,16 +4045,16 @@ func (s *DockerSuite) TestRunAddHostInHostMode(c *check.C) {
|
| 4045 | 4045 |
|
| 4046 | 4046 |
expectedOutput := "1.2.3.4\textra" |
| 4047 | 4047 |
out, _ := dockerCmd(c, "run", "--add-host=extra:1.2.3.4", "--net=host", "busybox", "cat", "/etc/hosts") |
| 4048 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4048 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4049 | 4049 |
} |
| 4050 | 4050 |
|
| 4051 | 4051 |
func (s *DockerSuite) TestRunRmAndWait(c *check.C) {
|
| 4052 | 4052 |
dockerCmd(c, "run", "--name=test", "--rm", "-d", "busybox", "sh", "-c", "sleep 3;exit 2") |
| 4053 | 4053 |
|
| 4054 | 4054 |
out, code, err := dockerCmdWithError("wait", "test")
|
| 4055 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %s; exit code: %d", out, code))
|
|
| 4055 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %s; exit code: %d", out, code))
|
|
| 4056 | 4056 |
assert.Equal(c, out, "2\n", "exit code: %d", code) |
| 4057 |
- c.Assert(code, checker.Equals, 0) |
|
| 4057 |
+ assert.Assert(c, code, checker.Equals, 0) |
|
| 4058 | 4058 |
} |
| 4059 | 4059 |
|
| 4060 | 4060 |
// Test that auto-remove is performed by the daemon (API 1.25 and above) |
| ... | ... |
@@ -4102,7 +4102,7 @@ exec "$@"`, |
| 4102 | 4102 |
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4103 | 4103 |
|
| 4104 | 4104 |
out := cli.DockerCmd(c, "run", "--entrypoint=", "-t", name, "echo", "foo").Combined() |
| 4105 |
- c.Assert(strings.TrimSpace(out), check.Equals, "foo") |
|
| 4105 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "foo") |
|
| 4106 | 4106 |
|
| 4107 | 4107 |
// CMD will be reset as well (the same as setting a custom entrypoint) |
| 4108 | 4108 |
cli.Docker(cli.Args("run", "--entrypoint=", "-t", name)).Assert(c, icmd.Expected{
|
| ... | ... |
@@ -4121,7 +4121,7 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *check.C) {
|
| 4121 | 4121 |
|
| 4122 | 4122 |
out, err := s.d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
|
| 4123 | 4123 |
assert.NilError(c, err) |
| 4124 |
- c.Assert(out, checker.Contains, "[nofile=65535:65535]") |
|
| 4124 |
+ assert.Assert(c, out, checker.Contains, "[nofile=65535:65535]") |
|
| 4125 | 4125 |
|
| 4126 | 4126 |
name = "test-B" |
| 4127 | 4127 |
_, err = s.d.Cmd("run", "--name", name, "--ulimit=nofile=42", "-d", "busybox", "top")
|
| ... | ... |
@@ -4139,10 +4139,10 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
|
| 4139 | 4139 |
|
| 4140 | 4140 |
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
|
| 4141 | 4141 |
assert.ErrorContains(c, err, "") |
| 4142 |
- c.Assert(out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4142 |
+ assert.Assert(c, out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4143 | 4143 |
|
| 4144 | 4144 |
// NGoroutines is not updated right away, so we need to wait before failing |
| 4145 |
- c.Assert(waitForGoroutines(nroutines), checker.IsNil) |
|
| 4145 |
+ assert.Assert(c, waitForGoroutines(nroutines), checker.IsNil) |
|
| 4146 | 4146 |
} |
| 4147 | 4147 |
|
| 4148 | 4148 |
// Handles error conditions for --credentialspec. Validating E2E success cases |
| ... | ... |
@@ -4160,8 +4160,8 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) {
|
| 4160 | 4160 |
} |
| 4161 | 4161 |
for _, attempt := range attempts {
|
| 4162 | 4162 |
_, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true")
|
| 4163 |
- c.Assert(err, checker.NotNil, check.Commentf("%s expected non-nil err", attempt.value))
|
|
| 4164 |
- c.Assert(err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4163 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("%s expected non-nil err", attempt.value))
|
|
| 4164 |
+ assert.Assert(c, err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4165 | 4165 |
} |
| 4166 | 4166 |
} |
| 4167 | 4167 |
|
| ... | ... |
@@ -4177,8 +4177,8 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
|
| 4177 | 4177 |
// controller handy |
| 4178 | 4178 |
out, _ := dockerCmd(c, "run", "--rm", "--security-opt=credentialspec="+value, minimalBaseImage(), "nltest", "/PARENTDOMAIN") |
| 4179 | 4179 |
|
| 4180 |
- c.Assert(out, checker.Contains, "hyperv.local.") |
|
| 4181 |
- c.Assert(out, checker.Contains, "The command completed successfully") |
|
| 4180 |
+ assert.Assert(c, out, checker.Contains, "hyperv.local.") |
|
| 4181 |
+ assert.Assert(c, out, checker.Contains, "The command completed successfully") |
|
| 4182 | 4182 |
} |
| 4183 | 4183 |
} |
| 4184 | 4184 |
|
| ... | ... |
@@ -4196,11 +4196,11 @@ func (s *DockerSuite) TestRunDuplicateMount(c *check.C) {
|
| 4196 | 4196 |
|
| 4197 | 4197 |
name := "test" |
| 4198 | 4198 |
out, _ := dockerCmd(c, "run", "--name", name, "-v", "/tmp:/tmp", "-v", "/tmp:/tmp", "busybox", "sh", "-c", "cat "+tmpFile.Name()+" && ls /") |
| 4199 |
- c.Assert(out, checker.Not(checker.Contains), "tmp:") |
|
| 4200 |
- c.Assert(out, checker.Contains, data) |
|
| 4199 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "tmp:") |
|
| 4200 |
+ assert.Assert(c, out, checker.Contains, data) |
|
| 4201 | 4201 |
|
| 4202 | 4202 |
out = inspectFieldJSON(c, name, "Config.Volumes") |
| 4203 |
- c.Assert(out, checker.Contains, "null") |
|
| 4203 |
+ assert.Assert(c, out, checker.Contains, "null") |
|
| 4204 | 4204 |
} |
| 4205 | 4205 |
|
| 4206 | 4206 |
func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) {
|
| ... | ... |
@@ -4237,9 +4237,9 @@ func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent( |
| 4237 | 4237 |
testRequires(c, DaemonIsWindows, IsolationIsProcess) |
| 4238 | 4238 |
|
| 4239 | 4239 |
out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") |
| 4240 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU shares on Windows Server Containers. CPU shares discarded") |
|
| 4241 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU percent on Windows Server Containers. CPU percent discarded") |
|
| 4242 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4240 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU shares on Windows Server Containers. CPU shares discarded") |
|
| 4241 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU percent on Windows Server Containers. CPU percent discarded") |
|
| 4242 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4243 | 4243 |
|
| 4244 | 4244 |
out = inspectField(c, "test", "HostConfig.CPUCount") |
| 4245 | 4245 |
assert.Equal(c, out, "1") |
| ... | ... |
@@ -4255,7 +4255,7 @@ func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c |
| 4255 | 4255 |
testRequires(c, DaemonIsWindows, IsolationIsHyperv) |
| 4256 | 4256 |
|
| 4257 | 4257 |
out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") |
| 4258 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4258 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4259 | 4259 |
|
| 4260 | 4260 |
out = inspectField(c, "test", "HostConfig.CPUCount") |
| 4261 | 4261 |
assert.Equal(c, out, "1") |
| ... | ... |
@@ -4327,7 +4327,7 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
|
| 4327 | 4327 |
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
|
| 4328 | 4328 |
"busybox", "touch", "/dev/shm/foo") |
| 4329 | 4329 |
assert.ErrorContains(c, err, "", out) |
| 4330 |
- c.Assert(out, checker.Contains, "Read-only file system") |
|
| 4330 |
+ assert.Assert(c, out, checker.Contains, "Read-only file system") |
|
| 4331 | 4331 |
} |
| 4332 | 4332 |
|
| 4333 | 4333 |
func (s *DockerSuite) TestRunMount(c *check.C) {
|
| ... | ... |
@@ -4495,11 +4495,11 @@ func (s *DockerSuite) TestRunMount(c *check.C) {
|
| 4495 | 4495 |
_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
|
| 4496 | 4496 |
append(opts, []string{"busybox", "top"}...)...)...)
|
| 4497 | 4497 |
if testCase.valid {
|
| 4498 |
- c.Assert(err, check.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4499 |
- c.Assert(testCase.fn(cName), check.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4498 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4499 |
+ assert.Assert(c, testCase.fn(cName), check.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4500 | 4500 |
dockerCmd(c, "rm", "-f", cName) |
| 4501 | 4501 |
} else {
|
| 4502 |
- c.Assert(err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4502 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
|
| 4503 | 4503 |
} |
| 4504 | 4504 |
} |
| 4505 | 4505 |
} |
| ... | ... |
@@ -4516,7 +4516,7 @@ func (s *DockerSuite) TestRunHostnameFQDN(c *check.C) {
|
| 4516 | 4516 |
|
| 4517 | 4517 |
out, _ = dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hosts`) |
| 4518 | 4518 |
expectedOutput = "foobar.example.com foobar" |
| 4519 |
- c.Assert(strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 4519 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 4520 | 4520 |
} |
| 4521 | 4521 |
|
| 4522 | 4522 |
// Test case for 29129 |
| ... | ... |
@@ -35,7 +35,7 @@ import ( |
| 35 | 35 |
func (s *DockerSuite) TestRunRedirectStdout(c *check.C) {
|
| 36 | 36 |
checkRedirect := func(command string) {
|
| 37 | 37 |
_, tty, err := pty.Open() |
| 38 |
- c.Assert(err, checker.IsNil, check.Commentf("Could not open pty"))
|
|
| 38 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Could not open pty"))
|
|
| 39 | 39 |
cmd := exec.Command("sh", "-c", command)
|
| 40 | 40 |
cmd.Stdin = tty |
| 41 | 41 |
cmd.Stdout = tty |
| ... | ... |
@@ -51,7 +51,7 @@ func (s *DockerSuite) TestRunRedirectStdout(c *check.C) {
|
| 51 | 51 |
case <-time.After(10 * time.Second): |
| 52 | 52 |
c.Fatal("command timeout")
|
| 53 | 53 |
case err := <-ch: |
| 54 |
- c.Assert(err, checker.IsNil, check.Commentf("wait err"))
|
|
| 54 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("wait err"))
|
|
| 55 | 55 |
} |
| 56 | 56 |
} |
| 57 | 57 |
|
| ... | ... |
@@ -70,15 +70,15 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) {
|
| 70 | 70 |
|
| 71 | 71 |
// Create a temporary tmpfs mount. |
| 72 | 72 |
tmpfsDir := filepath.Join(tmpDir, "tmpfs") |
| 73 |
- c.Assert(os.MkdirAll(tmpfsDir, 0777), checker.IsNil, check.Commentf("failed to mkdir at %s", tmpfsDir))
|
|
| 74 |
- c.Assert(mount.Mount("tmpfs", tmpfsDir, "tmpfs", ""), checker.IsNil, check.Commentf("failed to create a tmpfs mount at %s", tmpfsDir))
|
|
| 73 |
+ assert.Assert(c, os.MkdirAll(tmpfsDir, 0777), checker.IsNil, check.Commentf("failed to mkdir at %s", tmpfsDir))
|
|
| 74 |
+ assert.Assert(c, mount.Mount("tmpfs", tmpfsDir, "tmpfs", ""), checker.IsNil, check.Commentf("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) |
| 78 | 78 |
defer f.Close() |
| 79 | 79 |
|
| 80 | 80 |
out, _ := dockerCmd(c, "run", "--name", "test-data", "--volume", fmt.Sprintf("%s:/tmp:ro", tmpDir), "busybox:latest", "ls", "/tmp/tmpfs")
|
| 81 |
- c.Assert(out, checker.Contains, filepath.Base(f.Name()), check.Commentf("Recursive bind mount test failed. Expected file not found"))
|
|
| 81 |
+ assert.Assert(c, out, checker.Contains, filepath.Base(f.Name()), check.Commentf("Recursive bind mount test failed. Expected file not found"))
|
|
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 | 84 |
func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) {
|
| ... | ... |
@@ -88,10 +88,10 @@ func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) {
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
out, _ := dockerCmd(c, "run", "--device", "/dev/snd:/dev/snd", "busybox", "sh", "-c", "ls /dev/snd/") |
| 91 |
- c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "timer", check.Commentf("expected output /dev/snd/timer"))
|
|
| 91 |
+ assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "timer", check.Commentf("expected output /dev/snd/timer"))
|
|
| 92 | 92 |
|
| 93 | 93 |
out, _ = dockerCmd(c, "run", "--device", "/dev/snd:/dev/othersnd", "busybox", "sh", "-c", "ls /dev/othersnd/") |
| 94 |
- c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "seq", check.Commentf("expected output /dev/othersnd/seq"))
|
|
| 94 |
+ assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "seq", check.Commentf("expected output /dev/othersnd/seq"))
|
|
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
// TestRunAttachDetach checks attaching and detaching with the default escape sequence. |
| ... | ... |
@@ -108,7 +108,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
|
| 108 | 108 |
defer cpty.Close() |
| 109 | 109 |
cmd.Stdin = tty |
| 110 | 110 |
assert.NilError(c, cmd.Start()) |
| 111 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 111 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 112 | 112 |
|
| 113 | 113 |
_, err = cpty.Write([]byte("hello\n"))
|
| 114 | 114 |
assert.NilError(c, err) |
| ... | ... |
@@ -137,12 +137,12 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
|
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 | 139 |
running := inspectField(c, name, "State.Running") |
| 140 |
- c.Assert(running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 140 |
+ assert.Assert(c, running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 141 | 141 |
|
| 142 | 142 |
out, _ = dockerCmd(c, "events", "--since=0", "--until", daemonUnixTime(c), "-f", "container="+name) |
| 143 | 143 |
// attach and detach event should be monitored |
| 144 |
- c.Assert(out, checker.Contains, "attach") |
|
| 145 |
- c.Assert(out, checker.Contains, "detach") |
|
| 144 |
+ assert.Assert(c, out, checker.Contains, "attach") |
|
| 145 |
+ assert.Assert(c, out, checker.Contains, "detach") |
|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
// TestRunAttachDetachFromFlag checks attaching and detaching with the escape sequence specified via flags. |
| ... | ... |
@@ -167,7 +167,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *check.C) {
|
| 167 | 167 |
if err := cmd.Start(); err != nil {
|
| 168 | 168 |
c.Fatal(err) |
| 169 | 169 |
} |
| 170 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 170 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 171 | 171 |
|
| 172 | 172 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 173 | 173 |
c.Fatal(err) |
| ... | ... |
@@ -203,14 +203,14 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *check.C) {
|
| 203 | 203 |
} |
| 204 | 204 |
|
| 205 | 205 |
running := inspectField(c, name, "State.Running") |
| 206 |
- c.Assert(running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 206 |
+ assert.Assert(c, running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 207 | 207 |
} |
| 208 | 208 |
|
| 209 | 209 |
// TestRunAttachDetachFromInvalidFlag checks attaching and detaching with the escape sequence specified via flags. |
| 210 | 210 |
func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *check.C) {
|
| 211 | 211 |
name := "attach-detach" |
| 212 | 212 |
dockerCmd(c, "run", "--name", name, "-itd", "busybox", "top") |
| 213 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 213 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 214 | 214 |
|
| 215 | 215 |
// specify an invalid detach key, container will ignore it and use default |
| 216 | 216 |
cmd := exec.Command(dockerBinary, "attach", "--detach-keys=ctrl-A,a", name) |
| ... | ... |
@@ -283,7 +283,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) {
|
| 283 | 283 |
if err := cmd.Start(); err != nil {
|
| 284 | 284 |
c.Fatal(err) |
| 285 | 285 |
} |
| 286 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 286 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 287 | 287 |
|
| 288 | 288 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 289 | 289 |
c.Fatal(err) |
| ... | ... |
@@ -319,7 +319,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) {
|
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
running := inspectField(c, name, "State.Running") |
| 322 |
- c.Assert(running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 322 |
+ assert.Assert(c, running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 323 | 323 |
} |
| 324 | 324 |
|
| 325 | 325 |
// TestRunAttachDetachKeysOverrideConfig checks attaching and detaching with the detach flags, making sure it overrides config file |
| ... | ... |
@@ -366,7 +366,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) {
|
| 366 | 366 |
if err := cmd.Start(); err != nil {
|
| 367 | 367 |
c.Fatal(err) |
| 368 | 368 |
} |
| 369 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 369 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 370 | 370 |
|
| 371 | 371 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 372 | 372 |
c.Fatal(err) |
| ... | ... |
@@ -402,7 +402,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) {
|
| 402 | 402 |
} |
| 403 | 403 |
|
| 404 | 404 |
running := inspectField(c, name, "State.Running") |
| 405 |
- c.Assert(running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 405 |
+ assert.Assert(c, running, checker.Equals, "true", check.Commentf("expected container to still be running"))
|
|
| 406 | 406 |
} |
| 407 | 407 |
|
| 408 | 408 |
func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *check.C) {
|
| ... | ... |
@@ -427,7 +427,7 @@ func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *check.C) |
| 427 | 427 |
c.Fatal(err) |
| 428 | 428 |
} |
| 429 | 429 |
go cmd.Wait() |
| 430 |
- c.Assert(waitRun(name), check.IsNil) |
|
| 430 |
+ assert.Assert(c, waitRun(name), check.IsNil) |
|
| 431 | 431 |
|
| 432 | 432 |
// Invalid escape sequence aba, should print aba in output |
| 433 | 433 |
if _, err := cpty.Write(keyA); err != nil {
|
| ... | ... |
@@ -673,11 +673,11 @@ func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
|
| 673 | 673 |
out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
| 674 | 674 |
assert.ErrorContains(c, err, "") |
| 675 | 675 |
expected := "Valid memory swappiness range is 0-100" |
| 676 |
- c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 676 |
+ assert.Assert(c, out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 677 | 677 |
|
| 678 | 678 |
out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true")
|
| 679 | 679 |
assert.ErrorContains(c, err, "") |
| 680 |
- c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 680 |
+ assert.Assert(c, out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 681 | 681 |
} |
| 682 | 682 |
|
| 683 | 683 |
func (s *DockerSuite) TestRunWithMemoryReservation(c *check.C) {
|
| ... | ... |
@@ -697,24 +697,24 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) {
|
| 697 | 697 |
out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true")
|
| 698 | 698 |
assert.ErrorContains(c, err, "") |
| 699 | 699 |
expected := "Minimum memory limit can not be less than memory reservation limit" |
| 700 |
- c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 700 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 701 | 701 |
|
| 702 | 702 |
out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true")
|
| 703 | 703 |
assert.ErrorContains(c, err, "") |
| 704 | 704 |
expected = "Minimum memory reservation allowed is 4MB" |
| 705 |
- c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 705 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 706 | 706 |
} |
| 707 | 707 |
|
| 708 | 708 |
func (s *DockerSuite) TestStopContainerSignal(c *check.C) {
|
| 709 | 709 |
out, _ := dockerCmd(c, "run", "--stop-signal", "SIGUSR1", "-d", "busybox", "/bin/sh", "-c", `trap 'echo "exit trapped"; exit 0' USR1; while true; do sleep 1; done`) |
| 710 | 710 |
containerID := strings.TrimSpace(out) |
| 711 | 711 |
|
| 712 |
- c.Assert(waitRun(containerID), checker.IsNil) |
|
| 712 |
+ assert.Assert(c, waitRun(containerID), checker.IsNil) |
|
| 713 | 713 |
|
| 714 | 714 |
dockerCmd(c, "stop", containerID) |
| 715 | 715 |
out, _ = dockerCmd(c, "logs", containerID) |
| 716 | 716 |
|
| 717 |
- c.Assert(out, checker.Contains, "exit trapped", check.Commentf("Expected `exit trapped` in the log"))
|
|
| 717 |
+ assert.Assert(c, out, checker.Contains, "exit trapped", check.Commentf("Expected `exit trapped` in the log"))
|
|
| 718 | 718 |
} |
| 719 | 719 |
|
| 720 | 720 |
func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) {
|
| ... | ... |
@@ -793,7 +793,7 @@ func (s *DockerSuite) TestRunWithDefaultShmSize(c *check.C) {
|
| 793 | 793 |
c.Fatalf("Expected shm of 64MB in mount command, got %v", out)
|
| 794 | 794 |
} |
| 795 | 795 |
shmSize := inspectField(c, name, "HostConfig.ShmSize") |
| 796 |
- c.Assert(shmSize, check.Equals, "67108864") |
|
| 796 |
+ assert.Assert(c, shmSize, check.Equals, "67108864") |
|
| 797 | 797 |
} |
| 798 | 798 |
|
| 799 | 799 |
func (s *DockerSuite) TestRunWithShmSize(c *check.C) {
|
| ... | ... |
@@ -806,7 +806,7 @@ func (s *DockerSuite) TestRunWithShmSize(c *check.C) {
|
| 806 | 806 |
c.Fatalf("Expected shm of 1GB in mount command, got %v", out)
|
| 807 | 807 |
} |
| 808 | 808 |
shmSize := inspectField(c, name, "HostConfig.ShmSize") |
| 809 |
- c.Assert(shmSize, check.Equals, "1073741824") |
|
| 809 |
+ assert.Assert(c, shmSize, check.Equals, "1073741824") |
|
| 810 | 810 |
} |
| 811 | 811 |
|
| 812 | 812 |
func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) {
|
| ... | ... |
@@ -814,7 +814,7 @@ func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) {
|
| 814 | 814 |
assert.NilError(c, err) |
| 815 | 815 |
defer tmpFile.Close() |
| 816 | 816 |
out, _ := dockerCmd(c, "run", "--tmpfs", "/run", "-v", tmpFile.Name()+":/run/test", "busybox", "ls", "/run") |
| 817 |
- c.Assert(out, checker.Contains, "test") |
|
| 817 |
+ assert.Assert(c, out, checker.Contains, "test") |
|
| 818 | 818 |
} |
| 819 | 819 |
|
| 820 | 820 |
func (s *DockerSuite) TestRunTmpfsMounts(c *check.C) {
|
| ... | ... |
@@ -846,7 +846,7 @@ func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *check.C) {
|
| 846 | 846 |
RUN touch /run/stuff |
| 847 | 847 |
`)) |
| 848 | 848 |
out, _ := dockerCmd(c, "run", "--tmpfs", "/run", name, "ls", "/run") |
| 849 |
- c.Assert(out, checker.Not(checker.Contains), "stuff") |
|
| 849 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "stuff") |
|
| 850 | 850 |
} |
| 851 | 851 |
|
| 852 | 852 |
// Test case for #22420 |
| ... | ... |
@@ -856,27 +856,27 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *check.C) {
|
| 856 | 856 |
expectedOptions := []string{"rw", "nosuid", "nodev", "noexec", "relatime"}
|
| 857 | 857 |
out, _ := dockerCmd(c, "run", "--tmpfs", "/tmp", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 858 | 858 |
for _, option := range expectedOptions {
|
| 859 |
- c.Assert(out, checker.Contains, option) |
|
| 859 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 860 | 860 |
} |
| 861 |
- c.Assert(out, checker.Not(checker.Contains), "size=") |
|
| 861 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "size=") |
|
| 862 | 862 |
|
| 863 | 863 |
expectedOptions = []string{"rw", "nosuid", "nodev", "noexec", "relatime"}
|
| 864 | 864 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 865 | 865 |
for _, option := range expectedOptions {
|
| 866 |
- c.Assert(out, checker.Contains, option) |
|
| 866 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 867 | 867 |
} |
| 868 |
- c.Assert(out, checker.Not(checker.Contains), "size=") |
|
| 868 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "size=") |
|
| 869 | 869 |
|
| 870 | 870 |
expectedOptions = []string{"rw", "nosuid", "nodev", "relatime", "size=8192k"}
|
| 871 | 871 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw,exec,size=8192k", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 872 | 872 |
for _, option := range expectedOptions {
|
| 873 |
- c.Assert(out, checker.Contains, option) |
|
| 873 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 874 | 874 |
} |
| 875 | 875 |
|
| 876 | 876 |
expectedOptions = []string{"rw", "nosuid", "nodev", "noexec", "relatime", "size=4096k"}
|
| 877 | 877 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw,size=8192k,exec,size=4096k,noexec", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 878 | 878 |
for _, option := range expectedOptions {
|
| 879 |
- c.Assert(out, checker.Contains, option) |
|
| 879 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 880 | 880 |
} |
| 881 | 881 |
|
| 882 | 882 |
// We use debian:jessie as there is no findmnt in busybox. Also the output will be in the format of |
| ... | ... |
@@ -886,7 +886,7 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *check.C) {
|
| 886 | 886 |
expectedOptions = []string{"shared"}
|
| 887 | 887 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:shared", "debian:jessie", "findmnt", "-o", "TARGET,PROPAGATION", "/tmp") |
| 888 | 888 |
for _, option := range expectedOptions {
|
| 889 |
- c.Assert(out, checker.Contains, option) |
|
| 889 |
+ assert.Assert(c, out, checker.Contains, option) |
|
| 890 | 890 |
} |
| 891 | 891 |
} |
| 892 | 892 |
|
| ... | ... |
@@ -895,23 +895,23 @@ func (s *DockerSuite) TestRunSysctls(c *check.C) {
|
| 895 | 895 |
var err error |
| 896 | 896 |
|
| 897 | 897 |
out, _ := dockerCmd(c, "run", "--sysctl", "net.ipv4.ip_forward=1", "--name", "test", "busybox", "cat", "/proc/sys/net/ipv4/ip_forward") |
| 898 |
- c.Assert(strings.TrimSpace(out), check.Equals, "1") |
|
| 898 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "1") |
|
| 899 | 899 |
|
| 900 | 900 |
out = inspectFieldJSON(c, "test", "HostConfig.Sysctls") |
| 901 | 901 |
|
| 902 | 902 |
sysctls := make(map[string]string) |
| 903 | 903 |
err = json.Unmarshal([]byte(out), &sysctls) |
| 904 | 904 |
assert.NilError(c, err) |
| 905 |
- c.Assert(sysctls["net.ipv4.ip_forward"], check.Equals, "1") |
|
| 905 |
+ assert.Assert(c, sysctls["net.ipv4.ip_forward"], check.Equals, "1") |
|
| 906 | 906 |
|
| 907 | 907 |
out, _ = dockerCmd(c, "run", "--sysctl", "net.ipv4.ip_forward=0", "--name", "test1", "busybox", "cat", "/proc/sys/net/ipv4/ip_forward") |
| 908 |
- c.Assert(strings.TrimSpace(out), check.Equals, "0") |
|
| 908 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "0") |
|
| 909 | 909 |
|
| 910 | 910 |
out = inspectFieldJSON(c, "test1", "HostConfig.Sysctls") |
| 911 | 911 |
|
| 912 | 912 |
err = json.Unmarshal([]byte(out), &sysctls) |
| 913 | 913 |
assert.NilError(c, err) |
| 914 |
- c.Assert(sysctls["net.ipv4.ip_forward"], check.Equals, "0") |
|
| 914 |
+ assert.Assert(c, sysctls["net.ipv4.ip_forward"], check.Equals, "0") |
|
| 915 | 915 |
|
| 916 | 916 |
icmd.RunCommand(dockerBinary, "run", "--sysctl", "kernel.foobar=1", "--name", "test2", |
| 917 | 917 |
"busybox", "cat", "/proc/sys/kernel/foobar").Assert(c, icmd.Expected{
|
| ... | ... |
@@ -1391,16 +1391,16 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) {
|
| 1391 | 1391 |
|
| 1392 | 1392 |
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 |
| 1393 | 1393 |
out, _ := dockerCmd(c, "run", "--device", symZero+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum") |
| 1394 |
- c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1394 |
+ assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1395 | 1395 |
|
| 1396 | 1396 |
// symlink "tmpDir/file" to a file "tmpDir/temp" will result in an error as it is not a device. |
| 1397 | 1397 |
out, _, err = dockerCmdWithError("run", "--device", symFile+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
|
| 1398 | 1398 |
assert.ErrorContains(c, err, "") |
| 1399 |
- c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "not a device node", check.Commentf("expected output 'not a device node'"))
|
|
| 1399 |
+ assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "not a device node", check.Commentf("expected output 'not a device node'"))
|
|
| 1400 | 1400 |
|
| 1401 | 1401 |
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 (this time check with relative path backed, see #22271) |
| 1402 | 1402 |
out, _ = dockerCmd(c, "run", "--device", "/dev/symzero:/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum") |
| 1403 |
- c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1403 |
+ assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1404 | 1404 |
} |
| 1405 | 1405 |
|
| 1406 | 1406 |
// TestRunPIDsLimit makes sure the pids cgroup is set with --pids-limit |
| ... | ... |
@@ -1438,7 +1438,7 @@ func (s *DockerSuite) TestRunUserDeviceAllowed(c *check.C) {
|
| 1438 | 1438 |
|
| 1439 | 1439 |
file := "/sys/fs/cgroup/devices/devices.list" |
| 1440 | 1440 |
out, _ := dockerCmd(c, "run", "--device", "/dev/snd/timer:w", "busybox", "cat", file) |
| 1441 |
- c.Assert(out, checker.Contains, fmt.Sprintf("c %d:%d w", stat.Rdev/256, stat.Rdev%256))
|
|
| 1441 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("c %d:%d w", stat.Rdev/256, stat.Rdev%256))
|
|
| 1442 | 1442 |
} |
| 1443 | 1443 |
|
| 1444 | 1444 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) {
|
| ... | ... |
@@ -1463,7 +1463,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) {
|
| 1463 | 1463 |
|
| 1464 | 1464 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1465 | 1465 |
assert.ErrorContains(c, err, "") |
| 1466 |
- c.Assert(out, checker.Contains, "Operation not permitted") |
|
| 1466 |
+ assert.Assert(c, out, checker.Contains, "Operation not permitted") |
|
| 1467 | 1467 |
} |
| 1468 | 1468 |
|
| 1469 | 1469 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) {
|
| ... | ... |
@@ -1489,7 +1489,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) {
|
| 1489 | 1489 |
|
| 1490 | 1490 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1491 | 1491 |
assert.ErrorContains(c, err, "") |
| 1492 |
- c.Assert(out, checker.Contains, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'") |
|
| 1492 |
+ assert.Assert(c, out, checker.Contains, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'") |
|
| 1493 | 1493 |
} |
| 1494 | 1494 |
|
| 1495 | 1495 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) {
|
| ... | ... |
@@ -1526,7 +1526,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) {
|
| 1526 | 1526 |
|
| 1527 | 1527 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1528 | 1528 |
assert.ErrorContains(c, err, "") |
| 1529 |
- c.Assert(out, checker.Contains, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'") |
|
| 1529 |
+ assert.Assert(c, out, checker.Contains, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'") |
|
| 1530 | 1530 |
} |
| 1531 | 1531 |
|
| 1532 | 1532 |
func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) {
|
| ... | ... |
@@ -1562,7 +1562,7 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) {
|
| 1562 | 1562 |
|
| 1563 | 1563 |
out, err := s.d.Cmd("run", "busybox", "chmod", "777", ".")
|
| 1564 | 1564 |
assert.ErrorContains(c, err, "") |
| 1565 |
- c.Assert(out, checker.Contains, "Operation not permitted") |
|
| 1565 |
+ assert.Assert(c, out, checker.Contains, "Operation not permitted") |
|
| 1566 | 1566 |
} |
| 1567 | 1567 |
|
| 1568 | 1568 |
func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) {
|
| ... | ... |
@@ -1577,7 +1577,7 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) {
|
| 1577 | 1577 |
assert.NilError(c, err) |
| 1578 | 1578 |
inspect, err := clt.ContainerInspect(context.Background(), "test") |
| 1579 | 1579 |
assert.NilError(c, err) |
| 1580 |
- c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(500000000)) |
|
| 1580 |
+ assert.Assert(c, inspect.HostConfig.NanoCPUs, checker.Equals, int64(500000000)) |
|
| 1581 | 1581 |
|
| 1582 | 1582 |
out = inspectField(c, "test", "HostConfig.CpuQuota") |
| 1583 | 1583 |
assert.Equal(c, out, "0", "CPU CFS quota should be 0") |
| ... | ... |
@@ -1586,5 +1586,5 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) {
|
| 1586 | 1586 |
|
| 1587 | 1587 |
out, _, err = dockerCmdWithError("run", "--cpus", "0.5", "--cpu-quota", "50000", "--cpu-period", "100000", "busybox", "sh")
|
| 1588 | 1588 |
assert.ErrorContains(c, err, "") |
| 1589 |
- c.Assert(out, checker.Contains, "Conflicting options: Nano CPUs and CPU Period cannot both be set") |
|
| 1589 |
+ assert.Assert(c, out, checker.Contains, "Conflicting options: Nano CPUs and CPU Period cannot both be set") |
|
| 1590 | 1590 |
} |
| ... | ... |
@@ -129,21 +129,21 @@ func (s *DockerSuite) TestSaveImageId(c *check.C) {
|
| 129 | 129 |
cleanedShortImageID := strings.TrimSpace(out) |
| 130 | 130 |
|
| 131 | 131 |
// Make sure IDs are not empty |
| 132 |
- c.Assert(cleanedLongImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 133 |
- c.Assert(cleanedShortImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 132 |
+ assert.Assert(c, cleanedLongImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 133 |
+ assert.Assert(c, cleanedShortImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 134 | 134 |
|
| 135 | 135 |
saveCmd := exec.Command(dockerBinary, "save", cleanedShortImageID) |
| 136 | 136 |
tarCmd := exec.Command("tar", "t")
|
| 137 | 137 |
|
| 138 | 138 |
var err error |
| 139 | 139 |
tarCmd.Stdin, err = saveCmd.StdoutPipe() |
| 140 |
- c.Assert(err, checker.IsNil, check.Commentf("cannot set stdout pipe for tar: %v", err))
|
|
| 140 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("cannot set stdout pipe for tar: %v", err))
|
|
| 141 | 141 |
grepCmd := exec.Command("grep", cleanedLongImageID)
|
| 142 | 142 |
grepCmd.Stdin, err = tarCmd.StdoutPipe() |
| 143 |
- c.Assert(err, checker.IsNil, check.Commentf("cannot set stdout pipe for grep: %v", err))
|
|
| 143 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("cannot set stdout pipe for grep: %v", err))
|
|
| 144 | 144 |
|
| 145 |
- c.Assert(tarCmd.Start(), checker.IsNil, check.Commentf("tar failed with error: %v", err))
|
|
| 146 |
- c.Assert(saveCmd.Start(), checker.IsNil, check.Commentf("docker save failed with error: %v", err))
|
|
| 145 |
+ assert.Assert(c, tarCmd.Start(), checker.IsNil, check.Commentf("tar failed with error: %v", err))
|
|
| 146 |
+ assert.Assert(c, saveCmd.Start(), checker.IsNil, check.Commentf("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 *check.C) {
|
| 152 | 152 |
|
| 153 | 153 |
out, _, err = runCommandWithOutput(grepCmd) |
| 154 | 154 |
|
| 155 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to save repo with image ID: %s, %v", out, err))
|
|
| 155 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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 *check.C) {
|
| 264 | 264 |
|
| 265 | 265 |
name := "save-directory-permissions" |
| 266 | 266 |
tmpDir, err := ioutil.TempDir("", "save-layers-with-directories")
|
| 267 |
- c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary directory: %s", err))
|
|
| 267 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to create temporary directory: %s", err))
|
|
| 268 | 268 |
extractionDirectory := filepath.Join(tmpDir, "image-extraction-dir") |
| 269 | 269 |
os.Mkdir(extractionDirectory, 0777) |
| 270 | 270 |
|
| ... | ... |
@@ -393,9 +393,9 @@ func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
|
| 393 | 393 |
assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err) |
| 394 | 394 |
|
| 395 | 395 |
// Should not show 'name' but should show the image ID during the load |
| 396 |
- c.Assert(out, checker.Not(checker.Contains), "Loaded image: ") |
|
| 397 |
- c.Assert(out, checker.Contains, "Loaded image ID:") |
|
| 398 |
- c.Assert(out, checker.Contains, id) |
|
| 396 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "Loaded image: ") |
|
| 397 |
+ assert.Assert(c, out, checker.Contains, "Loaded image ID:") |
|
| 398 |
+ assert.Assert(c, out, checker.Contains, id) |
|
| 399 | 399 |
|
| 400 | 400 |
// Test to make sure that save by name shows that name during load |
| 401 | 401 |
out, err = RunCommandPipelineWithOutput( |
| ... | ... |
@@ -403,6 +403,6 @@ func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
|
| 403 | 403 |
exec.Command(dockerBinary, "load")) |
| 404 | 404 |
assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err) |
| 405 | 405 |
|
| 406 |
- c.Assert(out, checker.Contains, "Loaded image: "+name+":latest") |
|
| 407 |
- c.Assert(out, checker.Not(checker.Contains), "Loaded image ID:") |
|
| 406 |
+ assert.Assert(c, out, checker.Contains, "Loaded image: "+name+":latest") |
|
| 407 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "Loaded image ID:") |
|
| 408 | 408 |
} |
| ... | ... |
@@ -41,27 +41,27 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
|
| 41 | 41 |
assert.NilError(c, err, out) |
| 42 | 42 |
|
| 43 | 43 |
var mountConfig []mount.Mount |
| 44 |
- c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
|
| 45 |
- c.Assert(mountConfig, checker.HasLen, 1) |
|
| 44 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
|
| 45 |
+ assert.Assert(c, mountConfig, checker.HasLen, 1) |
|
| 46 | 46 |
|
| 47 |
- c.Assert(mountConfig[0].Source, checker.Equals, "foo") |
|
| 48 |
- c.Assert(mountConfig[0].Target, checker.Equals, "/foo") |
|
| 49 |
- c.Assert(mountConfig[0].Type, checker.Equals, mount.TypeVolume) |
|
| 50 |
- c.Assert(mountConfig[0].VolumeOptions, checker.NotNil) |
|
| 51 |
- c.Assert(mountConfig[0].VolumeOptions.NoCopy, checker.True) |
|
| 47 |
+ assert.Assert(c, mountConfig[0].Source, checker.Equals, "foo") |
|
| 48 |
+ assert.Assert(c, mountConfig[0].Target, checker.Equals, "/foo") |
|
| 49 |
+ assert.Assert(c, mountConfig[0].Type, checker.Equals, mount.TypeVolume) |
|
| 50 |
+ assert.Assert(c, mountConfig[0].VolumeOptions, checker.NotNil) |
|
| 51 |
+ assert.Assert(c, mountConfig[0].VolumeOptions.NoCopy, checker.True) |
|
| 52 | 52 |
|
| 53 | 53 |
// check container mounts actual |
| 54 | 54 |
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
| 55 | 55 |
assert.NilError(c, err, out) |
| 56 | 56 |
|
| 57 | 57 |
var mounts []types.MountPoint |
| 58 |
- c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 59 |
- c.Assert(mounts, checker.HasLen, 1) |
|
| 58 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 59 |
+ assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 60 | 60 |
|
| 61 |
- c.Assert(mounts[0].Type, checker.Equals, mount.TypeVolume) |
|
| 62 |
- c.Assert(mounts[0].Name, checker.Equals, "foo") |
|
| 63 |
- c.Assert(mounts[0].Destination, checker.Equals, "/foo") |
|
| 64 |
- c.Assert(mounts[0].RW, checker.Equals, true) |
|
| 61 |
+ assert.Assert(c, mounts[0].Type, checker.Equals, mount.TypeVolume) |
|
| 62 |
+ assert.Assert(c, mounts[0].Name, checker.Equals, "foo") |
|
| 63 |
+ assert.Assert(c, mounts[0].Destination, checker.Equals, "/foo") |
|
| 64 |
+ assert.Assert(c, mounts[0].RW, checker.Equals, true) |
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
|
| ... | ... |
@@ -75,7 +75,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
|
| 75 | 75 |
}, |
| 76 | 76 |
Data: []byte("TESTINGDATA"),
|
| 77 | 77 |
}) |
| 78 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 78 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 79 | 79 |
|
| 80 | 80 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
|
| 81 | 81 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -84,14 +84,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
|
| 84 | 84 |
assert.NilError(c, err) |
| 85 | 85 |
|
| 86 | 86 |
var refs []swarm.SecretReference |
| 87 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 87 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 88 | 88 |
assert.Equal(c, len(refs), 1) |
| 89 | 89 |
|
| 90 |
- c.Assert(refs[0].SecretName, checker.Equals, testName) |
|
| 91 |
- c.Assert(refs[0].File, checker.Not(checker.IsNil)) |
|
| 92 |
- c.Assert(refs[0].File.Name, checker.Equals, testName) |
|
| 93 |
- c.Assert(refs[0].File.UID, checker.Equals, "0") |
|
| 94 |
- c.Assert(refs[0].File.GID, checker.Equals, "0") |
|
| 90 |
+ assert.Assert(c, refs[0].SecretName, checker.Equals, testName) |
|
| 91 |
+ assert.Assert(c, refs[0].File, checker.Not(checker.IsNil)) |
|
| 92 |
+ assert.Assert(c, refs[0].File.Name, checker.Equals, testName) |
|
| 93 |
+ assert.Assert(c, refs[0].File.UID, checker.Equals, "0") |
|
| 94 |
+ assert.Assert(c, refs[0].File.GID, checker.Equals, "0") |
|
| 95 | 95 |
|
| 96 | 96 |
out, err = d.Cmd("service", "rm", serviceName)
|
| 97 | 97 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -117,7 +117,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check |
| 117 | 117 |
}, |
| 118 | 118 |
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
|
| 119 | 119 |
}) |
| 120 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 120 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 121 | 121 |
|
| 122 | 122 |
secretFlags = append(secretFlags, "--secret", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
| 123 | 123 |
} |
| ... | ... |
@@ -133,7 +133,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check |
| 133 | 133 |
assert.NilError(c, err) |
| 134 | 134 |
|
| 135 | 135 |
var refs []swarm.SecretReference |
| 136 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 136 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 137 | 137 |
assert.Equal(c, len(refs), len(testPaths)) |
| 138 | 138 |
|
| 139 | 139 |
var tasks []swarm.Task |
| ... | ... |
@@ -173,7 +173,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C |
| 173 | 173 |
}, |
| 174 | 174 |
Data: []byte("TESTINGDATA"),
|
| 175 | 175 |
}) |
| 176 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 176 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 177 | 177 |
|
| 178 | 178 |
serviceName := "svc" |
| 179 | 179 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
|
| ... | ... |
@@ -183,7 +183,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C |
| 183 | 183 |
assert.NilError(c, err) |
| 184 | 184 |
|
| 185 | 185 |
var refs []swarm.SecretReference |
| 186 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 186 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 187 | 187 |
assert.Equal(c, len(refs), 2) |
| 188 | 188 |
|
| 189 | 189 |
var tasks []swarm.Task |
| ... | ... |
@@ -223,7 +223,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
| 223 | 223 |
}, |
| 224 | 224 |
Data: []byte("TESTINGDATA"),
|
| 225 | 225 |
}) |
| 226 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 226 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 227 | 227 |
|
| 228 | 228 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
|
| 229 | 229 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -232,14 +232,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
|
| 232 | 232 |
assert.NilError(c, err) |
| 233 | 233 |
|
| 234 | 234 |
var refs []swarm.ConfigReference |
| 235 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 235 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 236 | 236 |
assert.Equal(c, len(refs), 1) |
| 237 | 237 |
|
| 238 |
- c.Assert(refs[0].ConfigName, checker.Equals, testName) |
|
| 239 |
- c.Assert(refs[0].File, checker.Not(checker.IsNil)) |
|
| 240 |
- c.Assert(refs[0].File.Name, checker.Equals, testName) |
|
| 241 |
- c.Assert(refs[0].File.UID, checker.Equals, "0") |
|
| 242 |
- c.Assert(refs[0].File.GID, checker.Equals, "0") |
|
| 238 |
+ assert.Assert(c, refs[0].ConfigName, checker.Equals, testName) |
|
| 239 |
+ assert.Assert(c, refs[0].File, checker.Not(checker.IsNil)) |
|
| 240 |
+ assert.Assert(c, refs[0].File.Name, checker.Equals, testName) |
|
| 241 |
+ assert.Assert(c, refs[0].File.UID, checker.Equals, "0") |
|
| 242 |
+ assert.Assert(c, refs[0].File.GID, checker.Equals, "0") |
|
| 243 | 243 |
|
| 244 | 244 |
out, err = d.Cmd("service", "rm", serviceName)
|
| 245 | 245 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -264,7 +264,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check |
| 264 | 264 |
}, |
| 265 | 265 |
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
|
| 266 | 266 |
}) |
| 267 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 267 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 268 | 268 |
|
| 269 | 269 |
configFlags = append(configFlags, "--config", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
|
| 270 | 270 |
} |
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check |
| 280 | 280 |
assert.NilError(c, err) |
| 281 | 281 |
|
| 282 | 282 |
var refs []swarm.ConfigReference |
| 283 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 283 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 284 | 284 |
assert.Equal(c, len(refs), len(testPaths)) |
| 285 | 285 |
|
| 286 | 286 |
var tasks []swarm.Task |
| ... | ... |
@@ -320,7 +320,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C |
| 320 | 320 |
}, |
| 321 | 321 |
Data: []byte("TESTINGDATA"),
|
| 322 | 322 |
}) |
| 323 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 323 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 324 | 324 |
|
| 325 | 325 |
serviceName := "svc" |
| 326 | 326 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")
|
| ... | ... |
@@ -330,7 +330,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C |
| 330 | 330 |
assert.NilError(c, err) |
| 331 | 331 |
|
| 332 | 332 |
var refs []swarm.ConfigReference |
| 333 |
- c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 333 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &refs), checker.IsNil) |
|
| 334 | 334 |
assert.Equal(c, len(refs), 2) |
| 335 | 335 |
|
| 336 | 336 |
var tasks []swarm.Task |
| ... | ... |
@@ -384,27 +384,27 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
|
| 384 | 384 |
assert.NilError(c, err, out) |
| 385 | 385 |
|
| 386 | 386 |
var mountConfig []mount.Mount |
| 387 |
- c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
|
| 388 |
- c.Assert(mountConfig, checker.HasLen, 1) |
|
| 387 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
|
| 388 |
+ assert.Assert(c, mountConfig, checker.HasLen, 1) |
|
| 389 | 389 |
|
| 390 |
- c.Assert(mountConfig[0].Source, checker.Equals, "") |
|
| 391 |
- c.Assert(mountConfig[0].Target, checker.Equals, "/foo") |
|
| 392 |
- c.Assert(mountConfig[0].Type, checker.Equals, mount.TypeTmpfs) |
|
| 393 |
- c.Assert(mountConfig[0].TmpfsOptions, checker.NotNil) |
|
| 394 |
- c.Assert(mountConfig[0].TmpfsOptions.SizeBytes, checker.Equals, int64(1048576)) |
|
| 390 |
+ assert.Assert(c, mountConfig[0].Source, checker.Equals, "") |
|
| 391 |
+ assert.Assert(c, mountConfig[0].Target, checker.Equals, "/foo") |
|
| 392 |
+ assert.Assert(c, mountConfig[0].Type, checker.Equals, mount.TypeTmpfs) |
|
| 393 |
+ assert.Assert(c, mountConfig[0].TmpfsOptions, checker.NotNil) |
|
| 394 |
+ assert.Assert(c, mountConfig[0].TmpfsOptions.SizeBytes, checker.Equals, int64(1048576)) |
|
| 395 | 395 |
|
| 396 | 396 |
// check container mounts actual |
| 397 | 397 |
out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
|
| 398 | 398 |
assert.NilError(c, err, out) |
| 399 | 399 |
|
| 400 | 400 |
var mounts []types.MountPoint |
| 401 |
- c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 402 |
- c.Assert(mounts, checker.HasLen, 1) |
|
| 401 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
|
| 402 |
+ assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 403 | 403 |
|
| 404 |
- c.Assert(mounts[0].Type, checker.Equals, mount.TypeTmpfs) |
|
| 405 |
- c.Assert(mounts[0].Name, checker.Equals, "") |
|
| 406 |
- c.Assert(mounts[0].Destination, checker.Equals, "/foo") |
|
| 407 |
- c.Assert(mounts[0].RW, checker.Equals, true) |
|
| 404 |
+ assert.Assert(c, mounts[0].Type, checker.Equals, mount.TypeTmpfs) |
|
| 405 |
+ assert.Assert(c, mounts[0].Name, checker.Equals, "") |
|
| 406 |
+ assert.Assert(c, mounts[0].Destination, checker.Equals, "/foo") |
|
| 407 |
+ assert.Assert(c, mounts[0].RW, checker.Equals, true) |
|
| 408 | 408 |
|
| 409 | 409 |
out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID) |
| 410 | 410 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -441,8 +441,8 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
|
| 441 | 441 |
|
| 442 | 442 |
// Make sure the only alias seen is the container-id |
| 443 | 443 |
var aliases []string |
| 444 |
- c.Assert(json.Unmarshal([]byte(out), &aliases), checker.IsNil) |
|
| 445 |
- c.Assert(aliases, checker.HasLen, 1) |
|
| 444 |
+ assert.Assert(c, json.Unmarshal([]byte(out), &aliases), checker.IsNil) |
|
| 445 |
+ assert.Assert(c, aliases, checker.HasLen, 1) |
|
| 446 | 446 |
|
| 447 |
- c.Assert(task.Status.ContainerStatus.ContainerID, checker.Contains, aliases[0]) |
|
| 447 |
+ assert.Assert(c, task.Status.ContainerStatus.ContainerID, checker.Contains, aliases[0]) |
|
| 448 | 448 |
} |
| ... | ... |
@@ -124,7 +124,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) {
|
| 124 | 124 |
|
| 125 | 125 |
// task should be blocked at starting status |
| 126 | 126 |
task = d.GetTask(c, task.ID) |
| 127 |
- c.Assert(task.Status.State, check.Equals, swarm.TaskStateStarting) |
|
| 127 |
+ assert.Assert(c, task.Status.State, check.Equals, swarm.TaskStateStarting) |
|
| 128 | 128 |
|
| 129 | 129 |
// make it healthy |
| 130 | 130 |
d.Cmd("exec", containerID, "touch", "/status")
|
| ... | ... |
@@ -21,7 +21,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
|
| 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 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 24 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 25 | 25 |
|
| 26 | 26 |
ch := make(chan error) |
| 27 | 27 |
go func() {
|
| ... | ... |
@@ -64,7 +64,7 @@ func (s *DockerSuite) TestStartAttachSilent(c *check.C) {
|
| 64 | 64 |
|
| 65 | 65 |
startOut, _ := dockerCmd(c, "start", "-a", name) |
| 66 | 66 |
// start -a produced unexpected output |
| 67 |
- c.Assert(startOut, checker.Equals, "test\n") |
|
| 67 |
+ assert.Assert(c, startOut, checker.Equals, "test\n") |
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
func (s *DockerSuite) TestStartRecordError(c *check.C) {
|
| ... | ... |
@@ -74,22 +74,22 @@ func (s *DockerSuite) TestStartRecordError(c *check.C) {
|
| 74 | 74 |
dockerCmd(c, "run", "-d", "-p", "9999:9999", "--name", "test", "busybox", "top") |
| 75 | 75 |
stateErr := inspectField(c, "test", "State.Error") |
| 76 | 76 |
// Expected to not have state error |
| 77 |
- c.Assert(stateErr, checker.Equals, "") |
|
| 77 |
+ assert.Assert(c, stateErr, checker.Equals, "") |
|
| 78 | 78 |
|
| 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 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 82 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 83 | 83 |
|
| 84 | 84 |
stateErr = inspectField(c, "test2", "State.Error") |
| 85 |
- c.Assert(stateErr, checker.Contains, "port is already allocated") |
|
| 85 |
+ assert.Assert(c, stateErr, checker.Contains, "port is already allocated") |
|
| 86 | 86 |
|
| 87 | 87 |
// Expect the conflict to be resolved when we stop the initial container |
| 88 | 88 |
dockerCmd(c, "stop", "test") |
| 89 | 89 |
dockerCmd(c, "start", "test2") |
| 90 | 90 |
stateErr = inspectField(c, "test2", "State.Error") |
| 91 | 91 |
// Expected to not have state error but got one |
| 92 |
- c.Assert(stateErr, checker.Equals, "") |
|
| 92 |
+ assert.Assert(c, stateErr, checker.Equals, "") |
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
|
| ... | ... |
@@ -102,9 +102,9 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
|
| 102 | 102 |
|
| 103 | 103 |
out, _, err := dockerCmdWithError("start", "testing")
|
| 104 | 104 |
// an error should have been shown that you cannot start paused container |
| 105 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 105 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 106 | 106 |
// an error should have been shown that you cannot start paused container |
| 107 |
- c.Assert(strings.ToLower(out), checker.Contains, "cannot start a paused container, try unpause instead") |
|
| 107 |
+ assert.Assert(c, strings.ToLower(out), checker.Contains, "cannot start a paused container, try unpause instead") |
|
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 | 110 |
func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
|
| ... | ... |
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
|
| 130 | 130 |
expErr := "failed to start containers: [child_first]" |
| 131 | 131 |
out, _, err := dockerCmdWithError("start", "child_first", "parent", "child_second")
|
| 132 | 132 |
// err shouldn't be nil because start will fail |
| 133 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 133 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 134 | 134 |
// output does not correspond to what was expected |
| 135 | 135 |
if !(strings.Contains(out, expOut) || strings.Contains(err.Error(), expErr)) {
|
| 136 | 136 |
c.Fatalf("Expected out: %v with err: %v but got out: %v with err: %v", expOut, expErr, out, err)
|
| ... | ... |
@@ -158,9 +158,9 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
|
| 158 | 158 |
for _, option := range []string{"-a", "-i", "-ai"} {
|
| 159 | 159 |
out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3")
|
| 160 | 160 |
// err shouldn't be nil because start will fail |
| 161 |
- c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 161 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
|
|
| 162 | 162 |
// output does not correspond to what was expected |
| 163 |
- c.Assert(out, checker.Contains, "you cannot start and attach multiple containers at once") |
|
| 163 |
+ assert.Assert(c, out, checker.Contains, "you cannot start and attach multiple containers at once") |
|
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 | 166 |
// confirm the state of all the containers be stopped |
| ... | ... |
@@ -184,7 +184,7 @@ func (s *DockerSuite) TestStartAttachWithRename(c *check.C) {
|
| 184 | 184 |
result := cli.Docker(cli.Args("start", "-a", "before")).Assert(c, icmd.Expected{
|
| 185 | 185 |
ExitCode: 137, |
| 186 | 186 |
}) |
| 187 |
- c.Assert(result.Stderr(), checker.Not(checker.Contains), "No such container") |
|
| 187 |
+ assert.Assert(c, result.Stderr(), checker.Not(checker.Contains), "No such container") |
|
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 | 190 |
func (s *DockerSuite) TestStartReturnCorrectExitCode(c *check.C) {
|
| ... | ... |
@@ -193,9 +193,9 @@ func (s *DockerSuite) TestStartReturnCorrectExitCode(c *check.C) {
|
| 193 | 193 |
|
| 194 | 194 |
out, exitCode, err := dockerCmdWithError("start", "-a", "withRestart")
|
| 195 | 195 |
assert.ErrorContains(c, err, "") |
| 196 |
- c.Assert(exitCode, checker.Equals, 11, check.Commentf("out: %s", out))
|
|
| 196 |
+ assert.Assert(c, exitCode, checker.Equals, 11, check.Commentf("out: %s", out))
|
|
| 197 | 197 |
|
| 198 | 198 |
out, exitCode, err = dockerCmdWithError("start", "-a", "withRm")
|
| 199 | 199 |
assert.ErrorContains(c, err, "") |
| 200 |
- c.Assert(exitCode, checker.Equals, 12, check.Commentf("out: %s", out))
|
|
| 200 |
+ assert.Assert(c, exitCode, checker.Equals, 12, check.Commentf("out: %s", out))
|
|
| 201 | 201 |
} |
| ... | ... |
@@ -46,15 +46,15 @@ func (s *DockerSwarmSuite) TestSwarmUpdate(c *check.C) {
|
| 46 | 46 |
assert.NilError(c, err, out) |
| 47 | 47 |
|
| 48 | 48 |
spec := getSpec() |
| 49 |
- c.Assert(spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 50 |
- c.Assert(spec.Dispatcher.HeartbeatPeriod, checker.Equals, 11*time.Second) |
|
| 49 |
+ assert.Assert(c, spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 50 |
+ assert.Assert(c, spec.Dispatcher.HeartbeatPeriod, checker.Equals, 11*time.Second) |
|
| 51 | 51 |
|
| 52 | 52 |
// setting anything under 30m for cert-expiry is not allowed |
| 53 | 53 |
out, err = d.Cmd("swarm", "update", "--cert-expiry", "15m")
|
| 54 | 54 |
assert.ErrorContains(c, err, "") |
| 55 |
- c.Assert(out, checker.Contains, "minimum certificate expiry time") |
|
| 55 |
+ assert.Assert(c, out, checker.Contains, "minimum certificate expiry time") |
|
| 56 | 56 |
spec = getSpec() |
| 57 |
- c.Assert(spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 57 |
+ assert.Assert(c, spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 58 | 58 |
|
| 59 | 59 |
// passing an external CA (this is without starting a root rotation) does not fail |
| 60 | 60 |
cli.Docker(cli.Args("swarm", "update", "--external-ca", "protocol=cfssl,url=https://something.org",
|
| ... | ... |
@@ -65,9 +65,9 @@ func (s *DockerSwarmSuite) TestSwarmUpdate(c *check.C) {
|
| 65 | 65 |
assert.NilError(c, err) |
| 66 | 66 |
|
| 67 | 67 |
spec = getSpec() |
| 68 |
- c.Assert(spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 69 |
- c.Assert(spec.CAConfig.ExternalCAs[0].CACert, checker.Equals, "") |
|
| 70 |
- c.Assert(spec.CAConfig.ExternalCAs[1].CACert, checker.Equals, string(expected)) |
|
| 68 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 69 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs[0].CACert, checker.Equals, "") |
|
| 70 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs[1].CACert, checker.Equals, string(expected)) |
|
| 71 | 71 |
|
| 72 | 72 |
// passing an invalid external CA fails |
| 73 | 73 |
tempFile := fs.NewFile(c, "testfile", fs.WithContent("fakecert"))
|
| ... | ... |
@@ -111,18 +111,18 @@ func (s *DockerSwarmSuite) TestSwarmInit(c *check.C) {
|
| 111 | 111 |
assert.NilError(c, err) |
| 112 | 112 |
|
| 113 | 113 |
spec := getSpec() |
| 114 |
- c.Assert(spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 115 |
- c.Assert(spec.Dispatcher.HeartbeatPeriod, checker.Equals, 11*time.Second) |
|
| 116 |
- c.Assert(spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 117 |
- c.Assert(spec.CAConfig.ExternalCAs[0].CACert, checker.Equals, "") |
|
| 118 |
- c.Assert(spec.CAConfig.ExternalCAs[1].CACert, checker.Equals, string(expected)) |
|
| 114 |
+ assert.Assert(c, spec.CAConfig.NodeCertExpiry, checker.Equals, 30*time.Hour) |
|
| 115 |
+ assert.Assert(c, spec.Dispatcher.HeartbeatPeriod, checker.Equals, 11*time.Second) |
|
| 116 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 117 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs[0].CACert, checker.Equals, "") |
|
| 118 |
+ assert.Assert(c, spec.CAConfig.ExternalCAs[1].CACert, checker.Equals, string(expected)) |
|
| 119 | 119 |
|
| 120 |
- c.Assert(d.SwarmLeave(c, true), checker.IsNil) |
|
| 120 |
+ assert.Assert(c, d.SwarmLeave(c, true), checker.IsNil) |
|
| 121 | 121 |
cli.Docker(cli.Args("swarm", "init"), cli.Daemon(d)).Assert(c, icmd.Success)
|
| 122 | 122 |
|
| 123 | 123 |
spec = getSpec() |
| 124 |
- c.Assert(spec.CAConfig.NodeCertExpiry, checker.Equals, 90*24*time.Hour) |
|
| 125 |
- c.Assert(spec.Dispatcher.HeartbeatPeriod, checker.Equals, 5*time.Second) |
|
| 124 |
+ assert.Assert(c, spec.CAConfig.NodeCertExpiry, checker.Equals, 90*24*time.Hour) |
|
| 125 |
+ assert.Assert(c, spec.Dispatcher.HeartbeatPeriod, checker.Equals, 5*time.Second) |
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) {
|
| ... | ... |
@@ -134,14 +134,14 @@ func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) {
|
| 134 | 134 |
cli.Docker(cli.Args("swarm", "join", "::1"), cli.Daemon(d2)).Assert(c, icmd.Success)
|
| 135 | 135 |
|
| 136 | 136 |
out := cli.Docker(cli.Args("info"), cli.Daemon(d2)).Assert(c, icmd.Success).Combined()
|
| 137 |
- c.Assert(out, checker.Contains, "Swarm: active") |
|
| 137 |
+ assert.Assert(c, out, checker.Contains, "Swarm: active") |
|
| 138 | 138 |
} |
| 139 | 139 |
|
| 140 | 140 |
func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedAdvertiseAddr(c *check.C) {
|
| 141 | 141 |
d := s.AddDaemon(c, false, false) |
| 142 | 142 |
out, err := d.Cmd("swarm", "init", "--advertise-addr", "0.0.0.0")
|
| 143 | 143 |
assert.ErrorContains(c, err, "") |
| 144 |
- c.Assert(out, checker.Contains, "advertise address must be a non-zero IP address") |
|
| 144 |
+ assert.Assert(c, out, checker.Contains, "advertise address must be a non-zero IP address") |
|
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 | 147 |
func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) {
|
| ... | ... |
@@ -156,14 +156,14 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) {
|
| 156 | 156 |
assert.ErrorContains(c, err, "") |
| 157 | 157 |
content, err := d.ReadLogFile() |
| 158 | 158 |
assert.NilError(c, err) |
| 159 |
- c.Assert(string(content), checker.Contains, "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode") |
|
| 159 |
+ assert.Assert(c, string(content), checker.Contains, "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode") |
|
| 160 | 160 |
|
| 161 | 161 |
// start a daemon with --live-restore |
| 162 | 162 |
err = d.StartWithError("--live-restore")
|
| 163 | 163 |
assert.ErrorContains(c, err, "") |
| 164 | 164 |
content, err = d.ReadLogFile() |
| 165 | 165 |
assert.NilError(c, err) |
| 166 |
- c.Assert(string(content), checker.Contains, "--live-restore daemon configuration is incompatible with swarm mode") |
|
| 166 |
+ assert.Assert(c, string(content), checker.Contains, "--live-restore daemon configuration is incompatible with swarm mode") |
|
| 167 | 167 |
// restart for teardown |
| 168 | 168 |
d.StartNode(c) |
| 169 | 169 |
} |
| ... | ... |
@@ -171,7 +171,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) {
|
| 171 | 171 |
func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) {
|
| 172 | 172 |
d := s.AddDaemon(c, true, true) |
| 173 | 173 |
hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
|
| 174 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", hostname))
|
|
| 174 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%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) |
| ... | ... |
@@ -182,7 +182,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) {
|
| 182 | 182 |
containers := d.ActiveContainers(c) |
| 183 | 183 |
out, err = d.Cmd("inspect", "--type", "container", "--format", "{{.Config.Hostname}}", containers[0])
|
| 184 | 184 |
assert.NilError(c, err, out) |
| 185 |
- c.Assert(strings.Split(out, "\n")[0], checker.Equals, "test-1-"+strings.Split(hostname, "\n")[0], check.Commentf("hostname with templating invalid"))
|
|
| 185 |
+ assert.Assert(c, strings.Split(out, "\n")[0], checker.Equals, "test-1-"+strings.Split(hostname, "\n")[0], check.Commentf("hostname with templating invalid"))
|
|
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 | 188 |
// Test case for #24270 |
| ... | ... |
@@ -210,21 +210,21 @@ func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *check.C) {
|
| 210 | 210 |
// We search checker.Contains with `name+" "` to prevent prefix only. |
| 211 | 211 |
out, err = d.Cmd("service", "ls", "--filter", filter1)
|
| 212 | 212 |
assert.NilError(c, err, out) |
| 213 |
- c.Assert(out, checker.Contains, name1+" ") |
|
| 214 |
- c.Assert(out, checker.Not(checker.Contains), name2+" ") |
|
| 215 |
- c.Assert(out, checker.Not(checker.Contains), name3+" ") |
|
| 213 |
+ assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 214 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name2+" ") |
|
| 215 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name3+" ") |
|
| 216 | 216 |
|
| 217 | 217 |
out, err = d.Cmd("service", "ls", "--filter", filter2)
|
| 218 | 218 |
assert.NilError(c, err, out) |
| 219 |
- c.Assert(out, checker.Contains, name1+" ") |
|
| 220 |
- c.Assert(out, checker.Contains, name2+" ") |
|
| 221 |
- c.Assert(out, checker.Not(checker.Contains), name3+" ") |
|
| 219 |
+ assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 220 |
+ assert.Assert(c, out, checker.Contains, name2+" ") |
|
| 221 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name3+" ") |
|
| 222 | 222 |
|
| 223 | 223 |
out, err = d.Cmd("service", "ls")
|
| 224 | 224 |
assert.NilError(c, err, out) |
| 225 |
- c.Assert(out, checker.Contains, name1+" ") |
|
| 226 |
- c.Assert(out, checker.Contains, name2+" ") |
|
| 227 |
- c.Assert(out, checker.Contains, name3+" ") |
|
| 225 |
+ assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 226 |
+ assert.Assert(c, out, checker.Contains, name2+" ") |
|
| 227 |
+ assert.Assert(c, out, checker.Contains, name3+" ") |
|
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 | 230 |
func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *check.C) {
|
| ... | ... |
@@ -239,11 +239,11 @@ func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *check.C) {
|
| 239 | 239 |
|
| 240 | 240 |
out, err = d.Cmd("node", "ls", "--filter", filter)
|
| 241 | 241 |
assert.NilError(c, err, out) |
| 242 |
- c.Assert(out, checker.Contains, name) |
|
| 242 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 243 | 243 |
|
| 244 | 244 |
out, err = d.Cmd("node", "ls", "--filter", "name=none")
|
| 245 | 245 |
assert.NilError(c, err, out) |
| 246 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 246 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) {
|
| ... | ... |
@@ -261,15 +261,15 @@ func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) {
|
| 261 | 261 |
|
| 262 | 262 |
out, err = d.Cmd("node", "ps", "--filter", filter, "self")
|
| 263 | 263 |
assert.NilError(c, err, out) |
| 264 |
- c.Assert(out, checker.Contains, name+".1") |
|
| 265 |
- c.Assert(out, checker.Contains, name+".2") |
|
| 266 |
- c.Assert(out, checker.Contains, name+".3") |
|
| 264 |
+ assert.Assert(c, out, checker.Contains, name+".1") |
|
| 265 |
+ assert.Assert(c, out, checker.Contains, name+".2") |
|
| 266 |
+ assert.Assert(c, out, checker.Contains, name+".3") |
|
| 267 | 267 |
|
| 268 | 268 |
out, err = d.Cmd("node", "ps", "--filter", "name=none", "self")
|
| 269 | 269 |
assert.NilError(c, err, out) |
| 270 |
- c.Assert(out, checker.Not(checker.Contains), name+".1") |
|
| 271 |
- c.Assert(out, checker.Not(checker.Contains), name+".2") |
|
| 272 |
- c.Assert(out, checker.Not(checker.Contains), name+".3") |
|
| 270 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".1") |
|
| 271 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".2") |
|
| 272 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".3") |
|
| 273 | 273 |
} |
| 274 | 274 |
|
| 275 | 275 |
// Test case for #25375 |
| ... | ... |
@@ -431,7 +431,7 @@ func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) {
|
| 431 | 431 |
assert.NilError(c, err, out) |
| 432 | 432 |
|
| 433 | 433 |
// Leave the swarm |
| 434 |
- c.Assert(d.SwarmLeave(c, true), checker.IsNil) |
|
| 434 |
+ assert.Assert(c, d.SwarmLeave(c, true), checker.IsNil) |
|
| 435 | 435 |
|
| 436 | 436 |
// Check the container is disconnected |
| 437 | 437 |
out, err = d.Cmd("inspect", "c1", "--format", "{{.NetworkSettings.Networks."+nwName+"}}")
|
| ... | ... |
@@ -441,7 +441,7 @@ func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) {
|
| 441 | 441 |
// Check the network is gone |
| 442 | 442 |
out, err = d.Cmd("network", "ls", "--format", "{{.Name}}")
|
| 443 | 443 |
assert.NilError(c, err, out) |
| 444 |
- c.Assert(out, checker.Not(checker.Contains), nwName) |
|
| 444 |
+ assert.Assert(c, out, checker.Not(checker.Contains), nwName) |
|
| 445 | 445 |
} |
| 446 | 446 |
|
| 447 | 447 |
func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *check.C) {
|
| ... | ... |
@@ -488,7 +488,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
| 488 | 488 |
// But only one is allowed |
| 489 | 489 |
out, err = d.Cmd("network", "create", "-d", "overlay", "--ingress", "another-ingress")
|
| 490 | 490 |
assert.ErrorContains(c, err, "") |
| 491 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "is already present") |
|
| 491 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "is already present") |
|
| 492 | 492 |
|
| 493 | 493 |
// It cannot be removed if it is being used |
| 494 | 494 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv1", "-p", "9000:8000", "busybox", "top")
|
| ... | ... |
@@ -510,12 +510,12 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
|
| 510 | 510 |
// A service which needs the ingress network cannot be created if no ingress is present |
| 511 | 511 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv2", "-p", "500:500", "busybox", "top")
|
| 512 | 512 |
assert.ErrorContains(c, err, "") |
| 513 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 513 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 514 | 514 |
|
| 515 | 515 |
// An existing service cannot be updated to use the ingress nw if the nw is not present |
| 516 | 516 |
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "9000:8000", "srv1")
|
| 517 | 517 |
assert.ErrorContains(c, err, "") |
| 518 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 518 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 519 | 519 |
|
| 520 | 520 |
// But services which do not need routing mesh can be created regardless |
| 521 | 521 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv3", "--endpoint-mode", "dnsrr", "busybox", "top")
|
| ... | ... |
@@ -562,21 +562,21 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) {
|
| 562 | 562 |
|
| 563 | 563 |
out, err = d.Cmd("service", "ps", "--filter", filter, name)
|
| 564 | 564 |
assert.NilError(c, err, out) |
| 565 |
- c.Assert(out, checker.Contains, name+".1") |
|
| 566 |
- c.Assert(out, checker.Contains, name+".2") |
|
| 567 |
- c.Assert(out, checker.Contains, name+".3") |
|
| 565 |
+ assert.Assert(c, out, checker.Contains, name+".1") |
|
| 566 |
+ assert.Assert(c, out, checker.Contains, name+".2") |
|
| 567 |
+ assert.Assert(c, out, checker.Contains, name+".3") |
|
| 568 | 568 |
|
| 569 | 569 |
out, err = d.Cmd("service", "ps", "--filter", "name="+name+".1", name)
|
| 570 | 570 |
assert.NilError(c, err, out) |
| 571 |
- c.Assert(out, checker.Contains, name+".1") |
|
| 572 |
- c.Assert(out, checker.Not(checker.Contains), name+".2") |
|
| 573 |
- c.Assert(out, checker.Not(checker.Contains), name+".3") |
|
| 571 |
+ assert.Assert(c, out, checker.Contains, name+".1") |
|
| 572 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".2") |
|
| 573 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".3") |
|
| 574 | 574 |
|
| 575 | 575 |
out, err = d.Cmd("service", "ps", "--filter", "name=none", name)
|
| 576 | 576 |
assert.NilError(c, err, out) |
| 577 |
- c.Assert(out, checker.Not(checker.Contains), name+".1") |
|
| 578 |
- c.Assert(out, checker.Not(checker.Contains), name+".2") |
|
| 579 |
- c.Assert(out, checker.Not(checker.Contains), name+".3") |
|
| 577 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".1") |
|
| 578 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".2") |
|
| 579 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name+".3") |
|
| 580 | 580 |
|
| 581 | 581 |
name = "redis-cluster-sha1" |
| 582 | 582 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--mode=global", "busybox", "top")
|
| ... | ... |
@@ -588,15 +588,15 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) {
|
| 588 | 588 |
filter = "name=redis-cluster" |
| 589 | 589 |
out, err = d.Cmd("service", "ps", "--filter", filter, name)
|
| 590 | 590 |
assert.NilError(c, err, out) |
| 591 |
- c.Assert(out, checker.Contains, name) |
|
| 591 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 592 | 592 |
|
| 593 | 593 |
out, err = d.Cmd("service", "ps", "--filter", "name="+name, name)
|
| 594 | 594 |
assert.NilError(c, err, out) |
| 595 |
- c.Assert(out, checker.Contains, name) |
|
| 595 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 596 | 596 |
|
| 597 | 597 |
out, err = d.Cmd("service", "ps", "--filter", "name=none", name)
|
| 598 | 598 |
assert.NilError(c, err, out) |
| 599 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 599 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 600 | 600 |
} |
| 601 | 601 |
|
| 602 | 602 |
func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *check.C) {
|
| ... | ... |
@@ -619,14 +619,14 @@ func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *check.C) {
|
| 619 | 619 |
out, err = d.Cmd("ps", "-a", "-q", "--filter=is-task=false")
|
| 620 | 620 |
assert.NilError(c, err, out) |
| 621 | 621 |
psOut := strings.TrimSpace(out) |
| 622 |
- c.Assert(psOut, checker.Equals, bareID, check.Commentf("Expected id %s, got %s for is-task label, output %q", bareID, psOut, out))
|
|
| 622 |
+ assert.Assert(c, psOut, checker.Equals, bareID, check.Commentf("Expected id %s, got %s for is-task label, output %q", bareID, psOut, out))
|
|
| 623 | 623 |
|
| 624 | 624 |
// Filter tasks |
| 625 | 625 |
out, err = d.Cmd("ps", "-a", "-q", "--filter=is-task=true")
|
| 626 | 626 |
assert.NilError(c, err, out) |
| 627 | 627 |
lines := strings.Split(strings.Trim(out, "\n "), "\n") |
| 628 | 628 |
assert.Equal(c, len(lines), 1) |
| 629 |
- c.Assert(lines[0], checker.Not(checker.Equals), bareID, check.Commentf("Expected not %s, but got it for is-task label, output %q", bareID, out))
|
|
| 629 |
+ assert.Assert(c, lines[0], checker.Not(checker.Equals), bareID, check.Commentf("Expected not %s, but got it for is-task label, output %q", bareID, out))
|
|
| 630 | 630 |
} |
| 631 | 631 |
|
| 632 | 632 |
const globalNetworkPlugin = "global-network-plugin" |
| ... | ... |
@@ -803,7 +803,7 @@ func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, |
| 803 | 803 |
func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) {
|
| 804 | 804 |
mux := http.NewServeMux() |
| 805 | 805 |
s.server = httptest.NewServer(mux) |
| 806 |
- c.Assert(s.server, check.NotNil) // check that HTTP server has started |
|
| 806 |
+ assert.Assert(c, s.server, check.NotNil) // check that HTTP server has started |
|
| 807 | 807 |
setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin) |
| 808 | 808 |
defer func() {
|
| 809 | 809 |
s.server.Close() |
| ... | ... |
@@ -815,7 +815,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) {
|
| 815 | 815 |
|
| 816 | 816 |
out, err := d.Cmd("network", "create", "-d", globalNetworkPlugin, "foo")
|
| 817 | 817 |
assert.ErrorContains(c, err, "", out) |
| 818 |
- c.Assert(out, checker.Contains, "not supported in swarm mode") |
|
| 818 |
+ assert.Assert(c, out, checker.Contains, "not supported in swarm mode") |
|
| 819 | 819 |
} |
| 820 | 820 |
|
| 821 | 821 |
// Test case for #24712 |
| ... | ... |
@@ -834,7 +834,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceEnvFile(c *check.C) {
|
| 834 | 834 |
// The complete env is [VAR1=A VAR2=A VAR1=B VAR1=C VAR2= VAR2] and duplicates will be removed => [VAR1=C VAR2] |
| 835 | 835 |
out, err = d.Cmd("inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.Env }}", name)
|
| 836 | 836 |
assert.NilError(c, err, out) |
| 837 |
- c.Assert(out, checker.Contains, "[VAR1=C VAR2]") |
|
| 837 |
+ assert.Assert(c, out, checker.Contains, "[VAR1=C VAR2]") |
|
| 838 | 838 |
} |
| 839 | 839 |
|
| 840 | 840 |
func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
|
| ... | ... |
@@ -859,7 +859,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
|
| 859 | 859 |
|
| 860 | 860 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 861 | 861 |
assert.NilError(c, err, out) |
| 862 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 862 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 863 | 863 |
|
| 864 | 864 |
// Remove service |
| 865 | 865 |
out, err = d.Cmd("service", "rm", name)
|
| ... | ... |
@@ -882,7 +882,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
|
| 882 | 882 |
|
| 883 | 883 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 884 | 884 |
assert.NilError(c, err, out) |
| 885 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 885 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 886 | 886 |
} |
| 887 | 887 |
|
| 888 | 888 |
func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *check.C) {
|
| ... | ... |
@@ -969,9 +969,9 @@ func (s *DockerSwarmSuite) TestDNSConfig(c *check.C) {
|
| 969 | 969 |
expectedOutput3 := "options timeout:3" |
| 970 | 970 |
out, err = d.Cmd("exec", id, "cat", "/etc/resolv.conf")
|
| 971 | 971 |
assert.NilError(c, err, out) |
| 972 |
- c.Assert(out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 973 |
- c.Assert(out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 974 |
- c.Assert(out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 972 |
+ assert.Assert(c, out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 973 |
+ assert.Assert(c, out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 974 |
+ assert.Assert(c, out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 975 | 975 |
} |
| 976 | 976 |
|
| 977 | 977 |
func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *check.C) {
|
| ... | ... |
@@ -1039,8 +1039,8 @@ func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *check.C) {
|
| 1039 | 1039 |
result.Assert(c, icmd.Expected{
|
| 1040 | 1040 |
ExitCode: 1, |
| 1041 | 1041 |
}) |
| 1042 |
- c.Assert(result.Combined(), checker.Contains, "Error: This node is not part of a swarm") |
|
| 1043 |
- c.Assert(result.Combined(), checker.Not(checker.Contains), "Please enter unlock key") |
|
| 1042 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Error: This node is not part of a swarm") |
|
| 1043 |
+ assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Please enter unlock key") |
|
| 1044 | 1044 |
|
| 1045 | 1045 |
out, err := d.Cmd("swarm", "init")
|
| 1046 | 1046 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -1051,22 +1051,22 @@ func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *check.C) {
|
| 1051 | 1051 |
result.Assert(c, icmd.Expected{
|
| 1052 | 1052 |
ExitCode: 1, |
| 1053 | 1053 |
}) |
| 1054 |
- c.Assert(result.Combined(), checker.Contains, "Error: swarm is not locked") |
|
| 1055 |
- c.Assert(result.Combined(), checker.Not(checker.Contains), "Please enter unlock key") |
|
| 1054 |
+ assert.Assert(c, result.Combined(), checker.Contains, "Error: swarm is not locked") |
|
| 1055 |
+ assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Please enter unlock key") |
|
| 1056 | 1056 |
} |
| 1057 | 1057 |
|
| 1058 | 1058 |
func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) {
|
| 1059 | 1059 |
d := s.AddDaemon(c, false, false) |
| 1060 | 1060 |
|
| 1061 | 1061 |
outs, err := d.Cmd("swarm", "init", "--autolock")
|
| 1062 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1062 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1063 | 1063 |
unlockKey := getUnlockKey(d, c, outs) |
| 1064 | 1064 |
|
| 1065 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1065 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1066 | 1066 |
|
| 1067 | 1067 |
// It starts off locked |
| 1068 | 1068 |
d.RestartNode(c) |
| 1069 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1069 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1070 | 1070 |
|
| 1071 | 1071 |
cmd := d.Command("swarm", "unlock")
|
| 1072 | 1072 |
cmd.Stdin = bytes.NewBufferString("wrong-secret-key")
|
| ... | ... |
@@ -1075,33 +1075,33 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) {
|
| 1075 | 1075 |
Err: "invalid key", |
| 1076 | 1076 |
}) |
| 1077 | 1077 |
|
| 1078 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1078 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1079 | 1079 |
|
| 1080 | 1080 |
cmd = d.Command("swarm", "unlock")
|
| 1081 | 1081 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1082 | 1082 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1083 | 1083 |
|
| 1084 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1084 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1085 | 1085 |
|
| 1086 | 1086 |
outs, err = d.Cmd("node", "ls")
|
| 1087 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1088 |
- c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1087 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1088 |
+ assert.Assert(c, outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1089 | 1089 |
|
| 1090 | 1090 |
outs, err = d.Cmd("swarm", "update", "--autolock=false")
|
| 1091 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1091 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1092 | 1092 |
|
| 1093 | 1093 |
checkSwarmLockedToUnlocked(c, d) |
| 1094 | 1094 |
|
| 1095 | 1095 |
outs, err = d.Cmd("node", "ls")
|
| 1096 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1097 |
- c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1096 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1097 |
+ assert.Assert(c, outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1098 | 1098 |
} |
| 1099 | 1099 |
|
| 1100 | 1100 |
func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *check.C) {
|
| 1101 | 1101 |
d := s.AddDaemon(c, false, false) |
| 1102 | 1102 |
|
| 1103 | 1103 |
outs, err := d.Cmd("swarm", "init", "--autolock")
|
| 1104 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1104 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1105 | 1105 |
|
| 1106 | 1106 |
// It starts off locked |
| 1107 | 1107 |
d.RestartNode(c) |
| ... | ... |
@@ -1110,21 +1110,21 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *check.C) {
|
| 1110 | 1110 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateLocked) |
| 1111 | 1111 |
|
| 1112 | 1112 |
outs, _ = d.Cmd("node", "ls")
|
| 1113 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1113 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1114 | 1114 |
|
| 1115 | 1115 |
// `docker swarm leave` a locked swarm without --force will return an error |
| 1116 | 1116 |
outs, _ = d.Cmd("swarm", "leave")
|
| 1117 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and locked.") |
|
| 1117 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and locked.") |
|
| 1118 | 1118 |
|
| 1119 | 1119 |
// It is OK for user to leave a locked swarm with --force |
| 1120 | 1120 |
outs, err = d.Cmd("swarm", "leave", "--force")
|
| 1121 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1121 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1122 | 1122 |
|
| 1123 | 1123 |
info = d.SwarmInfo(c) |
| 1124 | 1124 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive) |
| 1125 | 1125 |
|
| 1126 | 1126 |
outs, err = d.Cmd("swarm", "init")
|
| 1127 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1127 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1128 | 1128 |
|
| 1129 | 1129 |
info = d.SwarmInfo(c) |
| 1130 | 1130 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) |
| ... | ... |
@@ -1137,14 +1137,14 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
|
| 1137 | 1137 |
|
| 1138 | 1138 |
// they start off unlocked |
| 1139 | 1139 |
d2.RestartNode(c) |
| 1140 |
- c.Assert(getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1140 |
+ assert.Assert(c, getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1141 | 1141 |
|
| 1142 | 1142 |
// stop this one so it does not get autolock info |
| 1143 | 1143 |
d2.Stop(c) |
| 1144 | 1144 |
|
| 1145 | 1145 |
// enable autolock |
| 1146 | 1146 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1147 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1147 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1148 | 1148 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1149 | 1149 |
|
| 1150 | 1150 |
// The ones that got the cluster update should be set to locked |
| ... | ... |
@@ -1154,19 +1154,19 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
|
| 1154 | 1154 |
cmd := d.Command("swarm", "unlock")
|
| 1155 | 1155 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1156 | 1156 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1157 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1157 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1158 | 1158 |
} |
| 1159 | 1159 |
|
| 1160 | 1160 |
// d2 never got the cluster update, so it is still set to unlocked |
| 1161 | 1161 |
d2.StartNode(c) |
| 1162 |
- c.Assert(getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1162 |
+ assert.Assert(c, getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1163 | 1163 |
|
| 1164 | 1164 |
// d2 is now set to lock |
| 1165 | 1165 |
checkSwarmUnlockedToLocked(c, d2) |
| 1166 | 1166 |
|
| 1167 | 1167 |
// leave it locked, and set the cluster to no longer autolock |
| 1168 | 1168 |
outs, err = d1.Cmd("swarm", "update", "--autolock=false")
|
| 1169 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1169 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1170 | 1170 |
|
| 1171 | 1171 |
// the ones that got the update are now set to unlocked |
| 1172 | 1172 |
for _, d := range []*daemon.Daemon{d1, d3} {
|
| ... | ... |
@@ -1174,13 +1174,13 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
|
| 1174 | 1174 |
} |
| 1175 | 1175 |
|
| 1176 | 1176 |
// d2 still locked |
| 1177 |
- c.Assert(getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1177 |
+ assert.Assert(c, getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1178 | 1178 |
|
| 1179 | 1179 |
// unlock it |
| 1180 | 1180 |
cmd := d2.Command("swarm", "unlock")
|
| 1181 | 1181 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1182 | 1182 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1183 |
- c.Assert(getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1183 |
+ assert.Assert(c, getNodeStatus(c, d2), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1184 | 1184 |
|
| 1185 | 1185 |
// once it's caught up, d2 is set to not be locked |
| 1186 | 1186 |
checkSwarmLockedToUnlocked(c, d2) |
| ... | ... |
@@ -1188,7 +1188,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
|
| 1188 | 1188 |
// managers who join now are never set to locked in the first place |
| 1189 | 1189 |
d4 := s.AddDaemon(c, true, true) |
| 1190 | 1190 |
d4.RestartNode(c) |
| 1191 |
- c.Assert(getNodeStatus(c, d4), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1191 |
+ assert.Assert(c, getNodeStatus(c, d4), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1192 | 1192 |
} |
| 1193 | 1193 |
|
| 1194 | 1194 |
func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
|
| ... | ... |
@@ -1196,7 +1196,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
|
| 1196 | 1196 |
|
| 1197 | 1197 |
// enable autolock |
| 1198 | 1198 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1199 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1199 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1200 | 1200 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1201 | 1201 |
|
| 1202 | 1202 |
// joined workers start off unlocked |
| ... | ... |
@@ -1207,7 +1207,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
|
| 1207 | 1207 |
// promote worker |
| 1208 | 1208 |
outs, err = d1.Cmd("node", "promote", d2.NodeID())
|
| 1209 | 1209 |
assert.NilError(c, err) |
| 1210 |
- c.Assert(outs, checker.Contains, "promoted to a manager in the swarm") |
|
| 1210 |
+ assert.Assert(c, outs, checker.Contains, "promoted to a manager in the swarm") |
|
| 1211 | 1211 |
|
| 1212 | 1212 |
// join new manager node |
| 1213 | 1213 |
d3 := s.AddDaemon(c, true, true) |
| ... | ... |
@@ -1219,13 +1219,13 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
|
| 1219 | 1219 |
cmd := d.Command("swarm", "unlock")
|
| 1220 | 1220 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1221 | 1221 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1222 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1222 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1223 | 1223 |
} |
| 1224 | 1224 |
|
| 1225 | 1225 |
// demote manager back to worker - workers are not locked |
| 1226 | 1226 |
outs, err = d1.Cmd("node", "demote", d3.NodeID())
|
| 1227 | 1227 |
assert.NilError(c, err) |
| 1228 |
- c.Assert(outs, checker.Contains, "demoted in the swarm") |
|
| 1228 |
+ assert.Assert(c, outs, checker.Contains, "demoted in the swarm") |
|
| 1229 | 1229 |
|
| 1230 | 1230 |
// Wait for it to actually be demoted, for the key and cert to be replaced. |
| 1231 | 1231 |
// Then restart and assert that the node is not locked. If we don't wait for the cert |
| ... | ... |
@@ -1254,23 +1254,23 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
|
| 1254 | 1254 |
d := s.AddDaemon(c, true, true) |
| 1255 | 1255 |
|
| 1256 | 1256 |
outs, err := d.Cmd("swarm", "update", "--autolock")
|
| 1257 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1257 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1258 | 1258 |
unlockKey := getUnlockKey(d, c, outs) |
| 1259 | 1259 |
|
| 1260 | 1260 |
// Rotate multiple times |
| 1261 | 1261 |
for i := 0; i != 3; i++ {
|
| 1262 | 1262 |
outs, err = d.Cmd("swarm", "unlock-key", "-q", "--rotate")
|
| 1263 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1263 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1264 | 1264 |
// Strip \n |
| 1265 | 1265 |
newUnlockKey := outs[:len(outs)-1] |
| 1266 |
- c.Assert(newUnlockKey, checker.Not(checker.Equals), "") |
|
| 1267 |
- c.Assert(newUnlockKey, checker.Not(checker.Equals), unlockKey) |
|
| 1266 |
+ assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), "") |
|
| 1267 |
+ assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), unlockKey) |
|
| 1268 | 1268 |
|
| 1269 | 1269 |
d.RestartNode(c) |
| 1270 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1270 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1271 | 1271 |
|
| 1272 | 1272 |
outs, _ = d.Cmd("node", "ls")
|
| 1273 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1273 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1274 | 1274 |
|
| 1275 | 1275 |
cmd := d.Command("swarm", "unlock")
|
| 1276 | 1276 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| ... | ... |
@@ -1299,13 +1299,13 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
|
| 1299 | 1299 |
}) |
| 1300 | 1300 |
|
| 1301 | 1301 |
outs, _ = d.Cmd("node", "ls")
|
| 1302 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1302 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1303 | 1303 |
|
| 1304 | 1304 |
cmd = d.Command("swarm", "unlock")
|
| 1305 | 1305 |
cmd.Stdin = bytes.NewBufferString(newUnlockKey) |
| 1306 | 1306 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1307 | 1307 |
|
| 1308 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1308 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1309 | 1309 |
|
| 1310 | 1310 |
retry := 0 |
| 1311 | 1311 |
for {
|
| ... | ... |
@@ -1319,7 +1319,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
|
| 1319 | 1319 |
} |
| 1320 | 1320 |
} |
| 1321 | 1321 |
assert.NilError(c, err) |
| 1322 |
- c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1322 |
+ assert.Assert(c, outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1323 | 1323 |
break |
| 1324 | 1324 |
} |
| 1325 | 1325 |
|
| ... | ... |
@@ -1343,26 +1343,26 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
|
| 1343 | 1343 |
d3 := s.AddDaemon(c, true, true) |
| 1344 | 1344 |
|
| 1345 | 1345 |
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
| 1346 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1346 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1347 | 1347 |
unlockKey := getUnlockKey(d1, c, outs) |
| 1348 | 1348 |
|
| 1349 | 1349 |
// Rotate multiple times |
| 1350 | 1350 |
for i := 0; i != 3; i++ {
|
| 1351 | 1351 |
outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
|
| 1352 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1352 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1353 | 1353 |
// Strip \n |
| 1354 | 1354 |
newUnlockKey := outs[:len(outs)-1] |
| 1355 |
- c.Assert(newUnlockKey, checker.Not(checker.Equals), "") |
|
| 1356 |
- c.Assert(newUnlockKey, checker.Not(checker.Equals), unlockKey) |
|
| 1355 |
+ assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), "") |
|
| 1356 |
+ assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), unlockKey) |
|
| 1357 | 1357 |
|
| 1358 | 1358 |
d2.RestartNode(c) |
| 1359 | 1359 |
d3.RestartNode(c) |
| 1360 | 1360 |
|
| 1361 | 1361 |
for _, d := range []*daemon.Daemon{d2, d3} {
|
| 1362 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1362 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked) |
|
| 1363 | 1363 |
|
| 1364 | 1364 |
outs, _ := d.Cmd("node", "ls")
|
| 1365 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1365 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1366 | 1366 |
|
| 1367 | 1367 |
cmd := d.Command("swarm", "unlock")
|
| 1368 | 1368 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| ... | ... |
@@ -1391,13 +1391,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
|
| 1391 | 1391 |
}) |
| 1392 | 1392 |
|
| 1393 | 1393 |
outs, _ = d.Cmd("node", "ls")
|
| 1394 |
- c.Assert(outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1394 |
+ assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1395 | 1395 |
|
| 1396 | 1396 |
cmd = d.Command("swarm", "unlock")
|
| 1397 | 1397 |
cmd.Stdin = bytes.NewBufferString(newUnlockKey) |
| 1398 | 1398 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1399 | 1399 |
|
| 1400 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1400 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1401 | 1401 |
|
| 1402 | 1402 |
retry := 0 |
| 1403 | 1403 |
for {
|
| ... | ... |
@@ -1410,8 +1410,8 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
|
| 1410 | 1410 |
continue |
| 1411 | 1411 |
} |
| 1412 | 1412 |
} |
| 1413 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1414 |
- c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1413 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
|
|
| 1414 |
+ assert.Assert(c, outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") |
|
| 1415 | 1415 |
break |
| 1416 | 1416 |
} |
| 1417 | 1417 |
} |
| ... | ... |
@@ -1426,8 +1426,8 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *check.C) {
|
| 1426 | 1426 |
for i := 0; i < 2; i++ {
|
| 1427 | 1427 |
// set to lock |
| 1428 | 1428 |
outs, err := d.Cmd("swarm", "update", "--autolock")
|
| 1429 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1430 |
- c.Assert(outs, checker.Contains, "docker swarm unlock") |
|
| 1429 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1430 |
+ assert.Assert(c, outs, checker.Contains, "docker swarm unlock") |
|
| 1431 | 1431 |
unlockKey := getUnlockKey(d, c, outs) |
| 1432 | 1432 |
|
| 1433 | 1433 |
checkSwarmUnlockedToLocked(c, d) |
| ... | ... |
@@ -1436,10 +1436,10 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *check.C) {
|
| 1436 | 1436 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1437 | 1437 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| 1438 | 1438 |
|
| 1439 |
- c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1439 |
+ assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) |
|
| 1440 | 1440 |
|
| 1441 | 1441 |
outs, err = d.Cmd("swarm", "update", "--autolock=false")
|
| 1442 |
- c.Assert(err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1442 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
|
|
| 1443 | 1443 |
|
| 1444 | 1444 |
checkSwarmLockedToUnlocked(c, d) |
| 1445 | 1445 |
} |
| ... | ... |
@@ -1465,7 +1465,7 @@ func (s *DockerSwarmSuite) TestExtraHosts(c *check.C) {
|
| 1465 | 1465 |
expectedOutput := "1.2.3.4\texample.com" |
| 1466 | 1466 |
out, err = d.Cmd("exec", id, "cat", "/etc/hosts")
|
| 1467 | 1467 |
assert.NilError(c, err, out) |
| 1468 |
- c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1468 |
+ assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1469 | 1469 |
} |
| 1470 | 1470 |
|
| 1471 | 1471 |
func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *check.C) {
|
| ... | ... |
@@ -1498,8 +1498,8 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) {
|
| 1498 | 1498 |
|
| 1499 | 1499 |
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
| 1500 | 1500 |
assert.NilError(c, err, out) |
| 1501 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1502 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1501 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1502 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1503 | 1503 |
|
| 1504 | 1504 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--network=foo", "--name", "top", "busybox", "top")
|
| 1505 | 1505 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -1509,8 +1509,8 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) {
|
| 1509 | 1509 |
|
| 1510 | 1510 |
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
| 1511 | 1511 |
assert.NilError(c, err, out) |
| 1512 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1513 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1512 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1513 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1514 | 1514 |
} |
| 1515 | 1515 |
|
| 1516 | 1516 |
// Test case for issue #27866, which did not allow NW name that is the prefix of a swarm NW ID. |
| ... | ... |
@@ -1520,7 +1520,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateIssue27866(c *check.C) {
|
| 1520 | 1520 |
out, err := d.Cmd("network", "inspect", "-f", "{{.Id}}", "ingress")
|
| 1521 | 1521 |
assert.NilError(c, err, "out: %v", out) |
| 1522 | 1522 |
ingressID := strings.TrimSpace(out) |
| 1523 |
- c.Assert(ingressID, checker.Not(checker.Equals), "") |
|
| 1523 |
+ assert.Assert(c, ingressID, checker.Not(checker.Equals), "") |
|
| 1524 | 1524 |
|
| 1525 | 1525 |
// create a network of which name is the prefix of the ID of an overlay network |
| 1526 | 1526 |
// (ingressID in this case) |
| ... | ... |
@@ -1549,7 +1549,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *check.C) {
|
| 1549 | 1549 |
out, err := d.Cmd("network", "create", "--driver", driver1, nwName)
|
| 1550 | 1550 |
assert.NilError(c, err, "out: %v", out) |
| 1551 | 1551 |
out, err = d.Cmd("network", "create", "--driver", driver2, nwName)
|
| 1552 |
- c.Assert(out, checker.Contains, fmt.Sprintf("network with name %s already exists", nwName))
|
|
| 1552 |
+ assert.Assert(c, out, checker.Contains, fmt.Sprintf("network with name %s already exists", nwName))
|
|
| 1553 | 1553 |
assert.ErrorContains(c, err, "") |
| 1554 | 1554 |
c.Logf("As expected, the attempt to network %q with %q failed: %s",
|
| 1555 | 1555 |
nwName, driver2, out) |
| ... | ... |
@@ -1573,9 +1573,9 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) {
|
| 1573 | 1573 |
// Dynamic ports are likely to be 30000 and 30001 but doesn't matter |
| 1574 | 1574 |
out, err = d.Cmd("service", "inspect", "--format", "{{.Endpoint.Ports}} len={{len .Endpoint.Ports}}", id)
|
| 1575 | 1575 |
assert.NilError(c, err, out) |
| 1576 |
- c.Assert(out, checker.Contains, "len=4") |
|
| 1577 |
- c.Assert(out, checker.Contains, "{ tcp 80 5005 ingress}")
|
|
| 1578 |
- c.Assert(out, checker.Contains, "{ tcp 80 5006 ingress}")
|
|
| 1576 |
+ assert.Assert(c, out, checker.Contains, "len=4") |
|
| 1577 |
+ assert.Assert(c, out, checker.Contains, "{ tcp 80 5005 ingress}")
|
|
| 1578 |
+ assert.Assert(c, out, checker.Contains, "{ tcp 80 5006 ingress}")
|
|
| 1579 | 1579 |
} |
| 1580 | 1580 |
|
| 1581 | 1581 |
func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) {
|
| ... | ... |
@@ -1583,7 +1583,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) {
|
| 1583 | 1583 |
|
| 1584 | 1584 |
out, err := d.Cmd("node", "ls")
|
| 1585 | 1585 |
assert.NilError(c, err) |
| 1586 |
- c.Assert(out, checker.Not(checker.Contains), "Drain") |
|
| 1586 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "Drain") |
|
| 1587 | 1587 |
|
| 1588 | 1588 |
out, err = d.Cmd("swarm", "join-token", "-q", "manager")
|
| 1589 | 1589 |
assert.NilError(c, err) |
| ... | ... |
@@ -1599,11 +1599,11 @@ func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) {
|
| 1599 | 1599 |
|
| 1600 | 1600 |
out, err = d.Cmd("node", "ls")
|
| 1601 | 1601 |
assert.NilError(c, err) |
| 1602 |
- c.Assert(out, checker.Contains, "Drain") |
|
| 1602 |
+ assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1603 | 1603 |
|
| 1604 | 1604 |
out, err = d1.Cmd("node", "ls")
|
| 1605 | 1605 |
assert.NilError(c, err) |
| 1606 |
- c.Assert(out, checker.Contains, "Drain") |
|
| 1606 |
+ assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1607 | 1607 |
} |
| 1608 | 1608 |
|
| 1609 | 1609 |
func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *check.C) {
|
| ... | ... |
@@ -1614,7 +1614,7 @@ func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *check.C) {
|
| 1614 | 1614 |
|
| 1615 | 1615 |
out, err = d.Cmd("node", "ls")
|
| 1616 | 1616 |
assert.NilError(c, err) |
| 1617 |
- c.Assert(out, checker.Contains, "Drain") |
|
| 1617 |
+ assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1618 | 1618 |
} |
| 1619 | 1619 |
|
| 1620 | 1620 |
func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *check.C) {
|
| ... | ... |
@@ -1677,7 +1677,7 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) {
|
| 1677 | 1677 |
// Name with duplicates |
| 1678 | 1678 |
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
| 1679 | 1679 |
assert.ErrorContains(c, err, "", out) |
| 1680 |
- c.Assert(out, checker.Contains, "2 matches found based on name") |
|
| 1680 |
+ assert.Assert(c, out, checker.Contains, "2 matches found based on name") |
|
| 1681 | 1681 |
|
| 1682 | 1682 |
out, err = d.Cmd("network", "rm", n2.ID)
|
| 1683 | 1683 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -1700,7 +1700,7 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) {
|
| 1700 | 1700 |
// Name with duplicates |
| 1701 | 1701 |
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
| 1702 | 1702 |
assert.ErrorContains(c, err, "", out) |
| 1703 |
- c.Assert(out, checker.Contains, "2 matches found based on name") |
|
| 1703 |
+ assert.Assert(c, out, checker.Contains, "2 matches found based on name") |
|
| 1704 | 1704 |
} |
| 1705 | 1705 |
|
| 1706 | 1706 |
func (s *DockerSwarmSuite) TestSwarmStopSignal(c *check.C) {
|
| ... | ... |
@@ -1747,19 +1747,19 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) {
|
| 1747 | 1747 |
|
| 1748 | 1748 |
out, err = d.Cmd("service", "ls")
|
| 1749 | 1749 |
assert.NilError(c, err, out) |
| 1750 |
- c.Assert(out, checker.Contains, "top1") |
|
| 1751 |
- c.Assert(out, checker.Contains, "top2") |
|
| 1752 |
- c.Assert(out, checker.Not(checker.Contains), "localnet") |
|
| 1750 |
+ assert.Assert(c, out, checker.Contains, "top1") |
|
| 1751 |
+ assert.Assert(c, out, checker.Contains, "top2") |
|
| 1752 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "localnet") |
|
| 1753 | 1753 |
|
| 1754 | 1754 |
out, err = d.Cmd("service", "ls", "--filter", "mode=global")
|
| 1755 |
- c.Assert(out, checker.Not(checker.Contains), "top1") |
|
| 1756 |
- c.Assert(out, checker.Contains, "top2") |
|
| 1755 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "top1") |
|
| 1756 |
+ assert.Assert(c, out, checker.Contains, "top2") |
|
| 1757 | 1757 |
assert.NilError(c, err, out) |
| 1758 | 1758 |
|
| 1759 | 1759 |
out, err = d.Cmd("service", "ls", "--filter", "mode=replicated")
|
| 1760 | 1760 |
assert.NilError(c, err, out) |
| 1761 |
- c.Assert(out, checker.Contains, "top1") |
|
| 1762 |
- c.Assert(out, checker.Not(checker.Contains), "top2") |
|
| 1761 |
+ assert.Assert(c, out, checker.Contains, "top1") |
|
| 1762 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "top2") |
|
| 1763 | 1763 |
} |
| 1764 | 1764 |
|
| 1765 | 1765 |
func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *check.C) {
|
| ... | ... |
@@ -1767,11 +1767,11 @@ func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *check.C) {
|
| 1767 | 1767 |
|
| 1768 | 1768 |
out, err := d.Cmd("swarm", "init", "--data-path-addr", "0.0.0.0")
|
| 1769 | 1769 |
assert.ErrorContains(c, err, "") |
| 1770 |
- c.Assert(out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1770 |
+ assert.Assert(c, out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1771 | 1771 |
|
| 1772 | 1772 |
out, err = d.Cmd("swarm", "init", "--data-path-addr", "0.0.0.0:2000")
|
| 1773 | 1773 |
assert.ErrorContains(c, err, "") |
| 1774 |
- c.Assert(out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1774 |
+ assert.Assert(c, out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1775 | 1775 |
} |
| 1776 | 1776 |
|
| 1777 | 1777 |
func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *check.C) {
|
| ... | ... |
@@ -1833,7 +1833,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) {
|
| 1833 | 1833 |
out, err := d1.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
| 1834 | 1834 |
assert.NilError(c, err, out) |
| 1835 | 1835 |
networkID := strings.TrimSpace(out) |
| 1836 |
- c.Assert(networkID, checker.Not(checker.Equals), "") |
|
| 1836 |
+ assert.Assert(c, networkID, checker.Not(checker.Equals), "") |
|
| 1837 | 1837 |
|
| 1838 | 1838 |
// d1, d2 are managers that can get swarm events |
| 1839 | 1839 |
waitForEvent(c, d1, "0", "-f scope=swarm", "network create "+networkID, defaultRetryCount) |
| ... | ... |
@@ -1841,7 +1841,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) {
|
| 1841 | 1841 |
|
| 1842 | 1842 |
// d3 is a worker, not able to get cluster events |
| 1843 | 1843 |
out = waitForEvent(c, d3, "0", "-f scope=swarm", "", 1) |
| 1844 |
- c.Assert(out, checker.Not(checker.Contains), "network create ") |
|
| 1844 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "network create ") |
|
| 1845 | 1845 |
} |
| 1846 | 1846 |
|
| 1847 | 1847 |
func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) {
|
| ... | ... |
@@ -1854,7 +1854,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) {
|
| 1854 | 1854 |
|
| 1855 | 1855 |
// scope swarm filters cluster events |
| 1856 | 1856 |
out = waitForEvent(c, d, "0", "-f scope=swarm", "service create "+serviceID, defaultRetryCount) |
| 1857 |
- c.Assert(out, checker.Not(checker.Contains), "container create ") |
|
| 1857 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "container create ") |
|
| 1858 | 1858 |
|
| 1859 | 1859 |
// all events are returned if scope is not specified |
| 1860 | 1860 |
waitForEvent(c, d, "0", "", "service create "+serviceID, 1) |
| ... | ... |
@@ -1862,7 +1862,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) {
|
| 1862 | 1862 |
|
| 1863 | 1863 |
// scope local only shows non-cluster events |
| 1864 | 1864 |
out = waitForEvent(c, d, "0", "-f scope=local", "container create ", 1) |
| 1865 |
- c.Assert(out, checker.Not(checker.Contains), "service create ") |
|
| 1865 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "service create ") |
|
| 1866 | 1866 |
} |
| 1867 | 1867 |
|
| 1868 | 1868 |
func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) {
|
| ... | ... |
@@ -1877,15 +1877,15 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) {
|
| 1877 | 1877 |
out, err = d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
|
| 1878 | 1878 |
assert.NilError(c, err, out) |
| 1879 | 1879 |
networkID := strings.TrimSpace(out) |
| 1880 |
- c.Assert(networkID, checker.Not(checker.Equals), "") |
|
| 1880 |
+ assert.Assert(c, networkID, checker.Not(checker.Equals), "") |
|
| 1881 | 1881 |
|
| 1882 | 1882 |
// filter by service |
| 1883 | 1883 |
out = waitForEvent(c, d, "0", "-f type=service", "service create "+serviceID, defaultRetryCount) |
| 1884 |
- c.Assert(out, checker.Not(checker.Contains), "network create") |
|
| 1884 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "network create") |
|
| 1885 | 1885 |
|
| 1886 | 1886 |
// filter by network |
| 1887 | 1887 |
out = waitForEvent(c, d, "0", "-f type=network", "network create "+networkID, defaultRetryCount) |
| 1888 |
- c.Assert(out, checker.Not(checker.Contains), "service create") |
|
| 1888 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "service create") |
|
| 1889 | 1889 |
} |
| 1890 | 1890 |
|
| 1891 | 1891 |
func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
| ... | ... |
@@ -1905,12 +1905,12 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
| 1905 | 1905 |
|
| 1906 | 1906 |
// wait for service update start |
| 1907 | 1907 |
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1908 |
- c.Assert(out, checker.Contains, "updatestate.new=updating") |
|
| 1908 |
+ assert.Assert(c, out, checker.Contains, "updatestate.new=updating") |
|
| 1909 | 1909 |
|
| 1910 | 1910 |
// allow service update complete. This is a service with 1 instance |
| 1911 | 1911 |
time.Sleep(400 * time.Millisecond) |
| 1912 | 1912 |
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1913 |
- c.Assert(out, checker.Contains, "updatestate.new=completed, updatestate.old=updating") |
|
| 1913 |
+ assert.Assert(c, out, checker.Contains, "updatestate.new=completed, updatestate.old=updating") |
|
| 1914 | 1914 |
|
| 1915 | 1915 |
// scale service |
| 1916 | 1916 |
t2 := daemonUnixTime(c) |
| ... | ... |
@@ -1918,7 +1918,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) {
|
| 1918 | 1918 |
assert.NilError(c, err, out) |
| 1919 | 1919 |
|
| 1920 | 1920 |
out = waitForEvent(c, d, t2, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1921 |
- c.Assert(out, checker.Contains, "replicas.new=3, replicas.old=1") |
|
| 1921 |
+ assert.Assert(c, out, checker.Contains, "replicas.new=3, replicas.old=1") |
|
| 1922 | 1922 |
|
| 1923 | 1923 |
// remove service |
| 1924 | 1924 |
t3 := daemonUnixTime(c) |
| ... | ... |
@@ -1942,7 +1942,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) {
|
| 1942 | 1942 |
|
| 1943 | 1943 |
// filter by type |
| 1944 | 1944 |
out = waitForEvent(c, d1, t1, "-f type=node", "node update "+d3ID, defaultRetryCount) |
| 1945 |
- c.Assert(out, checker.Contains, "availability.new=pause, availability.old=active") |
|
| 1945 |
+ assert.Assert(c, out, checker.Contains, "availability.new=pause, availability.old=active") |
|
| 1946 | 1946 |
|
| 1947 | 1947 |
t2 := daemonUnixTime(c) |
| 1948 | 1948 |
out, err = d1.Cmd("node", "demote", d3ID)
|
| ... | ... |
@@ -1987,7 +1987,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *check.C) {
|
| 1987 | 1987 |
}, |
| 1988 | 1988 |
Data: []byte("TESTINGDATA"),
|
| 1989 | 1989 |
}) |
| 1990 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 1990 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
|
|
| 1991 | 1991 |
|
| 1992 | 1992 |
waitForEvent(c, d, "0", "-f scope=swarm", "secret create "+id, defaultRetryCount) |
| 1993 | 1993 |
|
| ... | ... |
@@ -2007,7 +2007,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *check.C) {
|
| 2007 | 2007 |
}, |
| 2008 | 2008 |
Data: []byte("TESTINGDATA"),
|
| 2009 | 2009 |
}) |
| 2010 |
- c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 2010 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
|
|
| 2011 | 2011 |
|
| 2012 | 2012 |
waitForEvent(c, d, "0", "-f scope=swarm", "config create "+id, defaultRetryCount) |
| 2013 | 2013 |
|
| ... | ... |
@@ -2019,13 +2019,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *check.C) {
|
| 2019 | 2019 |
|
| 2020 | 2020 |
func getUnlockKey(d *daemon.Daemon, c *check.C, autolockOutput string) string {
|
| 2021 | 2021 |
unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
|
| 2022 |
- c.Assert(err, checker.IsNil, check.Commentf("%s", unlockKey))
|
|
| 2022 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", unlockKey))
|
|
| 2023 | 2023 |
unlockKey = strings.TrimSuffix(unlockKey, "\n") |
| 2024 | 2024 |
|
| 2025 | 2025 |
// Check that "docker swarm init --autolock" or "docker swarm update --autolock" |
| 2026 | 2026 |
// contains all the expected strings, including the unlock key |
| 2027 |
- c.Assert(autolockOutput, checker.Contains, "docker swarm unlock") |
|
| 2028 |
- c.Assert(autolockOutput, checker.Contains, unlockKey) |
|
| 2027 |
+ assert.Assert(c, autolockOutput, checker.Contains, "docker swarm unlock") |
|
| 2028 |
+ assert.Assert(c, autolockOutput, checker.Contains, unlockKey) |
|
| 2029 | 2029 |
|
| 2030 | 2030 |
return unlockKey |
| 2031 | 2031 |
} |
| ... | ... |
@@ -38,7 +38,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
|
| 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 |
- c.Assert(uidgid, checker.HasLen, 2, check.Commentf("Should have gotten uid/gid strings from root dirname: %s", filepath.Base(s.d.Root)))
|
|
| 41 |
+ assert.Assert(c, uidgid, checker.HasLen, 2, check.Commentf("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]) |
| ... | ... |
@@ -51,16 +51,16 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
|
| 51 | 51 |
assert.NilError(c, err, "Output: %s", out) |
| 52 | 52 |
|
| 53 | 53 |
user := s.findUser(c, "userns") |
| 54 |
- c.Assert(uidgid[0], checker.Equals, user) |
|
| 54 |
+ assert.Assert(c, uidgid[0], checker.Equals, user) |
|
| 55 | 55 |
|
| 56 | 56 |
// check that the created directory is owned by remapped uid:gid |
| 57 | 57 |
statNotExists, err := system.Stat(tmpDirNotExists) |
| 58 | 58 |
assert.NilError(c, err) |
| 59 |
- c.Assert(statNotExists.UID(), checker.Equals, uint32(uid), check.Commentf("Created directory not owned by remapped root UID"))
|
|
| 60 |
- c.Assert(statNotExists.GID(), checker.Equals, uint32(gid), check.Commentf("Created directory not owned by remapped root GID"))
|
|
| 59 |
+ assert.Assert(c, statNotExists.UID(), checker.Equals, uint32(uid), check.Commentf("Created directory not owned by remapped root UID"))
|
|
| 60 |
+ assert.Assert(c, statNotExists.GID(), checker.Equals, 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 |
- c.Assert(err, checker.IsNil, check.Commentf("Could not inspect running container: out: %q", pid))
|
|
| 63 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("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( |
| ... | ... |
@@ -76,21 +76,21 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
|
| 76 | 76 |
// check that the touched file is owned by remapped uid:gid |
| 77 | 77 |
stat, err := system.Stat(filepath.Join(tmpDir, "testfile")) |
| 78 | 78 |
assert.NilError(c, err) |
| 79 |
- c.Assert(stat.UID(), checker.Equals, uint32(uid), check.Commentf("Touched file not owned by remapped root UID"))
|
|
| 80 |
- c.Assert(stat.GID(), checker.Equals, uint32(gid), check.Commentf("Touched file not owned by remapped root GID"))
|
|
| 79 |
+ assert.Assert(c, stat.UID(), checker.Equals, uint32(uid), check.Commentf("Touched file not owned by remapped root UID"))
|
|
| 80 |
+ assert.Assert(c, stat.GID(), checker.Equals, uint32(gid), check.Commentf("Touched file not owned by remapped root GID"))
|
|
| 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 |
- c.Assert(err, checker.IsNil, check.Commentf("Output: %s", out))
|
|
| 84 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", out))
|
|
| 85 | 85 |
user = s.findUser(c, "userns_skip") |
| 86 | 86 |
// userns are skipped, user is root |
| 87 |
- c.Assert(user, checker.Equals, "root") |
|
| 87 |
+ assert.Assert(c, user, checker.Equals, "root") |
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 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 *check.C, container string) string {
|
| 92 | 92 |
out, err := s.d.Cmd("top", container)
|
| 93 |
- c.Assert(err, checker.IsNil, check.Commentf("Output: %s", out))
|
|
| 93 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", out))
|
|
| 94 | 94 |
rows := strings.Split(out, "\n") |
| 95 | 95 |
if len(rows) < 2 {
|
| 96 | 96 |
// No process rows founds |
| ... | ... |
@@ -29,23 +29,23 @@ func (s *DockerSuite) TestVolumeCLICreate(c *check.C) {
|
| 29 | 29 |
// test using hidden --name option |
| 30 | 30 |
out, _ := dockerCmd(c, "volume", "create", "--name=test") |
| 31 | 31 |
name := strings.TrimSpace(out) |
| 32 |
- c.Assert(name, check.Equals, "test") |
|
| 32 |
+ assert.Assert(c, name, check.Equals, "test") |
|
| 33 | 33 |
|
| 34 | 34 |
out, _ = dockerCmd(c, "volume", "create", "test2") |
| 35 | 35 |
name = strings.TrimSpace(out) |
| 36 |
- c.Assert(name, check.Equals, "test2") |
|
| 36 |
+ assert.Assert(c, name, check.Equals, "test2") |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func (s *DockerSuite) TestVolumeCLIInspect(c *check.C) {
|
| 40 |
- c.Assert(exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
|
|
| 40 |
+ assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
|
|
| 41 | 41 |
out, _ := dockerCmd(c, "volume", "create") |
| 42 | 42 |
name := strings.TrimSpace(out) |
| 43 | 43 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name)
|
| 44 |
- c.Assert(strings.TrimSpace(out), check.Equals, name) |
|
| 44 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, name) |
|
| 45 | 45 |
|
| 46 | 46 |
dockerCmd(c, "volume", "create", "test") |
| 47 | 47 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", "test")
|
| 48 |
- c.Assert(strings.TrimSpace(out), check.Equals, "test") |
|
| 48 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "test") |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) {
|
| ... | ... |
@@ -60,9 +60,9 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) {
|
| 60 | 60 |
}) |
| 61 | 61 |
|
| 62 | 62 |
out := result.Stdout() |
| 63 |
- c.Assert(out, checker.Contains, "test1") |
|
| 64 |
- c.Assert(out, checker.Contains, "test2") |
|
| 65 |
- c.Assert(out, checker.Contains, "test3") |
|
| 63 |
+ assert.Assert(c, out, checker.Contains, "test1") |
|
| 64 |
+ assert.Assert(c, out, checker.Contains, "test2") |
|
| 65 |
+ assert.Assert(c, out, checker.Contains, "test3") |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
func (s *DockerSuite) TestVolumeCLILs(c *check.C) {
|
| ... | ... |
@@ -134,52 +134,52 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *check.C) {
|
| 134 | 134 |
out, _ := dockerCmd(c, "volume", "ls") |
| 135 | 135 |
|
| 136 | 136 |
// No filter, all volumes should show |
| 137 |
- c.Assert(out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 138 |
- c.Assert(out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 139 |
- c.Assert(out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 137 |
+ assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 138 |
+ assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 139 |
+ assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 140 | 140 |
|
| 141 | 141 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=false") |
| 142 | 142 |
|
| 143 | 143 |
// Explicitly disabling dangling |
| 144 |
- c.Assert(out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 145 |
- c.Assert(out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 146 |
- c.Assert(out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 144 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 145 |
+ assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 146 |
+ assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 147 | 147 |
|
| 148 | 148 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=true") |
| 149 | 149 |
|
| 150 | 150 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output |
| 151 |
- c.Assert(out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 152 |
- c.Assert(out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 153 |
- c.Assert(out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 151 |
+ assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 152 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 153 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 154 | 154 |
|
| 155 | 155 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1") |
| 156 | 156 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1 |
| 157 |
- c.Assert(out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 158 |
- c.Assert(out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 159 |
- c.Assert(out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 157 |
+ assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 158 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 159 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 160 | 160 |
|
| 161 | 161 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0") |
| 162 | 162 |
// dangling=0 is same as dangling=false case |
| 163 |
- c.Assert(out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 164 |
- c.Assert(out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 165 |
- c.Assert(out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 163 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 164 |
+ assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 165 |
+ assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 166 | 166 |
|
| 167 | 167 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "name=testisin") |
| 168 |
- c.Assert(out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 169 |
- c.Assert(out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 170 |
- c.Assert(out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 168 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 169 |
+ assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 170 |
+ assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *check.C) {
|
| 174 | 174 |
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
|
| 175 | 175 |
assert.ErrorContains(c, err, "") |
| 176 |
- c.Assert(out, checker.Contains, "Invalid filter") |
|
| 176 |
+ assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 177 | 177 |
} |
| 178 | 178 |
|
| 179 | 179 |
func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *check.C) {
|
| 180 | 180 |
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
|
| 181 | 181 |
assert.ErrorContains(c, err, "") |
| 182 |
- c.Assert(out, checker.Contains, "Invalid filter") |
|
| 182 |
+ assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 183 | 183 |
} |
| 184 | 184 |
|
| 185 | 185 |
func (s *DockerSuite) TestVolumeCLIRm(c *check.C) {
|
| ... | ... |
@@ -200,17 +200,17 @@ func (s *DockerSuite) TestVolumeCLIRm(c *check.C) {
|
| 200 | 200 |
}) |
| 201 | 201 |
|
| 202 | 202 |
out, _ = dockerCmd(c, "run", "--volumes-from=test", "--name=test2", "busybox", "sh", "-c", "cat /foo/bar") |
| 203 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello") |
|
| 203 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 204 | 204 |
dockerCmd(c, "rm", "-fv", "test2") |
| 205 | 205 |
dockerCmd(c, "volume", "inspect", volumeID) |
| 206 | 206 |
dockerCmd(c, "rm", "-f", "test") |
| 207 | 207 |
|
| 208 | 208 |
out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":"+prefix+"/foo", "busybox", "sh", "-c", "cat /foo/bar") |
| 209 |
- c.Assert(strings.TrimSpace(out), check.Equals, "hello", check.Commentf("volume data was removed"))
|
|
| 209 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello", check.Commentf("volume data was removed"))
|
|
| 210 | 210 |
dockerCmd(c, "rm", "test2") |
| 211 | 211 |
|
| 212 | 212 |
dockerCmd(c, "volume", "rm", volumeID) |
| 213 |
- c.Assert(exec.Command("volume", "rm", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
|
|
| 213 |
+ assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
|
|
| 214 | 214 |
} |
| 215 | 215 |
|
| 216 | 216 |
// FIXME(vdemeester) should be a unit test in cli/command/volume package |
| ... | ... |
@@ -218,7 +218,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *check.C) {
|
| 218 | 218 |
out, _ := dockerCmd(c, "volume") |
| 219 | 219 |
// no args should produce the cmd usage output |
| 220 | 220 |
usage := "Usage: docker volume COMMAND" |
| 221 |
- c.Assert(out, checker.Contains, usage) |
|
| 221 |
+ assert.Assert(c, out, checker.Contains, usage) |
|
| 222 | 222 |
|
| 223 | 223 |
// invalid arg should error and show the command usage on stderr |
| 224 | 224 |
icmd.RunCommand(dockerBinary, "volume", "somearg").Assert(c, icmd.Expected{
|
| ... | ... |
@@ -234,7 +234,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *check.C) {
|
| 234 | 234 |
Error: "exit status 125", |
| 235 | 235 |
Err: usage, |
| 236 | 236 |
}) |
| 237 |
- c.Assert(result.Stderr(), checker.Contains, "unknown flag: --no-such-flag") |
|
| 237 |
+ assert.Assert(c, result.Stderr(), checker.Contains, "unknown flag: --no-such-flag") |
|
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 | 240 |
func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *check.C) {
|
| ... | ... |
@@ -242,9 +242,9 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *check.C) {
|
| 242 | 242 |
name := strings.TrimSpace(out) |
| 243 | 243 |
|
| 244 | 244 |
out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name)
|
| 245 |
- c.Assert(err, checker.NotNil, check.Commentf("Output: %s", out))
|
|
| 246 |
- c.Assert(exitCode, checker.Equals, 1, check.Commentf("Output: %s", out))
|
|
| 247 |
- c.Assert(out, checker.Contains, "Template parsing error") |
|
| 245 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Output: %s", out))
|
|
| 246 |
+ assert.Assert(c, exitCode, checker.Equals, 1, check.Commentf("Output: %s", out))
|
|
| 247 |
+ assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *check.C) {
|
| ... | ... |
@@ -260,15 +260,15 @@ func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *check.C) {
|
| 260 | 260 |
found = true |
| 261 | 261 |
info := strings.Fields(m) |
| 262 | 262 |
// tmpfs on <path> type tmpfs (rw,relatime,size=1024k,uid=1000) |
| 263 |
- c.Assert(info[0], checker.Equals, "tmpfs") |
|
| 264 |
- c.Assert(info[2], checker.Equals, "/foo") |
|
| 265 |
- c.Assert(info[4], checker.Equals, "tmpfs") |
|
| 266 |
- c.Assert(info[5], checker.Contains, "uid=1000") |
|
| 267 |
- c.Assert(info[5], checker.Contains, "size=1024k") |
|
| 263 |
+ assert.Assert(c, info[0], checker.Equals, "tmpfs") |
|
| 264 |
+ assert.Assert(c, info[2], checker.Equals, "/foo") |
|
| 265 |
+ assert.Assert(c, info[4], checker.Equals, "tmpfs") |
|
| 266 |
+ assert.Assert(c, info[5], checker.Contains, "uid=1000") |
|
| 267 |
+ assert.Assert(c, info[5], checker.Contains, "size=1024k") |
|
| 268 | 268 |
break |
| 269 | 269 |
} |
| 270 | 270 |
} |
| 271 |
- c.Assert(found, checker.Equals, true) |
|
| 271 |
+ assert.Assert(c, found, checker.Equals, true) |
|
| 272 | 272 |
} |
| 273 | 273 |
|
| 274 | 274 |
func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) {
|
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) {
|
| 280 | 280 |
assert.NilError(c, err) |
| 281 | 281 |
|
| 282 | 282 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
|
| 283 |
- c.Assert(strings.TrimSpace(out), check.Equals, testValue) |
|
| 283 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, testValue) |
|
| 284 | 284 |
} |
| 285 | 285 |
|
| 286 | 286 |
func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
|
| ... | ... |
@@ -306,7 +306,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
|
| 306 | 306 |
|
| 307 | 307 |
for k, v := range testLabels {
|
| 308 | 308 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
|
| 309 |
- c.Assert(strings.TrimSpace(out), check.Equals, v) |
|
| 309 |
+ assert.Assert(c, strings.TrimSpace(out), check.Equals, v) |
|
| 310 | 310 |
} |
| 311 | 311 |
} |
| 312 | 312 |
|
| ... | ... |
@@ -322,22 +322,22 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
|
| 322 | 322 |
out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo") |
| 323 | 323 |
|
| 324 | 324 |
// filter with label=key |
| 325 |
- c.Assert(out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 326 |
- c.Assert(out, checker.Contains, "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2' in output"))
|
|
| 325 |
+ assert.Assert(c, out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 326 |
+ assert.Assert(c, out, checker.Contains, "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2' in output"))
|
|
| 327 | 327 |
|
| 328 | 328 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=bar1") |
| 329 | 329 |
|
| 330 | 330 |
// filter with label=key=value |
| 331 |
- c.Assert(out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 332 |
- c.Assert(out, check.Not(checker.Contains), "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
|
| 331 |
+ assert.Assert(c, out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 332 |
+ assert.Assert(c, out, check.Not(checker.Contains), "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
|
| 333 | 333 |
|
| 334 | 334 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=non-exist") |
| 335 | 335 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 336 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 336 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 337 | 337 |
|
| 338 | 338 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=non-exist") |
| 339 | 339 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 340 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 340 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 341 | 341 |
} |
| 342 | 342 |
|
| 343 | 343 |
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) {
|
| ... | ... |
@@ -352,23 +352,23 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) {
|
| 352 | 352 |
|
| 353 | 353 |
// filter with driver=local |
| 354 | 354 |
out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local") |
| 355 |
- c.Assert(out, checker.Contains, "testvol-1\n", check.Commentf("expected volume 'testvol-1' in output"))
|
|
| 356 |
- c.Assert(out, checker.Contains, "testvol-2\n", check.Commentf("expected volume 'testvol-2' in output"))
|
|
| 355 |
+ assert.Assert(c, out, checker.Contains, "testvol-1\n", check.Commentf("expected volume 'testvol-1' in output"))
|
|
| 356 |
+ assert.Assert(c, out, checker.Contains, "testvol-2\n", check.Commentf("expected volume 'testvol-2' in output"))
|
|
| 357 | 357 |
|
| 358 | 358 |
// filter with driver=invaliddriver |
| 359 | 359 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=invaliddriver") |
| 360 | 360 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 361 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 361 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 362 | 362 |
|
| 363 | 363 |
// filter with driver=loca |
| 364 | 364 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=loca") |
| 365 | 365 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 366 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 366 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 367 | 367 |
|
| 368 | 368 |
// filter with driver= |
| 369 | 369 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=") |
| 370 | 370 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 371 |
- c.Assert(len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 371 |
+ assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 372 | 372 |
} |
| 373 | 373 |
|
| 374 | 374 |
func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *check.C) {
|
| ... | ... |
@@ -385,7 +385,7 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *check.C) {
|
| 385 | 385 |
name := "test" |
| 386 | 386 |
out, _ := dockerCmd(c, "volume", "create", name) |
| 387 | 387 |
id := strings.TrimSpace(out) |
| 388 |
- c.Assert(id, checker.Equals, name) |
|
| 388 |
+ assert.Assert(c, id, checker.Equals, name) |
|
| 389 | 389 |
|
| 390 | 390 |
out, _ = dockerCmd(c, "volume", "inspect", "--format", "{{.Mountpoint}}", name)
|
| 391 | 391 |
assert.Assert(c, strings.TrimSpace(out) != "") |
| ... | ... |
@@ -395,10 +395,10 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *check.C) {
|
| 395 | 395 |
|
| 396 | 396 |
dockerCmd(c, "volume", "rm", "-f", name) |
| 397 | 397 |
out, _ = dockerCmd(c, "volume", "ls") |
| 398 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 398 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 399 | 399 |
dockerCmd(c, "volume", "create", name) |
| 400 | 400 |
out, _ = dockerCmd(c, "volume", "ls") |
| 401 |
- c.Assert(out, checker.Contains, name) |
|
| 401 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 402 | 402 |
} |
| 403 | 403 |
|
| 404 | 404 |
// TestVolumeCLIRmForceInUse verifies that repeated `docker volume rm -f` calls does not remove a volume |
| ... | ... |
@@ -407,7 +407,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
|
| 407 | 407 |
name := "testvolume" |
| 408 | 408 |
out, _ := dockerCmd(c, "volume", "create", name) |
| 409 | 409 |
id := strings.TrimSpace(out) |
| 410 |
- c.Assert(id, checker.Equals, name) |
|
| 410 |
+ assert.Assert(c, id, checker.Equals, name) |
|
| 411 | 411 |
|
| 412 | 412 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 413 | 413 |
out, _ = dockerCmd(c, "create", "-v", "testvolume:"+prefix+slash+"foo", "busybox") |
| ... | ... |
@@ -417,7 +417,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
|
| 417 | 417 |
assert.ErrorContains(c, err, "") |
| 418 | 418 |
assert.ErrorContains(c, err, "volume is in use") |
| 419 | 419 |
out, _ = dockerCmd(c, "volume", "ls") |
| 420 |
- c.Assert(out, checker.Contains, name) |
|
| 420 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 421 | 421 |
|
| 422 | 422 |
// The original issue did not _remove_ the volume from the list |
| 423 | 423 |
// the first time. But a second call to `volume rm` removed it. |
| ... | ... |
@@ -427,18 +427,18 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
|
| 427 | 427 |
assert.ErrorContains(c, err, "") |
| 428 | 428 |
assert.ErrorContains(c, err, "volume is in use") |
| 429 | 429 |
out, _ = dockerCmd(c, "volume", "ls") |
| 430 |
- c.Assert(out, checker.Contains, name) |
|
| 430 |
+ assert.Assert(c, out, checker.Contains, name) |
|
| 431 | 431 |
|
| 432 | 432 |
// Verify removing the volume after the container is removed works |
| 433 | 433 |
_, e := dockerCmd(c, "rm", cid) |
| 434 |
- c.Assert(e, check.Equals, 0) |
|
| 434 |
+ assert.Assert(c, e, check.Equals, 0) |
|
| 435 | 435 |
|
| 436 | 436 |
_, e = dockerCmd(c, "volume", "rm", "-f", name) |
| 437 |
- c.Assert(e, check.Equals, 0) |
|
| 437 |
+ assert.Assert(c, e, check.Equals, 0) |
|
| 438 | 438 |
|
| 439 | 439 |
out, e = dockerCmd(c, "volume", "ls") |
| 440 |
- c.Assert(e, check.Equals, 0) |
|
| 441 |
- c.Assert(out, checker.Not(checker.Contains), name) |
|
| 440 |
+ assert.Assert(c, e, check.Equals, 0) |
|
| 441 |
+ assert.Assert(c, out, checker.Not(checker.Contains), name) |
|
| 442 | 442 |
} |
| 443 | 443 |
|
| 444 | 444 |
func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *check.C) {
|
| ... | ... |
@@ -448,7 +448,7 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *check.C) {
|
| 448 | 448 |
name := "test1" |
| 449 | 449 |
dockerCmd(c, "volume", "create", "-d", "local", name) |
| 450 | 450 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Options }}", name)
|
| 451 |
- c.Assert(strings.TrimSpace(out), checker.Contains, "map[]") |
|
| 451 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, "map[]") |
|
| 452 | 452 |
|
| 453 | 453 |
// With options |
| 454 | 454 |
name = "test2" |
| ... | ... |
@@ -457,9 +457,9 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *check.C) {
|
| 457 | 457 |
k3, v3 := "o", "size=1m,uid=1000" |
| 458 | 458 |
dockerCmd(c, "volume", "create", "-d", "local", name, "--opt", fmt.Sprintf("%s=%s", k1, v1), "--opt", fmt.Sprintf("%s=%s", k2, v2), "--opt", fmt.Sprintf("%s=%s", k3, v3))
|
| 459 | 459 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Options }}", name)
|
| 460 |
- c.Assert(strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k1, v1))
|
|
| 461 |
- c.Assert(strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k2, v2))
|
|
| 462 |
- c.Assert(strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k3, v3))
|
|
| 460 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k1, v1))
|
|
| 461 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k2, v2))
|
|
| 462 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k3, v3))
|
|
| 463 | 463 |
} |
| 464 | 464 |
|
| 465 | 465 |
// Test case (1) for 21845: duplicate targets for --volumes-from |
| ... | ... |
@@ -476,19 +476,19 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *check.C) {
|
| 476 | 476 |
|
| 477 | 477 |
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
|
| 478 | 478 |
data1 := strings.TrimSpace(out) |
| 479 |
- c.Assert(data1, checker.Not(checker.Equals), "") |
|
| 479 |
+ assert.Assert(c, data1, checker.Not(checker.Equals), "") |
|
| 480 | 480 |
|
| 481 | 481 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
|
| 482 | 482 |
data2 := strings.TrimSpace(out) |
| 483 |
- c.Assert(data2, checker.Not(checker.Equals), "") |
|
| 483 |
+ assert.Assert(c, data2, checker.Not(checker.Equals), "") |
|
| 484 | 484 |
|
| 485 | 485 |
// Both volume should exist |
| 486 | 486 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 487 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data1) |
|
| 488 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data2) |
|
| 487 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 488 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 489 | 489 |
|
| 490 | 490 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-d", "busybox", "top")
|
| 491 |
- c.Assert(err, checker.IsNil, check.Commentf("Out: %s", out))
|
|
| 491 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Out: %s", out))
|
|
| 492 | 492 |
|
| 493 | 493 |
// Only the second volume will be referenced, this is backward compatible |
| 494 | 494 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
|
| ... | ... |
@@ -500,8 +500,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *check.C) {
|
| 500 | 500 |
|
| 501 | 501 |
// Both volume should not exist |
| 502 | 502 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 503 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 504 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 503 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 504 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 | 507 |
// Test case (2) for 21845: duplicate targets for --volumes-from and -v (bind) |
| ... | ... |
@@ -518,25 +518,25 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *check.C) |
| 518 | 518 |
|
| 519 | 519 |
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
|
| 520 | 520 |
data1 := strings.TrimSpace(out) |
| 521 |
- c.Assert(data1, checker.Not(checker.Equals), "") |
|
| 521 |
+ assert.Assert(c, data1, checker.Not(checker.Equals), "") |
|
| 522 | 522 |
|
| 523 | 523 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
|
| 524 | 524 |
data2 := strings.TrimSpace(out) |
| 525 |
- c.Assert(data2, checker.Not(checker.Equals), "") |
|
| 525 |
+ assert.Assert(c, data2, checker.Not(checker.Equals), "") |
|
| 526 | 526 |
|
| 527 | 527 |
// Both volume should exist |
| 528 | 528 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 529 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data1) |
|
| 530 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data2) |
|
| 529 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 530 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 531 | 531 |
|
| 532 | 532 |
// /tmp/data is automatically created, because we are not using the modern mount API here |
| 533 | 533 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-v", "/tmp/data:/tmp/data", "-d", "busybox", "top")
|
| 534 |
- c.Assert(err, checker.IsNil, check.Commentf("Out: %s", out))
|
|
| 534 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Out: %s", out))
|
|
| 535 | 535 |
|
| 536 | 536 |
// No volume will be referenced (mount is /tmp/data), this is backward compatible |
| 537 | 537 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
|
| 538 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 539 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 538 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 539 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 540 | 540 |
|
| 541 | 541 |
dockerCmd(c, "rm", "-f", "-v", "app") |
| 542 | 542 |
dockerCmd(c, "rm", "-f", "-v", "data1") |
| ... | ... |
@@ -544,8 +544,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *check.C) |
| 544 | 544 |
|
| 545 | 545 |
// Both volume should not exist |
| 546 | 546 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 547 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 548 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 547 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 548 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 549 | 549 |
} |
| 550 | 550 |
|
| 551 | 551 |
// Test case (3) for 21845: duplicate targets for --volumes-from and `Mounts` (API only) |
| ... | ... |
@@ -562,16 +562,16 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C |
| 562 | 562 |
|
| 563 | 563 |
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
|
| 564 | 564 |
data1 := strings.TrimSpace(out) |
| 565 |
- c.Assert(data1, checker.Not(checker.Equals), "") |
|
| 565 |
+ assert.Assert(c, data1, checker.Not(checker.Equals), "") |
|
| 566 | 566 |
|
| 567 | 567 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
|
| 568 | 568 |
data2 := strings.TrimSpace(out) |
| 569 |
- c.Assert(data2, checker.Not(checker.Equals), "") |
|
| 569 |
+ assert.Assert(c, data2, checker.Not(checker.Equals), "") |
|
| 570 | 570 |
|
| 571 | 571 |
// Both volume should exist |
| 572 | 572 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 573 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data1) |
|
| 574 |
- c.Assert(strings.TrimSpace(out), checker.Contains, data2) |
|
| 573 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 574 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 575 | 575 |
|
| 576 | 576 |
err := os.MkdirAll("/tmp/data", 0755)
|
| 577 | 577 |
assert.NilError(c, err) |
| ... | ... |
@@ -601,8 +601,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C |
| 601 | 601 |
|
| 602 | 602 |
// No volume will be referenced (mount is /tmp/data), this is backward compatible |
| 603 | 603 |
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
|
| 604 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 605 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 604 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 605 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 606 | 606 |
|
| 607 | 607 |
dockerCmd(c, "rm", "-f", "-v", "app") |
| 608 | 608 |
dockerCmd(c, "rm", "-f", "-v", "data1") |
| ... | ... |
@@ -610,6 +610,6 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C |
| 610 | 610 |
|
| 611 | 611 |
// Both volume should not exist |
| 612 | 612 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 613 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 614 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 613 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data1) |
|
| 614 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), data2) |
|
| 615 | 615 |
} |
| ... | ... |
@@ -70,7 +70,7 @@ func (s *DockerHubPullSuite) TearDownTest(c *check.C) {
|
| 70 | 70 |
// output. The function fails the test when the command returns an error. |
| 71 | 71 |
func (s *DockerHubPullSuite) Cmd(c *check.C, name string, arg ...string) string {
|
| 72 | 72 |
out, err := s.CmdWithError(name, arg...) |
| 73 |
- c.Assert(err, checker.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
|
|
| 73 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
|
|
| 74 | 74 |
return out |
| 75 | 75 |
} |
| 76 | 76 |
|
| ... | ... |
@@ -77,7 +77,7 @@ func inspectFieldAndUnmarshall(c *check.C, name, field string, output interface{
|
| 77 | 77 |
str := inspectFieldJSON(c, name, field) |
| 78 | 78 |
err := json.Unmarshal([]byte(str), output) |
| 79 | 79 |
if c != nil {
|
| 80 |
- c.Assert(err, check.IsNil, check.Commentf("failed to unmarshal: %v", err))
|
|
| 80 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("failed to unmarshal: %v", err))
|
|
| 81 | 81 |
} |
| 82 | 82 |
} |
| 83 | 83 |
|
| ... | ... |
@@ -201,7 +201,7 @@ func buildImage(name string, cmdOperators ...cli.CmdOperator) *icmd.Result {
|
| 201 | 201 |
// Fail the test when error occurs. |
| 202 | 202 |
func writeFile(dst, content string, c *check.C) {
|
| 203 | 203 |
// Create subdirectories if necessary |
| 204 |
- c.Assert(os.MkdirAll(path.Dir(dst), 0700), check.IsNil) |
|
| 204 |
+ assert.Assert(c, os.MkdirAll(path.Dir(dst), 0700), check.IsNil) |
|
| 205 | 205 |
f, err := os.OpenFile(dst, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0700) |
| 206 | 206 |
assert.NilError(c, err) |
| 207 | 207 |
defer f.Close() |
| ... | ... |
@@ -263,7 +263,7 @@ func daemonTime(c *check.C) time.Time {
|
| 263 | 263 |
assert.NilError(c, err) |
| 264 | 264 |
|
| 265 | 265 |
dt, err := time.Parse(time.RFC3339Nano, info.SystemTime) |
| 266 |
- c.Assert(err, check.IsNil, check.Commentf("invalid time format in GET /info response"))
|
|
| 266 |
+ assert.Assert(c, err, check.IsNil, check.Commentf("invalid time format in GET /info response"))
|
|
| 267 | 267 |
return dt |
| 268 | 268 |
} |
| 269 | 269 |
|
| ... | ... |
@@ -408,7 +408,7 @@ func waitForGoroutines(expected int) error {
|
| 408 | 408 |
// getErrorMessage returns the error message from an error API response |
| 409 | 409 |
func getErrorMessage(c *check.C, body []byte) string {
|
| 410 | 410 |
var resp types.ErrorResponse |
| 411 |
- c.Assert(json.Unmarshal(body, &resp), check.IsNil) |
|
| 411 |
+ assert.Assert(c, json.Unmarshal(body, &resp), check.IsNil) |
|
| 412 | 412 |
return strings.TrimSpace(resp.Message) |
| 413 | 413 |
} |
| 414 | 414 |
|
| ... | ... |
@@ -15,64 +15,64 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 15 | 15 |
|
| 16 | 16 |
func (s *DiscoverySuite) TestNewEntry(c *check.C) {
|
| 17 | 17 |
entry, err := NewEntry("127.0.0.1:2375")
|
| 18 |
- c.Assert(err, check.IsNil) |
|
| 19 |
- c.Assert(entry.Equals(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 20 |
- c.Assert(entry.String(), check.Equals, "127.0.0.1:2375") |
|
| 18 |
+ assert.Assert(c, err, check.IsNil) |
|
| 19 |
+ assert.Assert(c, entry.Equals(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 20 |
+ assert.Assert(c, entry.String(), check.Equals, "127.0.0.1:2375") |
|
| 21 | 21 |
|
| 22 | 22 |
entry, err = NewEntry("[2001:db8:0:f101::2]:2375")
|
| 23 |
- c.Assert(err, check.IsNil) |
|
| 24 |
- c.Assert(entry.Equals(&Entry{Host: "2001:db8:0:f101::2", Port: "2375"}), check.Equals, true)
|
|
| 25 |
- c.Assert(entry.String(), check.Equals, "[2001:db8:0:f101::2]:2375") |
|
| 23 |
+ assert.Assert(c, err, check.IsNil) |
|
| 24 |
+ assert.Assert(c, entry.Equals(&Entry{Host: "2001:db8:0:f101::2", Port: "2375"}), check.Equals, true)
|
|
| 25 |
+ assert.Assert(c, entry.String(), check.Equals, "[2001:db8:0:f101::2]:2375") |
|
| 26 | 26 |
|
| 27 | 27 |
_, err = NewEntry("127.0.0.1")
|
| 28 |
- c.Assert(err, check.NotNil) |
|
| 28 |
+ assert.Assert(c, err, check.NotNil) |
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
func (s *DiscoverySuite) TestParse(c *check.C) {
|
| 32 | 32 |
scheme, uri := parse("127.0.0.1:2375")
|
| 33 |
- c.Assert(scheme, check.Equals, "nodes") |
|
| 34 |
- c.Assert(uri, check.Equals, "127.0.0.1:2375") |
|
| 33 |
+ assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 34 |
+ assert.Assert(c, uri, check.Equals, "127.0.0.1:2375") |
|
| 35 | 35 |
|
| 36 | 36 |
scheme, uri = parse("localhost:2375")
|
| 37 |
- c.Assert(scheme, check.Equals, "nodes") |
|
| 38 |
- c.Assert(uri, check.Equals, "localhost:2375") |
|
| 37 |
+ assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 38 |
+ assert.Assert(c, uri, check.Equals, "localhost:2375") |
|
| 39 | 39 |
|
| 40 | 40 |
scheme, uri = parse("scheme://127.0.0.1:2375")
|
| 41 |
- c.Assert(scheme, check.Equals, "scheme") |
|
| 42 |
- c.Assert(uri, check.Equals, "127.0.0.1:2375") |
|
| 41 |
+ assert.Assert(c, scheme, check.Equals, "scheme") |
|
| 42 |
+ assert.Assert(c, uri, check.Equals, "127.0.0.1:2375") |
|
| 43 | 43 |
|
| 44 | 44 |
scheme, uri = parse("scheme://localhost:2375")
|
| 45 |
- c.Assert(scheme, check.Equals, "scheme") |
|
| 46 |
- c.Assert(uri, check.Equals, "localhost:2375") |
|
| 45 |
+ assert.Assert(c, scheme, check.Equals, "scheme") |
|
| 46 |
+ assert.Assert(c, uri, check.Equals, "localhost:2375") |
|
| 47 | 47 |
|
| 48 | 48 |
scheme, uri = parse("")
|
| 49 |
- c.Assert(scheme, check.Equals, "nodes") |
|
| 50 |
- c.Assert(uri, check.Equals, "") |
|
| 49 |
+ assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 50 |
+ assert.Assert(c, uri, check.Equals, "") |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func (s *DiscoverySuite) TestCreateEntries(c *check.C) {
|
| 54 | 54 |
entries, err := CreateEntries(nil) |
| 55 |
- c.Assert(entries, check.DeepEquals, Entries{})
|
|
| 56 |
- c.Assert(err, check.IsNil) |
|
| 55 |
+ assert.Assert(c, entries, check.DeepEquals, Entries{})
|
|
| 56 |
+ assert.Assert(c, err, check.IsNil) |
|
| 57 | 57 |
|
| 58 | 58 |
entries, err = CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", "[2001:db8:0:f101::2]:2375", ""})
|
| 59 |
- c.Assert(err, check.IsNil) |
|
| 59 |
+ assert.Assert(c, err, check.IsNil) |
|
| 60 | 60 |
expected := Entries{
|
| 61 | 61 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 62 | 62 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 63 | 63 |
&Entry{Host: "2001:db8:0:f101::2", Port: "2375"},
|
| 64 | 64 |
} |
| 65 |
- c.Assert(entries.Equals(expected), check.Equals, true) |
|
| 65 |
+ assert.Assert(c, entries.Equals(expected), check.Equals, true) |
|
| 66 | 66 |
|
| 67 | 67 |
_, err = CreateEntries([]string{"127.0.0.1", "127.0.0.2"})
|
| 68 |
- c.Assert(err, check.NotNil) |
|
| 68 |
+ assert.Assert(c, err, check.NotNil) |
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
func (s *DiscoverySuite) TestContainsEntry(c *check.C) {
|
| 72 | 72 |
entries, err := CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", ""})
|
| 73 |
- c.Assert(err, check.IsNil) |
|
| 74 |
- c.Assert(entries.Contains(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 75 |
- c.Assert(entries.Contains(&Entry{Host: "127.0.0.3", Port: "2375"}), check.Equals, false)
|
|
| 73 |
+ assert.Assert(c, err, check.IsNil) |
|
| 74 |
+ assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 75 |
+ assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.3", Port: "2375"}), check.Equals, false)
|
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
func (s *DiscoverySuite) TestEntriesEquality(c *check.C) {
|
| ... | ... |
@@ -82,20 +82,20 @@ func (s *DiscoverySuite) TestEntriesEquality(c *check.C) {
|
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 | 84 |
// Same |
| 85 |
- c.Assert(entries.Equals(Entries{
|
|
| 85 |
+ assert.Assert(c, entries.Equals(Entries{
|
|
| 86 | 86 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 87 | 87 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 88 | 88 |
}), check.Equals, true) |
| 89 | 89 |
|
| 90 | 90 |
// Different size |
| 91 |
- c.Assert(entries.Equals(Entries{
|
|
| 91 |
+ assert.Assert(c, entries.Equals(Entries{
|
|
| 92 | 92 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 93 | 93 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 94 | 94 |
&Entry{Host: "127.0.0.3", Port: "2375"},
|
| 95 | 95 |
}), check.Equals, false) |
| 96 | 96 |
|
| 97 | 97 |
// Different content |
| 98 |
- c.Assert(entries.Equals(Entries{
|
|
| 98 |
+ assert.Assert(c, entries.Equals(Entries{
|
|
| 99 | 99 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 100 | 100 |
&Entry{Host: "127.0.0.42", Port: "2375"},
|
| 101 | 101 |
}), check.Equals, false) |
| ... | ... |
@@ -110,25 +110,25 @@ func (s *DiscoverySuite) TestEntriesDiff(c *check.C) {
|
| 110 | 110 |
|
| 111 | 111 |
// No diff |
| 112 | 112 |
added, removed := entries.Diff(Entries{entry2, entry1})
|
| 113 |
- c.Assert(added, check.HasLen, 0) |
|
| 114 |
- c.Assert(removed, check.HasLen, 0) |
|
| 113 |
+ assert.Assert(c, added, check.HasLen, 0) |
|
| 114 |
+ assert.Assert(c, removed, check.HasLen, 0) |
|
| 115 | 115 |
|
| 116 | 116 |
// Add |
| 117 | 117 |
added, removed = entries.Diff(Entries{entry2, entry3, entry1})
|
| 118 |
- c.Assert(added, check.HasLen, 1) |
|
| 119 |
- c.Assert(added.Contains(entry3), check.Equals, true) |
|
| 120 |
- c.Assert(removed, check.HasLen, 0) |
|
| 118 |
+ assert.Assert(c, added, check.HasLen, 1) |
|
| 119 |
+ assert.Assert(c, added.Contains(entry3), check.Equals, true) |
|
| 120 |
+ assert.Assert(c, removed, check.HasLen, 0) |
|
| 121 | 121 |
|
| 122 | 122 |
// Remove |
| 123 | 123 |
added, removed = entries.Diff(Entries{entry2})
|
| 124 |
- c.Assert(added, check.HasLen, 0) |
|
| 125 |
- c.Assert(removed, check.HasLen, 1) |
|
| 126 |
- c.Assert(removed.Contains(entry1), check.Equals, true) |
|
| 124 |
+ assert.Assert(c, added, check.HasLen, 0) |
|
| 125 |
+ assert.Assert(c, removed, check.HasLen, 1) |
|
| 126 |
+ assert.Assert(c, removed.Contains(entry1), check.Equals, true) |
|
| 127 | 127 |
|
| 128 | 128 |
// Add and remove |
| 129 | 129 |
added, removed = entries.Diff(Entries{entry1, entry3})
|
| 130 |
- c.Assert(added, check.HasLen, 1) |
|
| 131 |
- c.Assert(added.Contains(entry3), check.Equals, true) |
|
| 132 |
- c.Assert(removed, check.HasLen, 1) |
|
| 133 |
- c.Assert(removed.Contains(entry2), check.Equals, true) |
|
| 130 |
+ assert.Assert(c, added, check.HasLen, 1) |
|
| 131 |
+ assert.Assert(c, added.Contains(entry3), check.Equals, true) |
|
| 132 |
+ assert.Assert(c, removed, check.HasLen, 1) |
|
| 133 |
+ assert.Assert(c, removed.Contains(entry2), check.Equals, true) |
|
| 134 | 134 |
} |
| ... | ... |
@@ -20,13 +20,13 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 20 | 20 |
func (s *DiscoverySuite) TestInitialize(c *check.C) {
|
| 21 | 21 |
d := &Discovery{}
|
| 22 | 22 |
d.Initialize("/path/to/file", 1000, 0, nil)
|
| 23 |
- c.Assert(d.path, check.Equals, "/path/to/file") |
|
| 23 |
+ assert.Assert(c, d.path, check.Equals, "/path/to/file") |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func (s *DiscoverySuite) TestNew(c *check.C) {
|
| 27 | 27 |
d, err := discovery.New("file:///path/to/file", 0, 0, nil)
|
| 28 |
- c.Assert(err, check.IsNil) |
|
| 29 |
- c.Assert(d.(*Discovery).path, check.Equals, "/path/to/file") |
|
| 28 |
+ assert.Assert(c, err, check.IsNil) |
|
| 29 |
+ assert.Assert(c, d.(*Discovery).path, check.Equals, "/path/to/file") |
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
func (s *DiscoverySuite) TestContent(c *check.C) {
|
| ... | ... |
@@ -35,17 +35,17 @@ func (s *DiscoverySuite) TestContent(c *check.C) {
|
| 35 | 35 |
2.2.2.[2:4]:2222 |
| 36 | 36 |
` |
| 37 | 37 |
ips := parseFileContent([]byte(data)) |
| 38 |
- c.Assert(ips, check.HasLen, 5) |
|
| 39 |
- c.Assert(ips[0], check.Equals, "1.1.1.1:1111") |
|
| 40 |
- c.Assert(ips[1], check.Equals, "1.1.1.2:1111") |
|
| 41 |
- c.Assert(ips[2], check.Equals, "2.2.2.2:2222") |
|
| 42 |
- c.Assert(ips[3], check.Equals, "2.2.2.3:2222") |
|
| 43 |
- c.Assert(ips[4], check.Equals, "2.2.2.4:2222") |
|
| 38 |
+ assert.Assert(c, ips, check.HasLen, 5) |
|
| 39 |
+ assert.Assert(c, ips[0], check.Equals, "1.1.1.1:1111") |
|
| 40 |
+ assert.Assert(c, ips[1], check.Equals, "1.1.1.2:1111") |
|
| 41 |
+ assert.Assert(c, ips[2], check.Equals, "2.2.2.2:2222") |
|
| 42 |
+ assert.Assert(c, ips[3], check.Equals, "2.2.2.3:2222") |
|
| 43 |
+ assert.Assert(c, ips[4], check.Equals, "2.2.2.4:2222") |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func (s *DiscoverySuite) TestRegister(c *check.C) {
|
| 47 | 47 |
discovery := &Discovery{path: "/path/to/file"}
|
| 48 |
- c.Assert(discovery.Register("0.0.0.0"), check.NotNil)
|
|
| 48 |
+ assert.Assert(c, discovery.Register("0.0.0.0"), check.NotNil)
|
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func (s *DiscoverySuite) TestParsingContentsWithComments(c *check.C) {
|
| ... | ... |
@@ -58,9 +58,9 @@ func (s *DiscoverySuite) TestParsingContentsWithComments(c *check.C) {
|
| 58 | 58 |
### test ### |
| 59 | 59 |
` |
| 60 | 60 |
ips := parseFileContent([]byte(data)) |
| 61 |
- c.Assert(ips, check.HasLen, 2) |
|
| 62 |
- c.Assert("1.1.1.1:1111", check.Equals, ips[0])
|
|
| 63 |
- c.Assert("3.3.3.3:3333", check.Equals, ips[1])
|
|
| 61 |
+ assert.Assert(c, ips, check.HasLen, 2) |
|
| 62 |
+ assert.Assert(c, "1.1.1.1:1111", check.Equals, ips[0]) |
|
| 63 |
+ assert.Assert(c, "3.3.3.3:3333", check.Equals, ips[1]) |
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| ... | ... |
@@ -75,9 +75,9 @@ func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| 75 | 75 |
|
| 76 | 76 |
// Create a temporary file and remove it. |
| 77 | 77 |
tmp, err := ioutil.TempFile(os.TempDir(), "discovery-file-test") |
| 78 |
- c.Assert(err, check.IsNil) |
|
| 79 |
- c.Assert(tmp.Close(), check.IsNil) |
|
| 80 |
- c.Assert(os.Remove(tmp.Name()), check.IsNil) |
|
| 78 |
+ assert.Assert(c, err, check.IsNil) |
|
| 79 |
+ assert.Assert(c, tmp.Close(), check.IsNil) |
|
| 80 |
+ assert.Assert(c, os.Remove(tmp.Name()), check.IsNil) |
|
| 81 | 81 |
|
| 82 | 82 |
// Set up file discovery. |
| 83 | 83 |
d := &Discovery{}
|
| ... | ... |
@@ -86,7 +86,7 @@ func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| 86 | 86 |
ch, errCh := d.Watch(stopCh) |
| 87 | 87 |
|
| 88 | 88 |
// Make sure it fires errors since the file doesn't exist. |
| 89 |
- c.Assert(<-errCh, check.NotNil) |
|
| 89 |
+ assert.Assert(c, <-errCh, check.NotNil) |
|
| 90 | 90 |
// We have to drain the error channel otherwise Watch will get stuck. |
| 91 | 91 |
go func() {
|
| 92 | 92 |
for range errCh {
|
| ... | ... |
@@ -94,21 +94,21 @@ func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| 94 | 94 |
}() |
| 95 | 95 |
|
| 96 | 96 |
// Write the file and make sure we get the expected value back. |
| 97 |
- c.Assert(ioutil.WriteFile(tmp.Name(), []byte(data), 0600), check.IsNil) |
|
| 98 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 97 |
+ assert.Assert(c, ioutil.WriteFile(tmp.Name(), []byte(data), 0600), check.IsNil) |
|
| 98 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 99 | 99 |
|
| 100 | 100 |
// Add a new entry and look it up. |
| 101 | 101 |
expected = append(expected, &discovery.Entry{Host: "3.3.3.3", Port: "3333"})
|
| 102 | 102 |
f, err := os.OpenFile(tmp.Name(), os.O_APPEND|os.O_WRONLY, 0600) |
| 103 |
- c.Assert(err, check.IsNil) |
|
| 104 |
- c.Assert(f, check.NotNil) |
|
| 103 |
+ assert.Assert(c, err, check.IsNil) |
|
| 104 |
+ assert.Assert(c, f, check.NotNil) |
|
| 105 | 105 |
_, err = f.WriteString("\n3.3.3.3:3333\n")
|
| 106 |
- c.Assert(err, check.IsNil) |
|
| 106 |
+ assert.Assert(c, err, check.IsNil) |
|
| 107 | 107 |
f.Close() |
| 108 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 108 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 109 | 109 |
|
| 110 | 110 |
// Stop and make sure it closes all channels. |
| 111 | 111 |
close(stopCh) |
| 112 |
- c.Assert(<-ch, check.IsNil) |
|
| 113 |
- c.Assert(<-errCh, check.IsNil) |
|
| 112 |
+ assert.Assert(c, <-ch, check.IsNil) |
|
| 113 |
+ assert.Assert(c, <-errCh, check.IsNil) |
|
| 114 | 114 |
} |
| ... | ... |
@@ -6,48 +6,48 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
func (s *DiscoverySuite) TestGeneratorNotGenerate(c *check.C) {
|
| 8 | 8 |
ips := Generate("127.0.0.1")
|
| 9 |
- c.Assert(len(ips), check.Equals, 1) |
|
| 10 |
- c.Assert(ips[0], check.Equals, "127.0.0.1") |
|
| 9 |
+ assert.Assert(c, len(ips), check.Equals, 1) |
|
| 10 |
+ assert.Assert(c, ips[0], check.Equals, "127.0.0.1") |
|
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 | 13 |
func (s *DiscoverySuite) TestGeneratorWithPortNotGenerate(c *check.C) {
|
| 14 | 14 |
ips := Generate("127.0.0.1:8080")
|
| 15 |
- c.Assert(len(ips), check.Equals, 1) |
|
| 16 |
- c.Assert(ips[0], check.Equals, "127.0.0.1:8080") |
|
| 15 |
+ assert.Assert(c, len(ips), check.Equals, 1) |
|
| 16 |
+ assert.Assert(c, ips[0], check.Equals, "127.0.0.1:8080") |
|
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
func (s *DiscoverySuite) TestGeneratorMatchFailedNotGenerate(c *check.C) {
|
| 20 | 20 |
ips := Generate("127.0.0.[1]")
|
| 21 |
- c.Assert(len(ips), check.Equals, 1) |
|
| 22 |
- c.Assert(ips[0], check.Equals, "127.0.0.[1]") |
|
| 21 |
+ assert.Assert(c, len(ips), check.Equals, 1) |
|
| 22 |
+ assert.Assert(c, ips[0], check.Equals, "127.0.0.[1]") |
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
func (s *DiscoverySuite) TestGeneratorWithPort(c *check.C) {
|
| 26 | 26 |
ips := Generate("127.0.0.[1:11]:2375")
|
| 27 |
- c.Assert(len(ips), check.Equals, 11) |
|
| 28 |
- c.Assert(ips[0], check.Equals, "127.0.0.1:2375") |
|
| 29 |
- c.Assert(ips[1], check.Equals, "127.0.0.2:2375") |
|
| 30 |
- c.Assert(ips[2], check.Equals, "127.0.0.3:2375") |
|
| 31 |
- c.Assert(ips[3], check.Equals, "127.0.0.4:2375") |
|
| 32 |
- c.Assert(ips[4], check.Equals, "127.0.0.5:2375") |
|
| 33 |
- c.Assert(ips[5], check.Equals, "127.0.0.6:2375") |
|
| 34 |
- c.Assert(ips[6], check.Equals, "127.0.0.7:2375") |
|
| 35 |
- c.Assert(ips[7], check.Equals, "127.0.0.8:2375") |
|
| 36 |
- c.Assert(ips[8], check.Equals, "127.0.0.9:2375") |
|
| 37 |
- c.Assert(ips[9], check.Equals, "127.0.0.10:2375") |
|
| 38 |
- c.Assert(ips[10], check.Equals, "127.0.0.11:2375") |
|
| 27 |
+ assert.Assert(c, len(ips), check.Equals, 11) |
|
| 28 |
+ assert.Assert(c, ips[0], check.Equals, "127.0.0.1:2375") |
|
| 29 |
+ assert.Assert(c, ips[1], check.Equals, "127.0.0.2:2375") |
|
| 30 |
+ assert.Assert(c, ips[2], check.Equals, "127.0.0.3:2375") |
|
| 31 |
+ assert.Assert(c, ips[3], check.Equals, "127.0.0.4:2375") |
|
| 32 |
+ assert.Assert(c, ips[4], check.Equals, "127.0.0.5:2375") |
|
| 33 |
+ assert.Assert(c, ips[5], check.Equals, "127.0.0.6:2375") |
|
| 34 |
+ assert.Assert(c, ips[6], check.Equals, "127.0.0.7:2375") |
|
| 35 |
+ assert.Assert(c, ips[7], check.Equals, "127.0.0.8:2375") |
|
| 36 |
+ assert.Assert(c, ips[8], check.Equals, "127.0.0.9:2375") |
|
| 37 |
+ assert.Assert(c, ips[9], check.Equals, "127.0.0.10:2375") |
|
| 38 |
+ assert.Assert(c, ips[10], check.Equals, "127.0.0.11:2375") |
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeStart(c *check.C) {
|
| 42 | 42 |
malformedInput := "127.0.0.[x:11]:2375" |
| 43 | 43 |
ips := Generate(malformedInput) |
| 44 |
- c.Assert(len(ips), check.Equals, 1) |
|
| 45 |
- c.Assert(ips[0], check.Equals, malformedInput) |
|
| 44 |
+ assert.Assert(c, len(ips), check.Equals, 1) |
|
| 45 |
+ assert.Assert(c, ips[0], check.Equals, malformedInput) |
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeEnd(c *check.C) {
|
| 49 | 49 |
malformedInput := "127.0.0.[1:x]:2375" |
| 50 | 50 |
ips := Generate(malformedInput) |
| 51 |
- c.Assert(len(ips), check.Equals, 1) |
|
| 52 |
- c.Assert(ips[0], check.Equals, malformedInput) |
|
| 51 |
+ assert.Assert(c, len(ips), check.Equals, 1) |
|
| 52 |
+ assert.Assert(c, ips[0], check.Equals, malformedInput) |
|
| 53 | 53 |
} |
| ... | ... |
@@ -30,9 +30,9 @@ func (ds *DiscoverySuite) TestInitialize(c *check.C) {
|
| 30 | 30 |
d.store = storeMock |
| 31 | 31 |
|
| 32 | 32 |
s := d.store.(*FakeStore) |
| 33 |
- c.Assert(s.Endpoints, check.HasLen, 1) |
|
| 34 |
- c.Assert(s.Endpoints[0], check.Equals, "127.0.0.1") |
|
| 35 |
- c.Assert(d.path, check.Equals, defaultDiscoveryPath) |
|
| 33 |
+ assert.Assert(c, s.Endpoints, check.HasLen, 1) |
|
| 34 |
+ assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1") |
|
| 35 |
+ assert.Assert(c, d.path, check.Equals, defaultDiscoveryPath) |
|
| 36 | 36 |
|
| 37 | 37 |
storeMock = &FakeStore{
|
| 38 | 38 |
Endpoints: []string{"127.0.0.1:1234"},
|
| ... | ... |
@@ -42,9 +42,9 @@ func (ds *DiscoverySuite) TestInitialize(c *check.C) {
|
| 42 | 42 |
d.store = storeMock |
| 43 | 43 |
|
| 44 | 44 |
s = d.store.(*FakeStore) |
| 45 |
- c.Assert(s.Endpoints, check.HasLen, 1) |
|
| 46 |
- c.Assert(s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 47 |
- c.Assert(d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 45 |
+ assert.Assert(c, s.Endpoints, check.HasLen, 1) |
|
| 46 |
+ assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 47 |
+ assert.Assert(c, d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 48 | 48 |
|
| 49 | 49 |
storeMock = &FakeStore{
|
| 50 | 50 |
Endpoints: []string{"127.0.0.1:1234", "127.0.0.2:1234", "127.0.0.3:1234"},
|
| ... | ... |
@@ -54,12 +54,12 @@ func (ds *DiscoverySuite) TestInitialize(c *check.C) {
|
| 54 | 54 |
d.store = storeMock |
| 55 | 55 |
|
| 56 | 56 |
s = d.store.(*FakeStore) |
| 57 |
- c.Assert(s.Endpoints, check.HasLen, 3) |
|
| 58 |
- c.Assert(s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 59 |
- c.Assert(s.Endpoints[1], check.Equals, "127.0.0.2:1234") |
|
| 60 |
- c.Assert(s.Endpoints[2], check.Equals, "127.0.0.3:1234") |
|
| 57 |
+ assert.Assert(c, s.Endpoints, check.HasLen, 3) |
|
| 58 |
+ assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 59 |
+ assert.Assert(c, s.Endpoints[1], check.Equals, "127.0.0.2:1234") |
|
| 60 |
+ assert.Assert(c, s.Endpoints[2], check.Equals, "127.0.0.3:1234") |
|
| 61 | 61 |
|
| 62 |
- c.Assert(d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 62 |
+ assert.Assert(c, d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 | 65 |
// Extremely limited mock store so we can test initialization |
| ... | ... |
@@ -181,12 +181,12 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= |
| 181 | 181 |
-----END RSA PRIVATE KEY----- |
| 182 | 182 |
` |
| 183 | 183 |
certFile, err := ioutil.TempFile("", "cert")
|
| 184 |
- c.Assert(err, check.IsNil) |
|
| 184 |
+ assert.Assert(c, err, check.IsNil) |
|
| 185 | 185 |
defer os.Remove(certFile.Name()) |
| 186 | 186 |
certFile.Write([]byte(cert)) |
| 187 | 187 |
certFile.Close() |
| 188 | 188 |
keyFile, err := ioutil.TempFile("", "key")
|
| 189 |
- c.Assert(err, check.IsNil) |
|
| 189 |
+ assert.Assert(c, err, check.IsNil) |
|
| 190 | 190 |
defer os.Remove(keyFile.Name()) |
| 191 | 191 |
keyFile.Write([]byte(key)) |
| 192 | 192 |
keyFile.Close() |
| ... | ... |
@@ -198,11 +198,11 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= |
| 198 | 198 |
"kv.certfile": certFile.Name(), |
| 199 | 199 |
"kv.keyfile": keyFile.Name(), |
| 200 | 200 |
}) |
| 201 |
- c.Assert(err, check.IsNil) |
|
| 201 |
+ assert.Assert(c, err, check.IsNil) |
|
| 202 | 202 |
s := d.store.(*Mock) |
| 203 |
- c.Assert(s.Options.TLS, check.NotNil) |
|
| 204 |
- c.Assert(s.Options.TLS.RootCAs, check.NotNil) |
|
| 205 |
- c.Assert(s.Options.TLS.Certificates, check.HasLen, 1) |
|
| 203 |
+ assert.Assert(c, s.Options.TLS, check.NotNil) |
|
| 204 |
+ assert.Assert(c, s.Options.TLS.RootCAs, check.NotNil) |
|
| 205 |
+ assert.Assert(c, s.Options.TLS.Certificates, check.HasLen, 1) |
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (ds *DiscoverySuite) TestWatch(c *check.C) {
|
| ... | ... |
@@ -230,7 +230,7 @@ func (ds *DiscoverySuite) TestWatch(c *check.C) {
|
| 230 | 230 |
ch, errCh := d.Watch(stopCh) |
| 231 | 231 |
|
| 232 | 232 |
// It should fire an error since the first WatchTree call failed. |
| 233 |
- c.Assert(<-errCh, check.ErrorMatches, "test error") |
|
| 233 |
+ assert.Assert(c, <-errCh, check.ErrorMatches, "test error") |
|
| 234 | 234 |
// We have to drain the error channel otherwise Watch will get stuck. |
| 235 | 235 |
go func() {
|
| 236 | 236 |
for range errCh {
|
| ... | ... |
@@ -239,13 +239,13 @@ func (ds *DiscoverySuite) TestWatch(c *check.C) {
|
| 239 | 239 |
|
| 240 | 240 |
// Push the entries into the store channel and make sure discovery emits. |
| 241 | 241 |
mockCh <- kvs |
| 242 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 242 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 243 | 243 |
|
| 244 | 244 |
// Add a new entry. |
| 245 | 245 |
expected = append(expected, &discovery.Entry{Host: "3.3.3.3", Port: "3333"})
|
| 246 | 246 |
kvs = append(kvs, &store.KVPair{Key: path.Join("path", defaultDiscoveryPath, "3.3.3.3"), Value: []byte("3.3.3.3:3333")})
|
| 247 | 247 |
mockCh <- kvs |
| 248 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 248 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 249 | 249 |
|
| 250 | 250 |
close(mockCh) |
| 251 | 251 |
// Give it enough time to call WatchTree. |
| ... | ... |
@@ -253,8 +253,8 @@ func (ds *DiscoverySuite) TestWatch(c *check.C) {
|
| 253 | 253 |
|
| 254 | 254 |
// Stop and make sure it closes all channels. |
| 255 | 255 |
close(stopCh) |
| 256 |
- c.Assert(<-ch, check.IsNil) |
|
| 257 |
- c.Assert(<-errCh, check.IsNil) |
|
| 256 |
+ assert.Assert(c, <-ch, check.IsNil) |
|
| 257 |
+ assert.Assert(c, <-errCh, check.IsNil) |
|
| 258 | 258 |
} |
| 259 | 259 |
|
| 260 | 260 |
// FakeStore implements store.Store methods. It mocks all store |
| ... | ... |
@@ -30,19 +30,19 @@ func (s *discoverySuite) TestWatch(c *check.C) {
|
| 30 | 30 |
&discovery.Entry{Host: "1.1.1.1", Port: "1111"},
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
- c.Assert(d.Register("1.1.1.1:1111"), check.IsNil)
|
|
| 34 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 33 |
+ assert.Assert(c, d.Register("1.1.1.1:1111"), check.IsNil)
|
|
| 34 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 35 | 35 |
|
| 36 | 36 |
expected = discovery.Entries{
|
| 37 | 37 |
&discovery.Entry{Host: "1.1.1.1", Port: "1111"},
|
| 38 | 38 |
&discovery.Entry{Host: "2.2.2.2", Port: "2222"},
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
- c.Assert(d.Register("2.2.2.2:2222"), check.IsNil)
|
|
| 42 |
- c.Assert(<-ch, check.DeepEquals, expected) |
|
| 41 |
+ assert.Assert(c, d.Register("2.2.2.2:2222"), check.IsNil)
|
|
| 42 |
+ assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 43 | 43 |
|
| 44 | 44 |
// Stop and make sure it closes all channels. |
| 45 | 45 |
close(stopCh) |
| 46 |
- c.Assert(<-ch, check.IsNil) |
|
| 47 |
- c.Assert(<-errCh, check.IsNil) |
|
| 46 |
+ assert.Assert(c, <-ch, check.IsNil) |
|
| 47 |
+ assert.Assert(c, <-errCh, check.IsNil) |
|
| 48 | 48 |
} |
| ... | ... |
@@ -18,20 +18,20 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 18 | 18 |
func (s *DiscoverySuite) TestInitialize(c *check.C) {
|
| 19 | 19 |
d := &Discovery{}
|
| 20 | 20 |
d.Initialize("1.1.1.1:1111,2.2.2.2:2222", 0, 0, nil)
|
| 21 |
- c.Assert(len(d.entries), check.Equals, 2) |
|
| 22 |
- c.Assert(d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 23 |
- c.Assert(d.entries[1].String(), check.Equals, "2.2.2.2:2222") |
|
| 21 |
+ assert.Assert(c, len(d.entries), check.Equals, 2) |
|
| 22 |
+ assert.Assert(c, d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 23 |
+ assert.Assert(c, d.entries[1].String(), check.Equals, "2.2.2.2:2222") |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func (s *DiscoverySuite) TestInitializeWithPattern(c *check.C) {
|
| 27 | 27 |
d := &Discovery{}
|
| 28 | 28 |
d.Initialize("1.1.1.[1:2]:1111,2.2.2.[2:4]:2222", 0, 0, nil)
|
| 29 |
- c.Assert(len(d.entries), check.Equals, 5) |
|
| 30 |
- c.Assert(d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 31 |
- c.Assert(d.entries[1].String(), check.Equals, "1.1.1.2:1111") |
|
| 32 |
- c.Assert(d.entries[2].String(), check.Equals, "2.2.2.2:2222") |
|
| 33 |
- c.Assert(d.entries[3].String(), check.Equals, "2.2.2.3:2222") |
|
| 34 |
- c.Assert(d.entries[4].String(), check.Equals, "2.2.2.4:2222") |
|
| 29 |
+ assert.Assert(c, len(d.entries), check.Equals, 5) |
|
| 30 |
+ assert.Assert(c, d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 31 |
+ assert.Assert(c, d.entries[1].String(), check.Equals, "1.1.1.2:1111") |
|
| 32 |
+ assert.Assert(c, d.entries[2].String(), check.Equals, "2.2.2.2:2222") |
|
| 33 |
+ assert.Assert(c, d.entries[3].String(), check.Equals, "2.2.2.3:2222") |
|
| 34 |
+ assert.Assert(c, d.entries[4].String(), check.Equals, "2.2.2.4:2222") |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| ... | ... |
@@ -42,10 +42,10 @@ func (s *DiscoverySuite) TestWatch(c *check.C) {
|
| 42 | 42 |
&discovery.Entry{Host: "2.2.2.2", Port: "2222"},
|
| 43 | 43 |
} |
| 44 | 44 |
ch, _ := d.Watch(nil) |
| 45 |
- c.Assert(expected.Equals(<-ch), check.Equals, true) |
|
| 45 |
+ assert.Assert(c, expected.Equals(<-ch), check.Equals, true) |
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
func (s *DiscoverySuite) TestRegister(c *check.C) {
|
| 49 | 49 |
d := &Discovery{}
|
| 50 |
- c.Assert(d.Register("0.0.0.0"), check.NotNil)
|
|
| 50 |
+ assert.Assert(c, d.Register("0.0.0.0"), check.NotNil)
|
|
| 51 | 51 |
} |