Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -11,11 +11,10 @@ import ( |
| 11 | 11 |
|
| 12 | 12 |
// non-blocking wait with 0 exit code |
| 13 | 13 |
func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {
|
| 14 |
- testRequires(c, DaemonIsLinux) |
|
| 15 | 14 |
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "true") |
| 16 | 15 |
containerID := strings.TrimSpace(out) |
| 17 | 16 |
|
| 18 |
- if err := waitInspect(containerID, "{{.State.Running}}", "false", 1*time.Second); err != nil {
|
|
| 17 |
+ if err := waitInspect(containerID, "{{.State.Running}}", "false", 30*time.Second); err != nil {
|
|
| 19 | 18 |
c.Fatal("Container should have stopped by now")
|
| 20 | 19 |
} |
| 21 | 20 |
|
| ... | ... |
@@ -28,8 +27,10 @@ func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {
|
| 28 | 28 |
|
| 29 | 29 |
// blocking wait with 0 exit code |
| 30 | 30 |
func (s *DockerSuite) TestWaitBlockedExitZero(c *check.C) {
|
| 31 |
+ // Windows busybox does not support trap in this way, not sleep with sub-second |
|
| 32 |
+ // granularity. It will always exit 0x40010004. |
|
| 31 | 33 |
testRequires(c, DaemonIsLinux) |
| 32 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 0' TERM; while true; do sleep 0.01; done") |
|
| 34 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 0' TERM; while true; do usleep 10; done") |
|
| 33 | 35 |
containerID := strings.TrimSpace(out) |
| 34 | 36 |
|
| 35 | 37 |
c.Assert(waitRun(containerID), check.IsNil) |
| ... | ... |
@@ -56,11 +57,10 @@ func (s *DockerSuite) TestWaitBlockedExitZero(c *check.C) {
|
| 56 | 56 |
|
| 57 | 57 |
// non-blocking wait with random exit code |
| 58 | 58 |
func (s *DockerSuite) TestWaitNonBlockedExitRandom(c *check.C) {
|
| 59 |
- testRequires(c, DaemonIsLinux) |
|
| 60 | 59 |
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "exit 99") |
| 61 | 60 |
containerID := strings.TrimSpace(out) |
| 62 | 61 |
|
| 63 |
- if err := waitInspect(containerID, "{{.State.Running}}", "false", 1*time.Second); err != nil {
|
|
| 62 |
+ if err := waitInspect(containerID, "{{.State.Running}}", "false", 30*time.Second); err != nil {
|
|
| 64 | 63 |
c.Fatal("Container should have stopped by now")
|
| 65 | 64 |
} |
| 66 | 65 |
|
| ... | ... |
@@ -73,8 +73,9 @@ func (s *DockerSuite) TestWaitNonBlockedExitRandom(c *check.C) {
|
| 73 | 73 |
|
| 74 | 74 |
// blocking wait with random exit code |
| 75 | 75 |
func (s *DockerSuite) TestWaitBlockedExitRandom(c *check.C) {
|
| 76 |
+ // Cannot run on Windows as trap in Windows busybox does not support trap in this way. |
|
| 76 | 77 |
testRequires(c, DaemonIsLinux) |
| 77 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 99' TERM; while true; do sleep 0.01; done") |
|
| 78 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 99' TERM; while true; do usleep 10; done") |
|
| 78 | 79 |
containerID := strings.TrimSpace(out) |
| 79 | 80 |
c.Assert(waitRun(containerID), check.IsNil) |
| 80 | 81 |
|