1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: fix TestPushMultipleTags

This test was meant to _push_ images, not _pull_ them

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-28 19:53:15 +02:00
parent 43ea03002f
commit 40b3edc81e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -80,15 +80,13 @@ func testPushMultipleTags(c *testing.T) {
repoTag2 := fmt.Sprintf("%v/dockercli/busybox:t2", privateRegistryURL) repoTag2 := fmt.Sprintf("%v/dockercli/busybox:t2", privateRegistryURL)
// tag the image and upload it to the private registry // tag the image and upload it to the private registry
dockerCmd(c, "tag", "busybox", repoTag1) dockerCmd(c, "tag", "busybox", repoTag1)
dockerCmd(c, "tag", "busybox", repoTag2) dockerCmd(c, "tag", "busybox", repoTag2)
dockerCmd(c, "push", repoName) dockerCmd(c, "push", repoName)
// Ensure layer list is equivalent for repoTag1 and repoTag2
out1, _ := dockerCmd(c, "pull", repoTag1)
imageAlreadyExists := ": Image already exists" imageAlreadyExists := ": Image already exists"
// Ensure layer list is equivalent for repoTag1 and repoTag2
out1, _ := dockerCmd(c, "push", repoTag1)
var out1Lines []string var out1Lines []string
for _, outputLine := range strings.Split(out1, "\n") { for _, outputLine := range strings.Split(out1, "\n") {
if strings.Contains(outputLine, imageAlreadyExists) { if strings.Contains(outputLine, imageAlreadyExists) {
@ -96,19 +94,14 @@ func testPushMultipleTags(c *testing.T) {
} }
} }
out2, _ := dockerCmd(c, "pull", repoTag2) out2, _ := dockerCmd(c, "push", repoTag2)
var out2Lines []string var out2Lines []string
for _, outputLine := range strings.Split(out2, "\n") { for _, outputLine := range strings.Split(out2, "\n") {
if strings.Contains(outputLine, imageAlreadyExists) { if strings.Contains(outputLine, imageAlreadyExists) {
out1Lines = append(out1Lines, outputLine) out2Lines = append(out2Lines, outputLine)
} }
} }
assert.Equal(c, len(out2Lines), len(out1Lines)) assert.DeepEqual(c, out1Lines, out2Lines)
for i := range out1Lines {
assert.Equal(c, out1Lines[i], out2Lines[i])
}
} }
func (s *DockerRegistrySuite) TestPushMultipleTags(c *testing.T) { func (s *DockerRegistrySuite) TestPushMultipleTags(c *testing.T) {