Fixes #18093
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -4614,7 +4614,7 @@ func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
| 4614 | 4614 |
_, out, err := buildImageWithOut(name, "FROM scratch\nMAINTAINER quux\n", true) |
| 4615 | 4615 |
// if the error doesn't check for illegal tag name, or the image is built |
| 4616 | 4616 |
// then this should fail |
| 4617 |
- if !strings.Contains(out, "invalid reference format") || strings.Contains(out, "Sending build context to Docker daemon") {
|
|
| 4617 |
+ if !strings.Contains(out, "Error parsing reference") || strings.Contains(out, "Sending build context to Docker daemon") {
|
|
| 4618 | 4618 |
c.Fatalf("failed to stop before building. Error: %s, Output: %s", err, out)
|
| 4619 | 4619 |
} |
| 4620 | 4620 |
} |
| ... | ... |
@@ -265,7 +265,7 @@ func (s *DockerSuite) TestCreateByImageID(c *check.C) {
|
| 265 | 265 |
c.Fatalf("expected non-zero exit code; received %d", exit)
|
| 266 | 266 |
} |
| 267 | 267 |
|
| 268 |
- if expected := "invalid reference format"; !strings.Contains(out, expected) {
|
|
| 268 |
+ if expected := "Error parsing reference"; !strings.Contains(out, expected) {
|
|
| 269 | 269 |
c.Fatalf(`Expected %q in output; got: %s`, expected, out) |
| 270 | 270 |
} |
| 271 | 271 |
|
| ... | ... |
@@ -3758,8 +3758,8 @@ func (s *DockerSuite) TestRunInvalidReference(c *check.C) {
|
| 3758 | 3758 |
c.Fatalf("expected non-zero exist code; received %d", exit)
|
| 3759 | 3759 |
} |
| 3760 | 3760 |
|
| 3761 |
- if !strings.Contains(out, "invalid reference format") {
|
|
| 3762 |
- c.Fatalf(`Expected "invalid reference format" in output; got: %s`, out) |
|
| 3761 |
+ if !strings.Contains(out, "Error parsing reference") {
|
|
| 3762 |
+ c.Fatalf(`Expected "Error parsing reference" in output; got: %s`, out) |
|
| 3763 | 3763 |
} |
| 3764 | 3764 |
} |
| 3765 | 3765 |
|
| ... | ... |
@@ -99,17 +99,17 @@ func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
|
| 99 | 99 |
// test repository name begin with '-' |
| 100 | 100 |
out, _, err := dockerCmdWithError("tag", "busybox:latest", "-busybox:test")
|
| 101 | 101 |
c.Assert(err, checker.NotNil, check.Commentf(out)) |
| 102 |
- c.Assert(out, checker.Contains, "invalid reference format", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 102 |
+ c.Assert(out, checker.Contains, "Error parsing reference", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 103 | 103 |
|
| 104 | 104 |
// test namespace name begin with '-' |
| 105 | 105 |
out, _, err = dockerCmdWithError("tag", "busybox:latest", "-test/busybox:test")
|
| 106 | 106 |
c.Assert(err, checker.NotNil, check.Commentf(out)) |
| 107 |
- c.Assert(out, checker.Contains, "invalid reference format", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 107 |
+ c.Assert(out, checker.Contains, "Error parsing reference", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 108 | 108 |
|
| 109 | 109 |
// test index name begin with '-' |
| 110 | 110 |
out, _, err = dockerCmdWithError("tag", "busybox:latest", "-index:5000/busybox:test")
|
| 111 | 111 |
c.Assert(err, checker.NotNil, check.Commentf(out)) |
| 112 |
- c.Assert(out, checker.Contains, "invalid reference format", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 112 |
+ c.Assert(out, checker.Contains, "Error parsing reference", check.Commentf("tag a name begin with '-' should failed"))
|
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
// ensure tagging using official names works |
| ... | ... |
@@ -54,7 +54,7 @@ type Canonical interface {
|
| 54 | 54 |
func ParseNamed(s string) (Named, error) {
|
| 55 | 55 |
named, err := distreference.ParseNamed(s) |
| 56 | 56 |
if err != nil {
|
| 57 |
- return nil, err |
|
| 57 |
+ return nil, fmt.Errorf("Error parsing reference: %q is not a valid repository/tag", s)
|
|
| 58 | 58 |
} |
| 59 | 59 |
r, err := WithName(named.Name()) |
| 60 | 60 |
if err != nil {
|