Browse code

Another try to fix InspectExecID

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2015/08/04 20:08:30
Showing 1 changed files
... ...
@@ -316,9 +316,9 @@ func (s *DockerSuite) TestInspectExecID(c *check.C) {
316 316
 		c.Fatalf("ExecIDs should be empty, got: %s", out)
317 317
 	}
318 318
 
319
-	// Start an exec, have it block waiting for input so we can do some checking
320
-	cmd := exec.Command(dockerBinary, "exec", "-i", id, "sh", "-c", "read a")
321
-	execStdin, _ := cmd.StdinPipe()
319
+	// Start an exec, have it block waiting so we can do some checking
320
+	cmd := exec.Command(dockerBinary, "exec", id, "sh", "-c",
321
+		"while ! test -e /tmp/execid1; do sleep 1; done")
322 322
 
323 323
 	if err = cmd.Start(); err != nil {
324 324
 		c.Fatalf("failed to start the exec cmd: %q", err)
... ...
@@ -349,8 +349,15 @@ func (s *DockerSuite) TestInspectExecID(c *check.C) {
349 349
 		c.Fatalf("failed to get the exec id: %v", err)
350 350
 	}
351 351
 
352
-	// End the exec by closing its stdin, and wait for it to end
353
-	execStdin.Close()
352
+	// End the exec by creating the missing file
353
+	err = exec.Command(dockerBinary, "exec", id,
354
+		"sh", "-c", "touch /tmp/execid1").Run()
355
+
356
+	if err != nil {
357
+		c.Fatalf("failed to run the 2nd exec cmd: %q", err)
358
+	}
359
+
360
+	// Wait for 1st exec to complete
354 361
 	cmd.Wait()
355 362
 
356 363
 	// All execs for the container should be gone now