from a docker push output digest.DigestRegexp.FindString(output) does
not retrive the sha256: prefixed digest but just a string - in many
cases it's the registry host. The checks in the code are completely
wrong then. Fix this by using the DigestRegexp from the
distribution/reference package which correctly retrieves the digest
from the output.
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
"strings" |
| 13 | 13 |
"time" |
| 14 | 14 |
|
| 15 |
- "github.com/docker/distribution/digest" |
|
| 15 |
+ "github.com/docker/distribution/reference" |
|
| 16 | 16 |
"github.com/docker/docker/cliconfig" |
| 17 | 17 |
"github.com/docker/docker/pkg/integration/checker" |
| 18 | 18 |
"github.com/go-check/check" |
| ... | ... |
@@ -215,7 +215,7 @@ func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) {
|
| 215 | 215 |
// ensure that none of the layers were mounted from another repository during push |
| 216 | 216 |
c.Assert(strings.Contains(out1, "Mounted from"), check.Equals, false) |
| 217 | 217 |
|
| 218 |
- digest1 := digest.DigestRegexp.FindString(out1) |
|
| 218 |
+ digest1 := reference.DigestRegexp.FindString(out1) |
|
| 219 | 219 |
c.Assert(len(digest1), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
| 220 | 220 |
|
| 221 | 221 |
destRepoName := fmt.Sprintf("%v/dockercli/crossrepopush", privateRegistryURL)
|
| ... | ... |
@@ -227,7 +227,7 @@ func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) {
|
| 227 | 227 |
// ensure that layers were mounted from the first repo during push |
| 228 | 228 |
c.Assert(strings.Contains(out2, "Mounted from dockercli/busybox"), check.Equals, true) |
| 229 | 229 |
|
| 230 |
- digest2 := digest.DigestRegexp.FindString(out2) |
|
| 230 |
+ digest2 := reference.DigestRegexp.FindString(out2) |
|
| 231 | 231 |
c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
| 232 | 232 |
c.Assert(digest1, check.Equals, digest2) |
| 233 | 233 |
|
| ... | ... |
@@ -248,7 +248,7 @@ func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c |
| 248 | 248 |
// ensure that none of the layers were mounted from another repository during push |
| 249 | 249 |
c.Assert(strings.Contains(out1, "Mounted from"), check.Equals, false) |
| 250 | 250 |
|
| 251 |
- digest1 := digest.DigestRegexp.FindString(out1) |
|
| 251 |
+ digest1 := reference.DigestRegexp.FindString(out1) |
|
| 252 | 252 |
c.Assert(len(digest1), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
| 253 | 253 |
|
| 254 | 254 |
destRepoName := fmt.Sprintf("%v/dockercli/crossrepopush", privateRegistryURL)
|
| ... | ... |
@@ -260,9 +260,9 @@ func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c |
| 260 | 260 |
// schema1 registry should not support cross-repo layer mounts, so ensure that this does not happen |
| 261 | 261 |
c.Assert(strings.Contains(out2, "Mounted from"), check.Equals, false) |
| 262 | 262 |
|
| 263 |
- digest2 := digest.DigestRegexp.FindString(out2) |
|
| 263 |
+ digest2 := reference.DigestRegexp.FindString(out2) |
|
| 264 | 264 |
c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
| 265 |
- c.Assert(digest1, check.Equals, digest2) |
|
| 265 |
+ c.Assert(digest1, check.Not(check.Equals), digest2) |
|
| 266 | 266 |
|
| 267 | 267 |
// ensure that we can pull and run the second pushed repository |
| 268 | 268 |
dockerCmd(c, "rmi", destRepoName) |