Use RepoTags & RepoDigest in inspect

To be coherent with /images/json (images command)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2015-10-22 12:34:12 +02:00
parent 48fe12af0c
commit f664f6e4b1
7 changed files with 46 additions and 10 deletions

View File

@@ -128,10 +128,10 @@ func (s *DockerSuite) TestInspectApiImageResponse(c *check.C) {
c.Fatalf("unable to unmarshal body for latest version: %v", err)
}
c.Assert(len(imageJSON.Tags), check.Equals, 2)
c.Assert(len(imageJSON.RepoTags), check.Equals, 2)
c.Assert(stringutils.InSlice(imageJSON.Tags, "busybox:latest"), check.Equals, true)
c.Assert(stringutils.InSlice(imageJSON.Tags, "busybox:mytag"), check.Equals, true)
c.Assert(stringutils.InSlice(imageJSON.RepoTags, "busybox:latest"), check.Equals, true)
c.Assert(stringutils.InSlice(imageJSON.RepoTags, "busybox:mytag"), check.Equals, true)
}
// #17131, #17139, #17173

View File

@@ -8,6 +8,8 @@ import (
"github.com/docker/distribution/digest"
"github.com/docker/distribution/manifest"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringutils"
"github.com/docker/docker/utils"
"github.com/go-check/check"
)
@@ -390,6 +392,27 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
}
}
func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) {
digest, err := setupImage(c)
c.Assert(err, check.IsNil, check.Commentf("error setting up image: %v", err))
imageReference := fmt.Sprintf("%s@%s", repoName, digest)
// pull from the registry using the <name>@<digest> reference
dockerCmd(c, "pull", imageReference)
out, _ := dockerCmd(c, "inspect", imageReference)
var imageJSON []types.ImageInspect
if err = json.Unmarshal([]byte(out), &imageJSON); err != nil {
c.Fatalf("unable to unmarshal body for latest version: %v", err)
}
c.Assert(len(imageJSON), check.Equals, 1)
c.Assert(len(imageJSON[0].RepoDigests), check.Equals, 1)
c.Assert(stringutils.InSlice(imageJSON[0].RepoDigests, imageReference), check.Equals, true)
}
func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c *check.C) {
digest, err := setupImage(c)
c.Assert(err, check.IsNil, check.Commentf("error setting up image: %v", err))