Browse code

Update regression test

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>

Arnaud Porterie authored on 2015/08/13 10:36:46
Showing 1 changed files
... ...
@@ -61,6 +61,40 @@ func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) {
61 61
 	dockerCmd(c, "tag", "busybox", repoTag2)
62 62
 
63 63
 	dockerCmd(c, "push", repoName)
64
+
65
+	// Ensure layer list is equivalent for repoTag1 and repoTag2
66
+	out1, _ := dockerCmd(c, "pull", repoTag1)
67
+	if strings.Contains(out1, "Tag t1 not found") {
68
+		c.Fatalf("Unable to pull pushed image: %s", out1)
69
+	}
70
+	imageAlreadyExists := ": Image already exists"
71
+	var out1Lines []string
72
+	for _, outputLine := range strings.Split(out1, "\n") {
73
+		if strings.Contains(outputLine, imageAlreadyExists) {
74
+			out1Lines = append(out1Lines, outputLine)
75
+		}
76
+	}
77
+
78
+	out2, _ := dockerCmd(c, "pull", repoTag2)
79
+	if strings.Contains(out2, "Tag t2 not found") {
80
+		c.Fatalf("Unable to pull pushed image: %s", out1)
81
+	}
82
+	var out2Lines []string
83
+	for _, outputLine := range strings.Split(out2, "\n") {
84
+		if strings.Contains(outputLine, imageAlreadyExists) {
85
+			out1Lines = append(out1Lines, outputLine)
86
+		}
87
+	}
88
+
89
+	if len(out1Lines) != len(out2Lines) {
90
+		c.Fatalf("Mismatched output length:\n%s\n%s", out1, out2)
91
+	}
92
+
93
+	for i := range out1Lines {
94
+		if out1Lines[i] != out2Lines[i] {
95
+			c.Fatalf("Mismatched output line:\n%s\n%s", out1Lines[i], out2Lines[i])
96
+		}
97
+	}
64 98
 }
65 99
 
66 100
 func (s *DockerRegistrySuite) TestPushInterrupt(c *check.C) {