mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #18215 from mountkin/test-for-18181
add a test to make sure port is allowed in images filter
This commit is contained in:
commit
1beb450fa6
1 changed files with 24 additions and 12 deletions
|
@ -20,24 +20,22 @@ func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
|
|||
|
||||
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
_, err := buildImage("imagewithtag:v1",
|
||||
`FROM scratch
|
||||
MAINTAINER dockerio1`, true)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
_, err = buildImage("imagewithtag:v2",
|
||||
`FROM scratch
|
||||
MAINTAINER dockerio1`, true)
|
||||
c.Assert(err, check.IsNil)
|
||||
name := "imagewithtag"
|
||||
dockerCmd(c, "tag", "busybox", name+":v1")
|
||||
dockerCmd(c, "tag", "busybox", name+":v1v1")
|
||||
dockerCmd(c, "tag", "busybox", name+":v2")
|
||||
|
||||
imagesOut, _ := dockerCmd(c, "images", "imagewithtag:v1")
|
||||
c.Assert(imagesOut, checker.Contains, "imagewithtag")
|
||||
imagesOut, _ := dockerCmd(c, "images", name+":v1")
|
||||
c.Assert(imagesOut, checker.Contains, name)
|
||||
c.Assert(imagesOut, checker.Contains, "v1")
|
||||
c.Assert(imagesOut, checker.Not(checker.Contains), "v2")
|
||||
c.Assert(imagesOut, checker.Not(checker.Contains), "v1v1")
|
||||
|
||||
imagesOut, _ = dockerCmd(c, "images", "imagewithtag")
|
||||
c.Assert(imagesOut, checker.Contains, "imagewithtag")
|
||||
imagesOut, _ = dockerCmd(c, "images", name)
|
||||
c.Assert(imagesOut, checker.Contains, name)
|
||||
c.Assert(imagesOut, checker.Contains, "v1")
|
||||
c.Assert(imagesOut, checker.Contains, "v1v1")
|
||||
c.Assert(imagesOut, checker.Contains, "v2")
|
||||
}
|
||||
|
||||
|
@ -221,3 +219,17 @@ func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) {
|
|||
// images should contain images built from scratch
|
||||
c.Assert(out, checker.Contains, stringid.TruncateID(id))
|
||||
}
|
||||
|
||||
// #18181
|
||||
func (s *DockerSuite) TestImagesFilterNameWithPort(c *check.C) {
|
||||
tag := "a.b.c.d:5000/hello"
|
||||
dockerCmd(c, "tag", "busybox", tag)
|
||||
out, _ := dockerCmd(c, "images", tag)
|
||||
c.Assert(out, checker.Contains, tag)
|
||||
|
||||
out, _ = dockerCmd(c, "images", tag+":latest")
|
||||
c.Assert(out, checker.Contains, tag)
|
||||
|
||||
out, _ = dockerCmd(c, "images", tag+":no-such-tag")
|
||||
c.Assert(out, checker.Not(checker.Contains), tag)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue