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

rm-gocheck: Not(IsNil) -> != nil

sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.IsNil\)#assert.Assert(c, \1 != nil#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_volume_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 74747b35e1)
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 c8da7fbd25
commit fa8d7029a7
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 9 additions and 9 deletions

View file

@ -215,7 +215,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *testing.T) {
// Now remove without `-f` and make sure we are still pulling stats
_, _, err = dockerCmdWithError("rm", id)
assert.Assert(c, err, checker.Not(checker.IsNil), check.Commentf("rm should have failed but didn't"))
assert.Assert(c, err != nil, check.Commentf("rm should have failed but didn't"))
_, err = buf.ReadTimeout(b, 2*time.Second)
assert.NilError(c, err)

View file

@ -324,11 +324,11 @@ func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
runSleepingContainer(c, "--name=container1", "-d")
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='Format container: {{.ThisDoesNotExist}}'", "container1")
assert.Assert(c, err, checker.Not(checker.IsNil))
assert.Assert(c, err != nil)
assert.Assert(c, out, checker.Contains, "Template parsing error")
out, _, err = dockerCmdWithError("inspect", "--type=image", "--format='Format container: {{.ThisDoesNotExist}}'", "busybox")
assert.Assert(c, err, checker.Not(checker.IsNil))
assert.Assert(c, err != nil)
assert.Assert(c, out, checker.Contains, "Template parsing error")
}
@ -356,7 +356,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
runSleepingContainer(c, "--name=busybox2", "-d")
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
assert.Assert(c, result.Error, checker.Not(checker.IsNil))
assert.Assert(c, result.Error != nil)
assert.Assert(c, result.Stdout(), checker.Contains, "busybox1")
assert.Assert(c, result.Stdout(), checker.Contains, "busybox2")
assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing")
@ -364,7 +364,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
// test inspect would not fast fail
result = dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "missing", "busybox1", "busybox2")
assert.Assert(c, result.Error, checker.Not(checker.IsNil))
assert.Assert(c, result.Error != nil)
assert.Assert(c, result.Stdout(), checker.Contains, "busybox1")
assert.Assert(c, result.Stdout(), checker.Contains, "busybox2")
assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing")

View file

@ -88,7 +88,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *testing.T) {
assert.Equal(c, len(refs), 1)
assert.Assert(c, refs[0].SecretName, checker.Equals, testName)
assert.Assert(c, refs[0].File, checker.Not(checker.IsNil))
assert.Assert(c, refs[0].File != nil)
assert.Assert(c, refs[0].File.Name, checker.Equals, testName)
assert.Assert(c, refs[0].File.UID, checker.Equals, "0")
assert.Assert(c, refs[0].File.GID, checker.Equals, "0")
@ -236,7 +236,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *testing.T) {
assert.Equal(c, len(refs), 1)
assert.Assert(c, refs[0].ConfigName, checker.Equals, testName)
assert.Assert(c, refs[0].File, checker.Not(checker.IsNil))
assert.Assert(c, refs[0].File != nil)
assert.Assert(c, refs[0].File.Name, checker.Equals, testName)
assert.Assert(c, refs[0].File.UID, checker.Equals, "0")
assert.Assert(c, refs[0].File.GID, checker.Equals, "0")

View file

@ -37,7 +37,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) {
}
func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) {
assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), checker.Not(checker.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run() != nil, check.Commentf("volume inspect should error on non-existent volume"))
out, _ := dockerCmd(c, "volume", "create")
name := strings.TrimSpace(out)
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name)
@ -210,7 +210,7 @@ func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
dockerCmd(c, "rm", "test2")
dockerCmd(c, "volume", "rm", volumeID)
assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run(), checker.Not(checker.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run() != nil, check.Commentf("volume rm should fail with non-existent volume"))
}
// FIXME(vdemeester) should be a unit test in cli/command/volume package