소스 검색

rm-gocheck: True

sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.True#assert.Assert(c, \1#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_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_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_service_create_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit d0fc8d082dc033b3fed31dfa59fd327ce4c61923)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Tibor Vass 5 년 전
부모
커밋
7696045c1d

+ 4 - 4
integration-cli/docker_api_containers_test.go

@@ -121,7 +121,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
 			break
 		}
 	}
-	assert.Assert(c, found, checker.True, check.Commentf("The created test file has not been found in the exported image"))
+	assert.Assert(c, found, check.Commentf("The created test file has not been found in the exported image"))
 }
 
 func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
@@ -144,7 +144,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
 			success = true
 		}
 	}
-	assert.Assert(c, success, checker.True, check.Commentf("/etc/passwd has been removed but is not present in the diff"))
+	assert.Assert(c, success, check.Commentf("/etc/passwd has been removed but is not present in the diff"))
 }
 
 func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
@@ -1044,7 +1044,7 @@ func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) {
 			break
 		}
 	}
-	assert.Assert(c, found, checker.True)
+	assert.Assert(c, found)
 }
 
 func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
@@ -1219,7 +1219,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
 	assert.NilError(c, err)
 
 	_, err = os.Stat(source)
-	assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("expected to get ErrNotExist error, got %v", err))
+	assert.Assert(c, os.IsNotExist(err), check.Commentf("expected to get ErrNotExist error, got %v", err))
 }
 
 // Regression test for https://github.com/docker/docker/issues/6231

+ 1 - 1
integration-cli/docker_cli_build_test.go

@@ -4741,7 +4741,7 @@ func (s *DockerSuite) TestBuildTagEvent(c *testing.T) {
 		}
 	}
 
-	assert.Assert(c, foundTag, checker.True, check.Commentf("No tag event found:\n%s", out))
+	assert.Assert(c, foundTag, check.Commentf("No tag event found:\n%s", out))
 }
 
 // #15780

+ 16 - 16
integration-cli/docker_cli_by_digest_test.go

@@ -253,7 +253,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
 
 	// make sure repo shown, tag=<none>, digest = $digest1
 	re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`)
-	assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
+	assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
 	// setup image2
 	digest2, err := setupImageWithTag(c, "tag2")
 	//error setting up image
@@ -271,11 +271,11 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
 	out, _ = dockerCmd(c, "images", "--digests")
 
 	// make sure repo shown, tag=<none>, digest = $digest1
-	assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
+	assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
 
 	// make sure repo shown, tag=<none>, digest = $digest2
 	re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`)
-	assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
+	assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
 
 	// pull tag1
 	dockerCmd(c, "pull", repoName+":tag1")
@@ -285,9 +285,9 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
 
 	// make sure image 1 has repo, tag, <none> AND repo, <none>, digest
 	reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*tag1\s*` + digest1.String() + `\s`)
-	assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
+	assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
 	// make sure image 2 has repo, <none>, digest
-	assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
+	assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
 
 	// pull tag 2
 	dockerCmd(c, "pull", repoName+":tag2")
@@ -296,22 +296,22 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
 	out, _ = dockerCmd(c, "images", "--digests")
 
 	// make sure image 1 has repo, tag, digest
-	assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
+	assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
 
 	// make sure image 2 has repo, tag, digest
 	reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*tag2\s*` + digest2.String() + `\s`)
-	assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
+	assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
 
 	// list images
 	out, _ = dockerCmd(c, "images", "--digests")
 
 	// make sure image 1 has repo, tag, digest
-	assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
+	assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
 	// make sure image 2 has repo, tag, digest
-	assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
+	assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
 	// make sure busybox has tag, but not digest
 	busyboxRe := regexp.MustCompile(`\s*busybox\s*latest\s*<none>\s`)
-	assert.Assert(c, busyboxRe.MatchString(out), checker.True, check.Commentf("expected %q: %s", busyboxRe.String(), out))
+	assert.Assert(c, busyboxRe.MatchString(out), check.Commentf("expected %q: %s", busyboxRe.String(), out))
 }
 
 func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
