mirror of
https://github.com/docker/docs.git
synced 2026-04-05 02:38:52 +07:00
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:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user