|
@@ -69,7 +69,7 @@ func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// tag an image with an existed tag name without -f option should fail
|
|
|
|
|
|
+// tag an image with an existed tag name without -f option should work
|
|
func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
|
|
func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
|
|
testRequires(c, DaemonIsLinux)
|
|
testRequires(c, DaemonIsLinux)
|
|
if err := pullImageIfNotExist("busybox:latest"); err != nil {
|
|
if err := pullImageIfNotExist("busybox:latest"); err != nil {
|
|
@@ -77,10 +77,6 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
dockerCmd(c, "tag", "busybox:latest", "busybox:test")
|
|
dockerCmd(c, "tag", "busybox:latest", "busybox:test")
|
|
- out, _, err := dockerCmdWithError("tag", "busybox:latest", "busybox:test")
|
|
|
|
-
|
|
|
|
- c.Assert(err, checker.NotNil, check.Commentf(out))
|
|
|
|
- c.Assert(out, checker.Contains, "Conflict: Tag busybox:test is already set to image", check.Commentf("tag busybox busybox:test should have failed,because busybox:test is existed"))
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// tag an image with an existed tag name with -f option should work
|
|
// tag an image with an existed tag name with -f option should work
|
|
@@ -129,7 +125,7 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
for _, name := range names {
|
|
for _, name := range names {
|
|
- out, exitCode, err := dockerCmdWithError("tag", "-f", "busybox:latest", name+":latest")
|
|
|
|
|
|
+ out, exitCode, err := dockerCmdWithError("tag", "busybox:latest", name+":latest")
|
|
if err != nil || exitCode != 0 {
|
|
if err != nil || exitCode != 0 {
|
|
c.Errorf("tag busybox %v should have worked: %s, %s", name, err, out)
|
|
c.Errorf("tag busybox %v should have worked: %s, %s", name, err, out)
|
|
continue
|
|
continue
|
|
@@ -146,7 +142,7 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
for _, name := range names {
|
|
for _, name := range names {
|
|
- _, exitCode, err := dockerCmdWithError("tag", "-f", name+":latest", "fooo/bar:latest")
|
|
|
|
|
|
+ _, exitCode, err := dockerCmdWithError("tag", name+":latest", "fooo/bar:latest")
|
|
if err != nil || exitCode != 0 {
|
|
if err != nil || exitCode != 0 {
|
|
c.Errorf("tag %v fooo/bar should have worked: %s", name, err)
|
|
c.Errorf("tag %v fooo/bar should have worked: %s", name, err)
|
|
continue
|
|
continue
|
|
@@ -163,7 +159,7 @@ func (s *DockerSuite) TestTagMatchesDigest(c *check.C) {
|
|
}
|
|
}
|
|
digest := "busybox@sha256:abcdef76720241213f5303bda7704ec4c2ef75613173910a56fb1b6e20251507"
|
|
digest := "busybox@sha256:abcdef76720241213f5303bda7704ec4c2ef75613173910a56fb1b6e20251507"
|
|
// test setting tag fails
|
|
// test setting tag fails
|
|
- _, _, err := dockerCmdWithError("tag", "-f", "busybox:latest", digest)
|
|
|
|
|
|
+ _, _, err := dockerCmdWithError("tag", "busybox:latest", digest)
|
|
if err == nil {
|
|
if err == nil {
|
|
c.Fatal("digest tag a name should have failed")
|
|
c.Fatal("digest tag a name should have failed")
|
|
}
|
|
}
|
|
@@ -181,7 +177,7 @@ func (s *DockerSuite) TestTagInvalidRepoName(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
// test setting tag fails
|
|
// test setting tag fails
|
|
- _, _, err := dockerCmdWithError("tag", "-f", "busybox:latest", "sha256:sometag")
|
|
|
|
|
|
+ _, _, err := dockerCmdWithError("tag", "busybox:latest", "sha256:sometag")
|
|
if err == nil {
|
|
if err == nil {
|
|
c.Fatal("tagging with image named \"sha256\" should have failed")
|
|
c.Fatal("tagging with image named \"sha256\" should have failed")
|
|
}
|
|
}
|
|
@@ -214,7 +210,7 @@ func (s *DockerSuite) TestTagTruncationAmbiguity(c *check.C) {
|
|
c.Logf("Built image: %s", imageID)
|
|
c.Logf("Built image: %s", imageID)
|
|
|
|
|
|
// test setting tag fails
|
|
// test setting tag fails
|
|
- _, _, err = dockerCmdWithError("tag", "-f", "busybox:latest", truncatedTag)
|
|
|
|
|
|
+ _, _, err = dockerCmdWithError("tag", "busybox:latest", truncatedTag)
|
|
if err != nil {
|
|
if err != nil {
|
|
c.Fatalf("Error tagging with an image id: %s", err)
|
|
c.Fatalf("Error tagging with an image id: %s", err)
|
|
}
|
|
}
|