@@ -329,7 +329,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
 
 	// make sure repo shown, tag=<none>, digest = $digest1
 	re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`)
-	assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
+	assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
 	// setup image2
 	digest2, err := setupImageWithTag(c, "dangle2")
 	//error setting up image
@@ -347,11 +347,11 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
 	out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true")
 
 	// make sure repo shown, tag=<none>, digest = $digest1
-	assert.Assert(c, re1.MatchString(out), checker.True, check.Commentf("expected %q: %s", re1.String(), out))
+	assert.Assert(c, re1.MatchString(out), check.Commentf("expected %q: %s", re1.String(), out))
 
 	// make sure repo shown, tag=<none>, digest = $digest2
 	re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`)
-	assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
+	assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
 
 	// pull dangle1 tag
 	dockerCmd(c, "pull", repoName+":dangle1")
@@ -363,7 +363,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
 	reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*dangle1\s*` + digest1.String() + `\s`)
 	assert.Assert(c, !reWithDigest1.MatchString(out), check.Commentf("unexpected %q: %s", reWithDigest1.String(), out))
 	// make sure image 2 has repo, <none>, digest
-	assert.Assert(c, re2.MatchString(out), checker.True, check.Commentf("expected %q: %s", re2.String(), out))
+	assert.Assert(c, re2.MatchString(out), check.Commentf("expected %q: %s", re2.String(), out))
 
 	// pull dangle2 tag
 	dockerCmd(c, "pull", repoName+":dangle2")
@@ -372,11 +372,11 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
 	out, _ = dockerCmd(c, "images", "--digests")
 
 	// make sure image 1 has repo, tag, digest
-	assert.Assert(c, reWithDigest1.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest1.String(), out))
+	assert.Assert(c, reWithDigest1.MatchString(out), check.Commentf("expected %q: %s", reWithDigest1.String(), out))
 
 	// make sure image 2 has repo, tag, digest
 	reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*dangle2\s*` + digest2.String() + `\s`)
-	assert.Assert(c, reWithDigest2.MatchString(out), checker.True, check.Commentf("expected %q: %s", reWithDigest2.String(), out))
+	assert.Assert(c, reWithDigest2.MatchString(out), check.Commentf("expected %q: %s", reWithDigest2.String(), out))
 
 	// list images, no longer dangling, should not match
 	out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true")

+ 4 - 4
integration-cli/docker_cli_cp_from_container_test.go

@@ -150,7 +150,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *testing.T) {
 	err := runDockerCp(c, srcPath, dstDir, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
+	assert.Assert(c, isCpDirNotExist(err), check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
 }
 
 // C. SRC specifies a file and DST exists as a file. This should overwrite
@@ -195,7 +195,7 @@ func (s *DockerSuite) TestCpFromCaseD(c *testing.T) {
 
 	// Ensure that dstPath doesn't exist.
 	_, err := os.Stat(dstPath)
-	assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("did not expect dstPath %q to exist", dstPath))
+	assert.Assert(c, os.IsNotExist(err), check.Commentf("did not expect dstPath %q to exist", dstPath))
 
 	assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil) == nil)
 
