浏览代码

Test for issue #9699

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Alexandr Morozov 10 年之前
父节点
当前提交
eda92e8834
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      integration-cli/docker_cli_exec_test.go

+ 25 - 0
integration-cli/docker_cli_exec_test.go

@@ -367,3 +367,28 @@ func TestExecParseError(t *testing.T) {
 	}
 	logDone("exec - error on parseExec should return usage")
 }
+
+func TestExecStopNotHanging(t *testing.T) {
+	defer deleteAllContainers()
+	if out, err := exec.Command(dockerBinary, "run", "-d", "--name", "testing", "busybox", "top").CombinedOutput(); err != nil {
+		t.Fatal(out, err)
+	}
+
+	if err := exec.Command(dockerBinary, "exec", "testing", "top").Start(); err != nil {
+		t.Fatal(err)
+	}
+
+	wait := make(chan struct{})
+	go func() {
+		if out, err := exec.Command(dockerBinary, "stop", "testing").CombinedOutput(); err != nil {
+			t.Fatal(out, err)
+		}
+		close(wait)
+	}()
+	select {
+	case <-time.After(3 * time.Second):
+		t.Fatal("Container stop timed out")
+	case <-wait:
+	}
+	logDone("exec - container with exec not hanging on stop")
+}