sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.HasLen, (.*)#assert.Equal(c, len(\1), \2#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_by_digest_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_import_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_userns_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/kv/kv_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 491ef7b90155060625d368ac8218955d1377ae10)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -389,7 +389,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
|
| 389 | 389 |
assert.NilError(c, err) |
| 390 | 390 |
|
| 391 | 391 |
pausedContainers = getPaused(c) |
| 392 |
- assert.Assert(c, pausedContainers, checker.HasLen, 0, check.Commentf("There should be no paused container."))
|
|
| 392 |
+ assert.Equal(c, len(pausedContainers), 0, check.Commentf("There should be no paused container."))
|
|
| 393 | 393 |
} |
| 394 | 394 |
|
| 395 | 395 |
func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
| ... | ... |
@@ -405,12 +405,12 @@ func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
| 405 | 405 |
// sort by comm[andline] to make sure order stays the same in case of PID rollover |
| 406 | 406 |
top, err := cli.ContainerTop(context.Background(), id, []string{"aux", "--sort=comm"})
|
| 407 | 407 |
assert.NilError(c, err) |
| 408 |
- assert.Assert(c, top.Titles, checker.HasLen, 11, check.Commentf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles))
|
|
| 408 |
+ assert.Equal(c, len(top.Titles), 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 |
- assert.Assert(c, top.Processes, checker.HasLen, 2, check.Commentf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 413 |
+ assert.Equal(c, len(top.Processes), 2, check.Commentf("expected 2 processes, found %d: %v", len(top.Processes), top.Processes))
|
|
| 414 | 414 |
assert.Equal(c, top.Processes[0][10], "/bin/sh -c top") |
| 415 | 415 |
assert.Equal(c, top.Processes[1][10], "top") |
| 416 | 416 |
} |
| ... | ... |
@@ -151,7 +151,7 @@ func (s *DockerRegistrySuite) TestRunByDigest(c *testing.T) {
|
| 151 | 151 |
|
| 152 | 152 |
foundRegex := regexp.MustCompile("found=([^\n]+)")
|
| 153 | 153 |
matches := foundRegex.FindStringSubmatch(out) |
| 154 |
- assert.Assert(c, matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 154 |
+ assert.Equal(c, len(matches), 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 155 | 155 |
assert.Equal(c, matches[1], "1", check.Commentf("Expected %q, got %q", "1", matches[1]))
|
| 156 | 156 |
|
| 157 | 157 |
res := inspectField(c, containerName, "Config.Image") |
| ... | ... |
@@ -401,8 +401,8 @@ func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) {
|
| 401 | 401 |
var imageJSON []types.ImageInspect |
| 402 | 402 |
err = json.Unmarshal([]byte(out), &imageJSON) |
| 403 | 403 |
assert.NilError(c, err) |
| 404 |
- assert.Assert(c, imageJSON, checker.HasLen, 1) |
|
| 405 |
- assert.Assert(c, imageJSON[0].RepoDigests, checker.HasLen, 1) |
|
| 404 |
+ assert.Equal(c, len(imageJSON), 1) |
|
| 405 |
+ assert.Equal(c, len(imageJSON[0].RepoDigests), 1) |
|
| 406 | 406 |
assert.Check(c, is.Contains(imageJSON[0].RepoDigests, imageReference)) |
| 407 | 407 |
} |
| 408 | 408 |
|
| ... | ... |
@@ -123,10 +123,10 @@ func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
| 123 | 123 |
cont := containers[0] |
| 124 | 124 |
|
| 125 | 125 |
assert.Assert(c, cont.HostConfig, checker.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)))
|
|
| 126 |
+ assert.Equal(c, len(cont.HostConfig.PortBindings), 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 |
- assert.Assert(c, v, checker.HasLen, 1, check.Commentf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 129 |
+ assert.Equal(c, len(v), 1, check.Commentf("Expected 1 ports binding, for the port %s but found %s", k, v))
|
|
| 130 | 130 |
assert.Equal(c, k.Port(), v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
| 131 | 131 |
|
| 132 | 132 |
} |
| ... | ... |
@@ -152,10 +152,10 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
|
| 152 | 152 |
|
| 153 | 153 |
cont := containers[0] |
| 154 | 154 |
assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
|
| 155 |
- assert.Assert(c, cont.HostConfig.PortBindings, checker.HasLen, 65535) |
|
| 155 |
+ assert.Equal(c, len(cont.HostConfig.PortBindings), 65535) |
|
| 156 | 156 |
|
| 157 | 157 |
for k, v := range cont.HostConfig.PortBindings {
|
| 158 |
- assert.Assert(c, v, checker.HasLen, 1) |
|
| 158 |
+ assert.Equal(c, len(v), 1) |
|
| 159 | 159 |
assert.Equal(c, k.Port(), v[0].HostPort, check.Commentf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
|
| 160 | 160 |
} |
| 161 | 161 |
|
| ... | ... |
@@ -1726,7 +1726,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *testing.T) {
|
| 1726 | 1726 |
conn.Close() |
| 1727 | 1727 |
|
| 1728 | 1728 |
assert.Assert(c, certRequestInfo, checker.NotNil) |
| 1729 |
- assert.Assert(c, certRequestInfo.AcceptableCAs, checker.HasLen, 1) |
|
| 1729 |
+ assert.Equal(c, len(certRequestInfo.AcceptableCAs), 1) |
|
| 1730 | 1730 |
assert.DeepEqual(c, certRequestInfo.AcceptableCAs[0], rootCert.RawSubject) |
| 1731 | 1731 |
} |
| 1732 | 1732 |
|
| ... | ... |
@@ -488,8 +488,8 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *testing.T) {
|
| 488 | 488 |
var st []vol |
| 489 | 489 |
|
| 490 | 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]))
|
|
| 491 |
+ assert.Equal(c, len(st), 1) |
|
| 492 |
+ assert.Equal(c, len(st[0].Status), 1, check.Commentf("%v", st[0]))
|
|
| 493 | 493 |
assert.Equal(c, st[0].Status["Hello"], "world", check.Commentf("%v", st[0].Status))
|
| 494 | 494 |
} |
| 495 | 495 |
|
| ... | ... |
@@ -500,7 +500,7 @@ 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 |
- assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 503 |
+ assert.Equal(c, len(mounts), 1) |
|
| 504 | 504 |
assert.Equal(c, mounts[0].Driver, volumePluginName) |
| 505 | 505 |
} |
| 506 | 506 |
|
| ... | ... |
@@ -583,7 +583,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *t |
| 583 | 583 |
var vs []types.Volume |
| 584 | 584 |
err = json.Unmarshal([]byte(out), &vs) |
| 585 | 585 |
assert.NilError(c, err) |
| 586 |
- assert.Assert(c, vs, checker.HasLen, 1) |
|
| 586 |
+ assert.Equal(c, len(vs), 1) |
|
| 587 | 587 |
assert.Equal(c, vs[0].Driver, driverName) |
| 588 | 588 |
assert.Assert(c, vs[0].Options, checker.NotNil) |
| 589 | 589 |
assert.Equal(c, vs[0].Options["foo"], "bar") |
| ... | ... |
@@ -601,8 +601,8 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *t |
| 601 | 601 |
vs = nil |
| 602 | 602 |
err = json.Unmarshal([]byte(out), &vs) |
| 603 | 603 |
assert.NilError(c, err) |
| 604 |
- assert.Assert(c, vs, checker.HasLen, 1) |
|
| 605 |
- assert.Assert(c, vs[0].Options, checker.HasLen, 0) |
|
| 604 |
+ assert.Equal(c, len(vs), 1) |
|
| 605 |
+ assert.Equal(c, len(vs[0].Options), 0) |
|
| 606 | 606 |
assert.Equal(c, vs[0].Driver, "local") |
| 607 | 607 |
} |
| 608 | 608 |
|
| ... | ... |
@@ -110,7 +110,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
| 110 | 110 |
out, _ = dockerCmd(c, "history", image) |
| 111 | 111 |
split := strings.Split(out, "\n") |
| 112 | 112 |
|
| 113 |
- assert.Assert(c, split, checker.HasLen, 3, check.Commentf("expected 3 lines from image history"))
|
|
| 113 |
+ assert.Equal(c, len(split), 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 |
|
| ... | ... |
@@ -223,7 +223,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
|
| 223 | 223 |
assert.NilError(c, err) |
| 224 | 224 |
|
| 225 | 225 |
// check that there is only one mountpoint |
| 226 |
- assert.Assert(c, mp, checker.HasLen, 1) |
|
| 226 |
+ assert.Equal(c, len(mp), 1) |
|
| 227 | 227 |
|
| 228 | 228 |
m := mp[0] |
| 229 | 229 |
|
| ... | ... |
@@ -249,7 +249,7 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *testing.T) {
|
| 249 | 249 |
assert.NilError(c, err) |
| 250 | 250 |
|
| 251 | 251 |
// check that there is only one mountpoint |
| 252 |
- assert.Assert(c, mp, checker.HasLen, 1) |
|
| 252 |
+ assert.Equal(c, len(mp), 1) |
|
| 253 | 253 |
|
| 254 | 254 |
m := mp[0] |
| 255 | 255 |
|
| ... | ... |
@@ -530,7 +530,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *testing.T) {
|
| 530 | 530 |
var newNetRes []types.NetworkResource |
| 531 | 531 |
err = json.Unmarshal([]byte(out), &newNetRes) |
| 532 | 532 |
assert.NilError(c, err) |
| 533 |
- assert.Assert(c, newNetRes, checker.HasLen, 1) |
|
| 533 |
+ assert.Equal(c, len(newNetRes), 1) |
|
| 534 | 534 |
container1, ok := newNetRes[0].Containers[containerID] |
| 535 | 535 |
assert.Assert(c, ok) |
| 536 | 536 |
assert.Equal(c, container1.Name, newName) |
| ... | ... |
@@ -1034,7 +1034,7 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *testing.T) {
|
| 1034 | 1034 |
var inspect121 types.ContainerJSON |
| 1035 | 1035 |
err = json.Unmarshal(body, &inspect121) |
| 1036 | 1036 |
assert.NilError(c, err) |
| 1037 |
- assert.Assert(c, inspect121.NetworkSettings.Networks, checker.HasLen, 3) |
|
| 1037 |
+ assert.Equal(c, len(inspect121.NetworkSettings.Networks), 3) |
|
| 1038 | 1038 |
|
| 1039 | 1039 |
bridge := inspect121.NetworkSettings.Networks["bridge"] |
| 1040 | 1040 |
assert.Equal(c, bridge.IPAddress, versionedIP) |
| ... | ... |
@@ -386,7 +386,7 @@ func checkPsAncestorFilterOutput(c *testing.T, out string, filterName string, ex |
| 386 | 386 |
sort.Strings(actualIDs) |
| 387 | 387 |
sort.Strings(expectedIDs) |
| 388 | 388 |
|
| 389 |
- assert.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))
|
|
| 389 |
+ assert.Equal(c, len(actualIDs), len(expectedIDs), check.Commentf("Expected filtered container(s) for %s ancestor filter to be %v:%v, got %v:%v", filterName, len(expectedIDs), expectedIDs, len(actualIDs), actualIDs))
|
|
| 390 | 390 |
if len(expectedIDs) > 0 {
|
| 391 | 391 |
same := true |
| 392 | 392 |
for i := range expectedIDs {
|
| ... | ... |
@@ -665,7 +665,7 @@ func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
|
| 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 |
- assert.Assert(c, strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 668 |
+ assert.Equal(c, len(strings.TrimSpace(string(out))), 0) |
|
| 669 | 669 |
|
| 670 | 670 |
// filter by mount destination |
| 671 | 671 |
out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+mp)
|
| ... | ... |
@@ -705,7 +705,7 @@ func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
|
| 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 |
- assert.Assert(c, strings.TrimSpace(string(out)), checker.HasLen, 0) |
|
| 708 |
+ assert.Equal(c, len(strings.TrimSpace(string(out))), 0) |
|
| 709 | 709 |
} |
| 710 | 710 |
|
| 711 | 711 |
func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
| ... | ... |
@@ -355,7 +355,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *testing.T) {
|
| 355 | 355 |
|
| 356 | 356 |
// The pull output includes "Digest: <digest>", so find that |
| 357 | 357 |
matches := digestRegex.FindStringSubmatch(out) |
| 358 |
- assert.Assert(c, matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
|
|
| 358 |
+ assert.Equal(c, len(matches), 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 |
| ... | ... |
@@ -467,5 +467,5 @@ func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *testing.T) {
|
| 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 |
- assert.Assert(c, splitOutImageCmd, checker.HasLen, 2) |
|
| 470 |
+ assert.Equal(c, len(splitOutImageCmd), 2) |
|
| 471 | 471 |
} |
| ... | ... |
@@ -42,7 +42,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
| 42 | 42 |
|
| 43 | 43 |
var mountConfig []mount.Mount |
| 44 | 44 |
assert.Assert(c, json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
| 45 |
- assert.Assert(c, mountConfig, checker.HasLen, 1) |
|
| 45 |
+ assert.Equal(c, len(mountConfig), 1) |
|
| 46 | 46 |
|
| 47 | 47 |
assert.Equal(c, mountConfig[0].Source, "foo") |
| 48 | 48 |
assert.Equal(c, mountConfig[0].Target, "/foo") |
| ... | ... |
@@ -56,7 +56,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
| 56 | 56 |
|
| 57 | 57 |
var mounts []types.MountPoint |
| 58 | 58 |
assert.Assert(c, json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
| 59 |
- assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 59 |
+ assert.Equal(c, len(mounts), 1) |
|
| 60 | 60 |
|
| 61 | 61 |
assert.Equal(c, mounts[0].Type, mount.TypeVolume) |
| 62 | 62 |
assert.Equal(c, mounts[0].Name, "foo") |
| ... | ... |
@@ -385,7 +385,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
| 385 | 385 |
|
| 386 | 386 |
var mountConfig []mount.Mount |
| 387 | 387 |
assert.Assert(c, json.Unmarshal([]byte(out), &mountConfig), checker.IsNil) |
| 388 |
- assert.Assert(c, mountConfig, checker.HasLen, 1) |
|
| 388 |
+ assert.Equal(c, len(mountConfig), 1) |
|
| 389 | 389 |
|
| 390 | 390 |
assert.Equal(c, mountConfig[0].Source, "") |
| 391 | 391 |
assert.Equal(c, mountConfig[0].Target, "/foo") |
| ... | ... |
@@ -399,7 +399,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
| 399 | 399 |
|
| 400 | 400 |
var mounts []types.MountPoint |
| 401 | 401 |
assert.Assert(c, json.Unmarshal([]byte(out), &mounts), checker.IsNil) |
| 402 |
- assert.Assert(c, mounts, checker.HasLen, 1) |
|
| 402 |
+ assert.Equal(c, len(mounts), 1) |
|
| 403 | 403 |
|
| 404 | 404 |
assert.Equal(c, mounts[0].Type, mount.TypeTmpfs) |
| 405 | 405 |
assert.Equal(c, mounts[0].Name, "") |
| ... | ... |
@@ -442,7 +442,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
| 442 | 442 |
// Make sure the only alias seen is the container-id |
| 443 | 443 |
var aliases []string |
| 444 | 444 |
assert.Assert(c, json.Unmarshal([]byte(out), &aliases), checker.IsNil) |
| 445 |
- assert.Assert(c, aliases, checker.HasLen, 1) |
|
| 445 |
+ assert.Equal(c, len(aliases), 1) |
|
| 446 | 446 |
|
| 447 | 447 |
assert.Assert(c, task.Status.ContainerStatus.ContainerID, checker.Contains, aliases[0]) |
| 448 | 448 |
} |
| ... | ... |
@@ -65,7 +65,7 @@ func (s *DockerSwarmSuite) TestSwarmUpdate(c *testing.T) {
|
| 65 | 65 |
assert.NilError(c, err) |
| 66 | 66 |
|
| 67 | 67 |
spec = getSpec() |
| 68 |
- assert.Assert(c, spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 68 |
+ assert.Equal(c, len(spec.CAConfig.ExternalCAs), 2) |
|
| 69 | 69 |
assert.Equal(c, spec.CAConfig.ExternalCAs[0].CACert, "") |
| 70 | 70 |
assert.Equal(c, spec.CAConfig.ExternalCAs[1].CACert, string(expected)) |
| 71 | 71 |
|
| ... | ... |
@@ -113,7 +113,7 @@ func (s *DockerSwarmSuite) TestSwarmInit(c *testing.T) {
|
| 113 | 113 |
spec := getSpec() |
| 114 | 114 |
assert.Equal(c, spec.CAConfig.NodeCertExpiry, 30*time.Hour) |
| 115 | 115 |
assert.Equal(c, spec.Dispatcher.HeartbeatPeriod, 11*time.Second) |
| 116 |
- assert.Assert(c, spec.CAConfig.ExternalCAs, checker.HasLen, 2) |
|
| 116 |
+ assert.Equal(c, len(spec.CAConfig.ExternalCAs), 2) |
|
| 117 | 117 |
assert.Equal(c, spec.CAConfig.ExternalCAs[0].CACert, "") |
| 118 | 118 |
assert.Equal(c, spec.CAConfig.ExternalCAs[1].CACert, string(expected)) |
| 119 | 119 |
|
| ... | ... |
@@ -38,7 +38,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) {
|
| 38 | 38 |
|
| 39 | 39 |
// we need to find the uid and gid of the remapped root from the daemon's root dir info |
| 40 | 40 |
uidgid := strings.Split(filepath.Base(s.d.Root), ".") |
| 41 |
- assert.Assert(c, uidgid, checker.HasLen, 2, check.Commentf("Should have gotten uid/gid strings from root dirname: %s", filepath.Base(s.d.Root)))
|
|
| 41 |
+ assert.Equal(c, len(uidgid), 2, 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]) |
| ... | ... |
@@ -110,25 +110,25 @@ func (s *DiscoverySuite) TestEntriesDiff(c *testing.T) {
|
| 110 | 110 |
|
| 111 | 111 |
// No diff |
| 112 | 112 |
added, removed := entries.Diff(Entries{entry2, entry1})
|
| 113 |
- assert.Assert(c, added, checker.HasLen, 0) |
|
| 114 |
- assert.Assert(c, removed, checker.HasLen, 0) |
|
| 113 |
+ assert.Equal(c, len(added), 0) |
|
| 114 |
+ assert.Equal(c, len(removed), 0) |
|
| 115 | 115 |
|
| 116 | 116 |
// Add |
| 117 | 117 |
added, removed = entries.Diff(Entries{entry2, entry3, entry1})
|
| 118 |
- assert.Assert(c, added, checker.HasLen, 1) |
|
| 118 |
+ assert.Equal(c, len(added), 1) |
|
| 119 | 119 |
assert.Equal(c, added.Contains(entry3), true) |
| 120 |
- assert.Assert(c, removed, checker.HasLen, 0) |
|
| 120 |
+ assert.Equal(c, len(removed), 0) |
|
| 121 | 121 |
|
| 122 | 122 |
// Remove |
| 123 | 123 |
added, removed = entries.Diff(Entries{entry2})
|
| 124 |
- assert.Assert(c, added, checker.HasLen, 0) |
|
| 125 |
- assert.Assert(c, removed, checker.HasLen, 1) |
|
| 124 |
+ assert.Equal(c, len(added), 0) |
|
| 125 |
+ assert.Equal(c, len(removed), 1) |
|
| 126 | 126 |
assert.Equal(c, removed.Contains(entry1), true) |
| 127 | 127 |
|
| 128 | 128 |
// Add and remove |
| 129 | 129 |
added, removed = entries.Diff(Entries{entry1, entry3})
|
| 130 |
- assert.Assert(c, added, checker.HasLen, 1) |
|
| 130 |
+ assert.Equal(c, len(added), 1) |
|
| 131 | 131 |
assert.Equal(c, added.Contains(entry3), true) |
| 132 |
- assert.Assert(c, removed, checker.HasLen, 1) |
|
| 132 |
+ assert.Equal(c, len(removed), 1) |
|
| 133 | 133 |
assert.Equal(c, removed.Contains(entry2), true) |
| 134 | 134 |
} |
| ... | ... |
@@ -35,7 +35,7 @@ func (s *DiscoverySuite) TestContent(c *testing.T) {
|
| 35 | 35 |
2.2.2.[2:4]:2222 |
| 36 | 36 |
` |
| 37 | 37 |
ips := parseFileContent([]byte(data)) |
| 38 |
- assert.Assert(c, ips, checker.HasLen, 5) |
|
| 38 |
+ assert.Equal(c, len(ips), 5) |
|
| 39 | 39 |
assert.Equal(c, ips[0], "1.1.1.1:1111") |
| 40 | 40 |
assert.Equal(c, ips[1], "1.1.1.2:1111") |
| 41 | 41 |
assert.Equal(c, ips[2], "2.2.2.2:2222") |
| ... | ... |
@@ -58,7 +58,7 @@ func (s *DiscoverySuite) TestParsingContentsWithComments(c *testing.T) {
|
| 58 | 58 |
### test ### |
| 59 | 59 |
` |
| 60 | 60 |
ips := parseFileContent([]byte(data)) |
| 61 |
- assert.Assert(c, ips, checker.HasLen, 2) |
|
| 61 |
+ assert.Equal(c, len(ips), 2) |
|
| 62 | 62 |
assert.Equal(c, "1.1.1.1:1111", ips[0]) |
| 63 | 63 |
assert.Equal(c, "3.3.3.3:3333", ips[1]) |
| 64 | 64 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 30 | 30 |
d.store = storeMock |
| 31 | 31 |
|
| 32 | 32 |
s := d.store.(*FakeStore) |
| 33 |
- assert.Assert(c, s.Endpoints, checker.HasLen, 1) |
|
| 33 |
+ assert.Equal(c, len(s.Endpoints), 1) |
|
| 34 | 34 |
assert.Equal(c, s.Endpoints[0], "127.0.0.1") |
| 35 | 35 |
assert.Equal(c, d.path, defaultDiscoveryPath) |
| 36 | 36 |
|
| ... | ... |
@@ -42,7 +42,7 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 42 | 42 |
d.store = storeMock |
| 43 | 43 |
|
| 44 | 44 |
s = d.store.(*FakeStore) |
| 45 |
- assert.Assert(c, s.Endpoints, checker.HasLen, 1) |
|
| 45 |
+ assert.Equal(c, len(s.Endpoints), 1) |
|
| 46 | 46 |
assert.Equal(c, s.Endpoints[0], "127.0.0.1:1234") |
| 47 | 47 |
assert.Equal(c, d.path, "path/"+defaultDiscoveryPath) |
| 48 | 48 |
|
| ... | ... |
@@ -54,7 +54,7 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 54 | 54 |
d.store = storeMock |
| 55 | 55 |
|
| 56 | 56 |
s = d.store.(*FakeStore) |
| 57 |
- assert.Assert(c, s.Endpoints, checker.HasLen, 3) |
|
| 57 |
+ assert.Equal(c, len(s.Endpoints), 3) |
|
| 58 | 58 |
assert.Equal(c, s.Endpoints[0], "127.0.0.1:1234") |
| 59 | 59 |
assert.Equal(c, s.Endpoints[1], "127.0.0.2:1234") |
| 60 | 60 |
assert.Equal(c, s.Endpoints[2], "127.0.0.3:1234") |
| ... | ... |
@@ -202,7 +202,7 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= |
| 202 | 202 |
s := d.store.(*Mock) |
| 203 | 203 |
assert.Assert(c, s.Options.TLS, checker.NotNil) |
| 204 | 204 |
assert.Assert(c, s.Options.TLS.RootCAs, checker.NotNil) |
| 205 |
- assert.Assert(c, s.Options.TLS.Certificates, checker.HasLen, 1) |
|
| 205 |
+ assert.Equal(c, len(s.Options.TLS.Certificates), 1) |
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (ds *DiscoverySuite) TestWatch(c *testing.T) {
|