mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 13:41:36 +00:00
Use distribution's ValidateRepositoryName for remote name validation.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
This commit is contained in:
@@ -111,20 +111,20 @@ func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestTagWithSuffixHyphen(c *check.C) {
|
||||
func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
|
||||
if err := pullImageIfNotExist("busybox:latest"); err != nil {
|
||||
c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
|
||||
}
|
||||
// test repository name begin with '-'
|
||||
tagCmd := exec.Command(dockerBinary, "tag", "busybox:latest", "-busybox:test")
|
||||
out, _, err := runCommandWithOutput(tagCmd)
|
||||
if err == nil || !strings.Contains(out, "Invalid repository name (-busybox). Cannot begin or end with a hyphen") {
|
||||
if err == nil || !strings.Contains(out, "repository name component must match") {
|
||||
c.Fatal("tag a name begin with '-' should failed")
|
||||
}
|
||||
// test namespace name begin with '-'
|
||||
tagCmd = exec.Command(dockerBinary, "tag", "busybox:latest", "-test/busybox:test")
|
||||
out, _, err = runCommandWithOutput(tagCmd)
|
||||
if err == nil || !strings.Contains(out, "Invalid namespace name (-test). Cannot begin or end with a hyphen") {
|
||||
if err == nil || !strings.Contains(out, "repository name component must match") {
|
||||
c.Fatal("tag a name begin with '-' should failed")
|
||||
}
|
||||
// test index name begin wiht '-'
|
||||
|
||||
Reference in New Issue
Block a user