1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

rm-gocheck: Not(Equals) -> a != b

sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Equals\), (.*)#assert.Assert(c, \1 != \2#g' \
-- "integration-cli/docker_api_containers_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_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 0fa116fa8f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Tibor Vass 2019-09-09 21:05:56 +00:00 committed by Sebastiaan van Stijn
parent fa8d7029a7
commit 819baeb430
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
15 changed files with 70 additions and 70 deletions

View file

@ -668,7 +668,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
body.Close()
@ -678,7 +678,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
body.Close()
@ -708,7 +708,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
b, err := request.ReadBody(body)
@ -732,7 +732,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
b, err := request.ReadBody(body)
@ -756,7 +756,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
b, err := request.ReadBody(body)
@ -780,7 +780,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
b, err := request.ReadBody(body)
@ -869,7 +869,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
assert.Assert(c, string(b), checker.Contains, "Minimum memory limit allowed is 4MB")
}
@ -1061,7 +1061,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T)
if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
} else {
assert.Assert(c, res.StatusCode, checker.Not(checker.Equals), http.StatusOK)
assert.Assert(c, res.StatusCode != http.StatusOK)
}
b, err := request.ReadBody(body)
assert.NilError(c, err)

View file

@ -5457,7 +5457,7 @@ func (s *DockerSuite) TestBuildCacheFrom(c *testing.T) {
// no cache match with unknown source
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=nosuchtag"), build.WithExternalBuildContext(ctx))
id2 = getIDByName(c, "build2")
assert.Assert(c, id1, checker.Not(checker.Equals), id2)
assert.Assert(c, id1 != id2)
assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 0)
cli.DockerCmd(c, "rmi", "build2")
@ -5505,7 +5505,7 @@ func (s *DockerSuite) TestBuildCacheFrom(c *testing.T) {
result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
id2 = getIDByName(c, "build2")
assert.Assert(c, id1, checker.Not(checker.Equals), id2)
assert.Assert(c, id1 != id2)
assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2)
layers1Str := cli.DockerCmd(c, "inspect", "-f", "{{json .RootFS.Layers}}", "build1").Combined()
@ -5520,7 +5520,7 @@ func (s *DockerSuite) TestBuildCacheFrom(c *testing.T) {
for i := 0; i < len(layers1)-1; i++ {
assert.Assert(c, layers1[i], checker.Equals, layers2[i])
}
assert.Assert(c, layers1[len(layers1)-1], checker.Not(checker.Equals), layers2[len(layers1)-1])
assert.Assert(c, layers1[len(layers1)-1] != layers2[len(layers1)-1])
}
func (s *DockerSuite) TestBuildMultiStageCache(c *testing.T) {

View file

@ -76,12 +76,12 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
err = json.Unmarshal([]byte(cfg), &c2)
assert.Assert(c, err, checker.IsNil, check.Commentf(cfg))
assert.Assert(c, c2.Memory, checker.Not(checker.Equals), int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
assert.Assert(c, c2.MemorySwap, checker.Not(checker.Equals), int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
assert.Assert(c, c2.CpusetCpus, checker.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetCpus"))
assert.Assert(c, c2.CpusetMems, checker.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetMems"))
assert.Assert(c, c2.CPUShares, checker.Not(checker.Equals), int64(100), check.Commentf("resource leaked from build for CPUShares"))
assert.Assert(c, c2.CPUQuota, checker.Not(checker.Equals), int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
assert.Assert(c, c2.Memory != int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
assert.Assert(c, c2.MemorySwap != int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
assert.Assert(c, c2.CpusetCpus != "0", check.Commentf("resource leaked from build for CpusetCpus"))
assert.Assert(c, c2.CpusetMems != "0", check.Commentf("resource leaked from build for CpusetMems"))
assert.Assert(c, c2.CPUShares != int64(100), check.Commentf("resource leaked from build for CPUShares"))
assert.Assert(c, c2.CPUQuota != int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
assert.Assert(c, c2.Ulimits, checker.IsNil, check.Commentf("resource leaked from build for Ulimits"))
}

View file

@ -556,7 +556,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) {
// Pull from the registry using the <name>@<digest> reference.
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0)
assert.Assert(c, exitStatus != 0)
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
assert.Assert(c, is.Contains(out, expectedErrorMsg))
@ -598,7 +598,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing
// Pull from the registry using the <name>@<digest> reference.
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0)
assert.Assert(c, exitStatus != 0)
expectedErrorMsg := fmt.Sprintf("image verification failed for digest %s", manifestDigest)
assert.Assert(c, out, checker.Contains, expectedErrorMsg)
@ -641,7 +641,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
// Pull from the registry using the <name>@<digest> reference.
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0, check.Commentf("expected a non-zero exit status"))
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
@ -684,7 +684,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T)
// Pull from the registry using the <name>@<digest> reference.
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0, check.Commentf("expected a non-zero exit status"))
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))

View file

@ -362,7 +362,7 @@ exec "$@"`,
out := cli.DockerCmd(c, "create", "--entrypoint=", name, "echo", "foo").Combined()
id := strings.TrimSpace(out)
assert.Assert(c, id, checker.Not(checker.Equals), "")
assert.Assert(c, id != "")
out = cli.DockerCmd(c, "start", "-a", id).Combined()
assert.Assert(c, strings.TrimSpace(out), checker.Equals, "foo")
}

View file

@ -1751,7 +1751,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
assert.Assert(c, err, checker.IsNil, check.Commentf("%s", ip))
assert.Assert(c, ip, checker.Not(checker.Equals), bridgeIP)
assert.Assert(c, ip != bridgeIP)
cont++
}
}
@ -1854,7 +1854,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) {
out, err := s.d.Cmd("run", "--name", name, "busybox", "cat", "/proc/self/cgroup")
assert.NilError(c, err)
cgroupPaths := ParseCgroupPaths(string(out))
assert.Assert(c, len(cgroupPaths), checker.Not(checker.Equals), 0, check.Commentf("unexpected output - %q", string(out)))
assert.Assert(c, len(cgroupPaths) != 0, check.Commentf("unexpected output - %q", string(out)))
out, err = s.d.Cmd("inspect", "-f", "{{.Id}}", name)
assert.NilError(c, err)
id := strings.TrimSpace(string(out))
@ -2166,7 +2166,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *testing.T) {
s.d.Stop(c)
// Wait for io.Copy() before checking output
<-done
assert.Assert(c, b.String(), checker.Not(checker.Equals), "")
assert.Assert(c, b.String() != "")
assert.Assert(c, b.String(), checker.Not(checker.Contains), infoLog)
}

View file

@ -194,7 +194,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
deviceID := inspectField(c, out, "GraphDriver.Data.DeviceId")
assert.Assert(c, imageDeviceID, checker.Not(checker.Equals), deviceID)
assert.Assert(c, imageDeviceID != deviceID)
_, err := strconv.Atoi(deviceID)
assert.Assert(c, err, checker.IsNil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
@ -255,7 +255,7 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *testing.T) {
assert.Assert(c, m.Name, checker.Equals, "data")
assert.Assert(c, m.Driver, checker.Equals, "local")
assert.Assert(c, m.Source, checker.Not(checker.Equals), "")
assert.Assert(c, m.Source != "")
assert.Assert(c, m.Destination, checker.Equals, prefix+slash+"data")
assert.Assert(c, m.RW, checker.Equals, true)
}
@ -314,8 +314,8 @@ func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
out, _ := dockerCmd(c, "inspect", "-s", "--type=container", formatStr, "busybox")
sz := strings.Split(out, ",")
assert.Assert(c, strings.TrimSpace(sz[0]), checker.Not(checker.Equals), "<nil>")
assert.Assert(c, strings.TrimSpace(sz[1]), checker.Not(checker.Equals), "<nil>")
assert.Assert(c, strings.TrimSpace(sz[0]) != "<nil>")
assert.Assert(c, strings.TrimSpace(sz[1]) != "<nil>")
}
func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {

View file

@ -1060,7 +1060,7 @@ func verifyContainerIsConnectedToNetworks(c *testing.T, d *daemon.Daemon, cName
for _, nw := range nws {
out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName)
assert.NilError(c, err, out)
assert.Assert(c, out, checker.Not(checker.Equals), "<no value>\n")
assert.Assert(c, out != "<no value>\n")
}
}
@ -1166,7 +1166,7 @@ func verifyPortMap(c *testing.T, container, port, originalMapping string, mustBe
if mustBeEqual {
assert.Assert(c, currentMapping, checker.Equals, originalMapping)
} else {
assert.Assert(c, currentMapping, checker.Not(checker.Equals), originalMapping)
assert.Assert(c, currentMapping != originalMapping)
}
}
@ -1216,7 +1216,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *testing.T) {
assert.Assert(c, strings.TrimSpace(mac1), checker.Equals, macAddress)
dockerCmd(c, "network", "connect", "mynetwork", "test")
mac2 := inspectField(c, "test", "NetworkSettings.Networks.mynetwork.MacAddress")
assert.Assert(c, strings.TrimSpace(mac2), checker.Not(checker.Equals), strings.TrimSpace(mac1))
assert.Assert(c, strings.TrimSpace(mac2) != strings.TrimSpace(mac1))
}
func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *testing.T) {

View file

@ -192,19 +192,19 @@ func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) {
func (s *DockerSuite) TestPruneVolumeLabel(c *testing.T) {
out, _ := dockerCmd(c, "volume", "create", "--label", "foo")
id1 := strings.TrimSpace(out)
assert.Assert(c, id1, checker.Not(checker.Equals), "")
assert.Assert(c, id1 != "")
out, _ = dockerCmd(c, "volume", "create", "--label", "bar")
id2 := strings.TrimSpace(out)
assert.Assert(c, id2, checker.Not(checker.Equals), "")
assert.Assert(c, id2 != "")
out, _ = dockerCmd(c, "volume", "create")
id3 := strings.TrimSpace(out)
assert.Assert(c, id3, checker.Not(checker.Equals), "")
assert.Assert(c, id3 != "")
out, _ = dockerCmd(c, "volume", "create", "--label", "foobar")
id4 := strings.TrimSpace(out)
assert.Assert(c, id4, checker.Not(checker.Equals), "")
assert.Assert(c, id4 != "")
// Add a config file of label=foobar, that will have no impact if cli is label!=foobar
config := `{"pruneFilters": ["label=foobar"]}`

View file

@ -605,7 +605,7 @@ func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {
out, _ = dockerCmd(c, "ps", "-l")
lines = strings.Split(strings.TrimSpace(string(out)), "\n")
fields = strings.Fields(lines[1])
assert.Assert(c, fields[len(fields)-2], checker.Not(checker.Equals), expected, check.Commentf("Should not got %v", expected))
assert.Assert(c, fields[len(fields)-2] != expected, check.Commentf("Should not got %v", expected))
}
func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
@ -822,24 +822,24 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *testing.T) {
assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2)
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-8080/udp")
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1)
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2)
assert.Assert(c, strings.TrimSpace(out) != id1)
assert.Assert(c, strings.TrimSpace(out) != id2)
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=8081")
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1)
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2)
assert.Assert(c, strings.TrimSpace(out) != id1)
assert.Assert(c, strings.TrimSpace(out) != id2)
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-81")
assert.Equal(c, strings.TrimSpace(out), id1)
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2)
assert.Assert(c, strings.TrimSpace(out) != id2)
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=80/tcp")
assert.Equal(c, strings.TrimSpace(out), id1)
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id2)
assert.Assert(c, strings.TrimSpace(out) != id2)
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=8080/tcp")
out = RemoveOutputForExistingElements(out, existingContainers)
assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Equals), id1)
assert.Assert(c, strings.TrimSpace(out) != id1)
assert.Equal(c, strings.TrimSpace(out), id2)
}

View file

@ -3855,7 +3855,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsSlave(c *testing.T) {
func (s *DockerSuite) TestRunNamedVolumesMountedAsShared(c *testing.T) {
testRequires(c, DaemonIsLinux, NotUserNamespace)
out, exitCode, _ := dockerCmdWithError("run", "-v", "foo:/test:shared", "busybox", "touch", "/test/somefile")
assert.Assert(c, exitCode, checker.Not(checker.Equals), 0)
assert.Assert(c, exitCode != 0)
assert.Assert(c, out, checker.Contains, "invalid mount config")
}
@ -3909,7 +3909,7 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *testing.T) {
vname = v.Name
}
}
assert.Assert(c, vname, checker.Not(checker.Equals), "")
assert.Assert(c, vname != "")
// Remove the parent so there are not other references to the volumes
dockerCmd(c, "rm", "-f", "parent")

View file

@ -129,8 +129,8 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
cleanedShortImageID := strings.TrimSpace(out)
// Make sure IDs are not empty
assert.Assert(c, cleanedLongImageID, checker.Not(checker.Equals), "", check.Commentf("Id should not be empty."))
assert.Assert(c, cleanedShortImageID, checker.Not(checker.Equals), "", check.Commentf("Id should not be empty."))
assert.Assert(c, cleanedLongImageID != "", check.Commentf("Id should not be empty."))
assert.Assert(c, cleanedShortImageID != "", check.Commentf("Id should not be empty."))
saveCmd := exec.Command(dockerBinary, "save", cleanedShortImageID)
tarCmd := exec.Command("tar", "t")

View file

@ -75,7 +75,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *testing.T) {
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
assert.NilError(c, err, out)
@ -117,7 +117,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi
},
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
secretFlags = append(secretFlags, "--secret", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
}
@ -173,7 +173,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
serviceName := "svc"
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
@ -223,7 +223,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *testing.T) {
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
assert.Assert(c, id != "", check.Commentf("configs: %s", id))
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
assert.NilError(c, err, out)
@ -264,7 +264,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi
},
Data: []byte("TESTINGDATA " + testName + " " + testTarget),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
assert.Assert(c, id != "", check.Commentf("configs: %s", id))
configFlags = append(configFlags, "--config", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
}
@ -320,7 +320,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
assert.Assert(c, id != "", check.Commentf("configs: %s", id))
serviceName := "svc"
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")

View file

@ -626,7 +626,7 @@ func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *testing.T) {
assert.NilError(c, err, out)
lines := strings.Split(strings.Trim(out, "\n "), "\n")
assert.Equal(c, len(lines), 1)
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))
assert.Assert(c, lines[0] != bareID, check.Commentf("Expected not %s, but got it for is-task label, output %q", bareID, out))
}
const globalNetworkPlugin = "global-network-plugin"
@ -1263,8 +1263,8 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) {
assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", outs))
// Strip \n
newUnlockKey := outs[:len(outs)-1]
assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), "")
assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), unlockKey)
assert.Assert(c, newUnlockKey != "")
assert.Assert(c, newUnlockKey != unlockKey)
d.RestartNode(c)
assert.Assert(c, getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateLocked)
@ -1352,8 +1352,8 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
assert.Assert(c, err, checker.IsNil, check.Commentf("%s", outs))
// Strip \n
newUnlockKey := outs[:len(outs)-1]
assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), "")
assert.Assert(c, newUnlockKey, checker.Not(checker.Equals), unlockKey)
assert.Assert(c, newUnlockKey != "")
assert.Assert(c, newUnlockKey != unlockKey)
d2.RestartNode(c)
d3.RestartNode(c)
@ -1520,7 +1520,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateIssue27866(c *testing.T) {
out, err := d.Cmd("network", "inspect", "-f", "{{.Id}}", "ingress")
assert.NilError(c, err, "out: %v", out)
ingressID := strings.TrimSpace(out)
assert.Assert(c, ingressID, checker.Not(checker.Equals), "")
assert.Assert(c, ingressID != "")
// create a network of which name is the prefix of the ID of an overlay network
// (ingressID in this case)
@ -1833,7 +1833,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *testing.T) {
out, err := d1.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
assert.NilError(c, err, out)
networkID := strings.TrimSpace(out)
assert.Assert(c, networkID, checker.Not(checker.Equals), "")
assert.Assert(c, networkID != "")
// d1, d2 are managers that can get swarm events
waitForEvent(c, d1, "0", "-f scope=swarm", "network create "+networkID, defaultRetryCount)
@ -1877,7 +1877,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *testing.T) {
out, err = d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo")
assert.NilError(c, err, out)
networkID := strings.TrimSpace(out)
assert.Assert(c, networkID, checker.Not(checker.Equals), "")
assert.Assert(c, networkID != "")
// filter by service
out = waitForEvent(c, d, "0", "-f type=service", "service create "+serviceID, defaultRetryCount)
@ -1987,7 +1987,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *testing.T) {
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
assert.Assert(c, id != "", check.Commentf("secrets: %s", id))
waitForEvent(c, d, "0", "-f scope=swarm", "secret create "+id, defaultRetryCount)
@ -2007,7 +2007,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
},
Data: []byte("TESTINGDATA"),
})
assert.Assert(c, id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
assert.Assert(c, id != "", check.Commentf("configs: %s", id))
waitForEvent(c, d, "0", "-f scope=swarm", "config create "+id, defaultRetryCount)

View file

@ -476,11 +476,11 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
data1 := strings.TrimSpace(out)
assert.Assert(c, data1, checker.Not(checker.Equals), "")
assert.Assert(c, data1 != "")
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
data2 := strings.TrimSpace(out)
assert.Assert(c, data2, checker.Not(checker.Equals), "")
assert.Assert(c, data2 != "")
// Both volume should exist
out, _ = dockerCmd(c, "volume", "ls", "-q")
@ -518,11 +518,11 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
data1 := strings.TrimSpace(out)
assert.Assert(c, data1, checker.Not(checker.Equals), "")
assert.Assert(c, data1 != "")
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
data2 := strings.TrimSpace(out)
assert.Assert(c, data2, checker.Not(checker.Equals), "")
assert.Assert(c, data2 != "")
// Both volume should exist
out, _ = dockerCmd(c, "volume", "ls", "-q")
@ -562,11 +562,11 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *testing
out, _ := dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data1")
data1 := strings.TrimSpace(out)
assert.Assert(c, data1, checker.Not(checker.Equals), "")
assert.Assert(c, data1 != "")
out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "data2")
data2 := strings.TrimSpace(out)
assert.Assert(c, data2, checker.Not(checker.Equals), "")
assert.Assert(c, data2 != "")
// Both volume should exist
out, _ = dockerCmd(c, "volume", "ls", "-q")