@@ -266,7 +266,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *testing.T) {
 	err := runDockerCp(c, srcDir, dstFile, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
 
 // G. SRC specifies a directory and DST exists as a directory. This should copy
@@ -358,7 +358,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *testing.T) {
 	err := runDockerCp(c, srcDir, dstFile, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
 
 // J. SRC specifies a directory's contents only and DST exists as a directory.

+ 5 - 5
integration-cli/docker_cli_cp_to_container_test.go

@@ -158,7 +158,7 @@ func (s *DockerSuite) TestCpToCaseB(c *testing.T) {
 	err := runDockerCp(c, srcPath, dstDir, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
+	assert.Assert(c, isCpDirNotExist(err), check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
 }
 
 // C. SRC specifies a file and DST exists as a file. This should overwrite
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestCpToCaseF(c *testing.T) {
 	err := runDockerCp(c, srcDir, dstFile, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
 
 // G. SRC specifies a directory and DST exists as a directory. This should copy
@@ -393,7 +393,7 @@ func (s *DockerSuite) TestCpToCaseI(c *testing.T) {
 	err := runDockerCp(c, srcDir, dstFile, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyDir(err), check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
 
 // J. SRC specifies a directory's contents only and DST exists as a directory.
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
 	err := runDockerCp(c, srcPath, dstPath, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyReadOnly(err), check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
 
 	// Ensure that dstPath doesn't exist.
 	assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil)
@@ -489,7 +489,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
 	err := runDockerCp(c, srcPath, dstPath, nil)
 	assert.ErrorContains(c, err, "")
 
-	assert.Assert(c, isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
+	assert.Assert(c, isCpCannotCopyReadOnly(err), check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
 
 	// Ensure that dstPath doesn't exist.
 	assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil)

+ 1 - 1
integration-cli/docker_cli_create_test.go

@@ -101,7 +101,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
 
 	cont := containers[0]
 	assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
-	assert.Assert(c, cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false"))
+	assert.Assert(c, cont.HostConfig.PublishAllPorts, check.Commentf("Expected PublishAllPorts, got false"))
 }
 
 func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {

+ 4 - 4
integration-cli/docker_cli_daemon_test.go

@@ -1866,7 +1866,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) {
 			break
 		}
 	}
-	assert.Assert(c, found, checker.True, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
+	assert.Assert(c, found, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths))
 }
 
 func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
@@ -2845,7 +2845,7 @@ func (s *DockerDaemonSuite) TestShmSize(c *testing.T) {
 	name := "shm1"
 	out, err := s.d.Cmd("run", "--name", name, "busybox", "mount")
 	assert.NilError(c, err, "Output: %s", out)
-	assert.Assert(c, pattern.MatchString(out), checker.True)
+	assert.Assert(c, pattern.MatchString(out))
 	out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
 	assert.NilError(c, err, "Output: %s", out)
 	assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%v", size))
@@ -2869,7 +2869,7 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
 	name := "shm1"
 	out, err := s.d.Cmd("run", "--name", name, "busybox", "mount")
 	assert.NilError(c, err, "Output: %s", out)
-	assert.Assert(c, pattern.MatchString(out), checker.True)
+	assert.Assert(c, pattern.MatchString(out))
 	out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
 	assert.NilError(c, err, "Output: %s", out)
 	assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%v", size))
@@ -2885,7 +2885,7 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
 	name = "shm2"
 	out, err = s.d.Cmd("run", "--name", name, "busybox", "mount")
 	assert.NilError(c, err, "Output: %s", out)
-	assert.Assert(c, pattern.MatchString(out), checker.True)
+	assert.Assert(c, pattern.MatchString(out))
 	out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
 	assert.NilError(c, err, "Output: %s", out)
 	assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%v", size))

+ 1 - 1
integration-cli/docker_cli_external_volume_driver_unix_test.go

@@ -308,7 +308,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *testing.T)
 	p := hostVolumePath("external-volume-test")
 	_, err = os.Lstat(p)
 	assert.ErrorContains(c, err, "")
-	assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
+	assert.Assert(c, os.IsNotExist(err), check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
 
 	assert.Equal(c, s.ec.activations, 1)
 	assert.Equal(c, s.ec.creations, 1)

+ 1 - 1
integration-cli/docker_cli_network_unix_test.go

@@ -1619,7 +1619,7 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) {
 	dockerCmd(c, "network", "create", "--driver=bridge", "--internal", "internal")
 	assertNwIsAvailable(c, "internal")
 	nr := getNetworkResource(c, "internal")
-	assert.Assert(c, nr.Internal, checker.True)
+	assert.Assert(c, nr.Internal)
 
 	dockerCmd(c, "run", "-d", "--net=internal", "--name=first", "busybox:glibc", "top")
 	assert.Assert(c, waitRun("first") == nil)

+ 1 - 1
integration-cli/docker_cli_plugins_test.go

@@ -458,7 +458,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
 
 	// make sure "v2" does not exists
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
-	assert.Assert(c, os.IsNotExist(err), checker.True, check.Commentf("%s", out))
+	assert.Assert(c, os.IsNotExist(err), check.Commentf("%s", out))
 
 	dockerCmd(c, "plugin", "disable", "-f", plugin)
 	dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)

+ 1 - 1
integration-cli/docker_cli_service_create_test.go

@@ -48,7 +48,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
 	assert.Equal(c, mountConfig[0].Target, "/foo")
 	assert.Equal(c, mountConfig[0].Type, mount.TypeVolume)
 	assert.Assert(c, mountConfig[0].VolumeOptions != nil)
-	assert.Assert(c, mountConfig[0].VolumeOptions.NoCopy, checker.True)
+	assert.Assert(c, mountConfig[0].VolumeOptions.NoCopy)
 
 	// check container mounts actual
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)