Browse code

Wait until all pushes are done in TestPushInterrupt

Background pushes affects other tests

Signed-off-by: Alexander Morozov <lk4d4@docker.com>

Alexander Morozov authored on 2015/04/22 13:58:16
Showing 1 changed files
... ...
@@ -92,11 +92,9 @@ func (s *DockerSuite) TestPushMultipleTags(c *check.C) {
92 92
 
93 93
 func (s *DockerSuite) TestPushInterrupt(c *check.C) {
94 94
 	defer setupRegistry(c)()
95
-
96 95
 	repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
97 96
 	// tag the image to upload it tot he private registry
98
-	tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
99
-	if out, _, err := runCommandWithOutput(tagCmd); err != nil {
97
+	if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "tag", "busybox", repoName)); err != nil {
100 98
 		c.Fatalf("image tagging failed: %s, %v", out, err)
101 99
 	}
102 100
 	defer deleteImages(repoName)
... ...
@@ -111,14 +109,17 @@ func (s *DockerSuite) TestPushInterrupt(c *check.C) {
111 111
 	if err := pushCmd.Process.Kill(); err != nil {
112 112
 		c.Fatalf("Failed to kill push process: %v", err)
113 113
 	}
114
-	// Try agin
115
-	pushCmd = exec.Command(dockerBinary, "push", repoName)
116
-	if out, err := pushCmd.CombinedOutput(); err == nil {
114
+	if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "push", repoName)); err == nil {
117 115
 		str := string(out)
118 116
 		if !strings.Contains(str, "already in progress") {
119 117
 			c.Fatalf("Push should be continued on daemon side, but seems ok: %v, %s", err, out)
120 118
 		}
121 119
 	}
120
+	// now wait until all this pushes will complete
121
+	// if it will fail with timeout - this is some error, so no logic about it
122
+	// here
123
+	for exec.Command(dockerBinary, "push", repoName).Run() != nil {
124
+	}
122 125
 }
123 126
 
124 127
 func (s *DockerSuite) TestPushEmptyLayer(c *check.C) {