(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestWaitOnInfinity(t *testing.T) { |
| 57 | const projectName = "e2e-wait-infinity" |
| 58 | c := NewParallelCLI(t) |
| 59 | |
| 60 | cleanup := func() { |
| 61 | c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--timeout=0", "--remove-orphans") |
| 62 | } |
| 63 | t.Cleanup(cleanup) |
| 64 | cleanup() |
| 65 | |
| 66 | c.RunDockerComposeCmd(t, "-f", "./fixtures/wait/compose.yaml", "--project-name", projectName, "up", "-d") |
| 67 | |
| 68 | cmd := c.NewDockerComposeCmd(t, "--project-name", projectName, "wait", "infinity") |
| 69 | r := icmd.StartCmd(cmd) |
| 70 | assert.NilError(t, r.Error) |
| 71 | t.Cleanup(func() { |
| 72 | if r.Cmd.Process != nil { |
| 73 | _ = r.Cmd.Process.Kill() |
| 74 | } |
| 75 | }) |
| 76 | |
| 77 | finished := make(chan struct{}) |
| 78 | ticker := time.NewTicker(7 * time.Second) |
| 79 | go func() { |
| 80 | _ = r.Cmd.Wait() |
| 81 | finished <- struct{}{} |
| 82 | }() |
| 83 | |
| 84 | select { |
| 85 | case <-finished: |
| 86 | t.Fatal("wait infinity should not finish") |
| 87 | case <-ticker.C: |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func TestWaitAndDrop(t *testing.T) { |
| 92 | const projectName = "e2e-wait-and-drop" |
nothing calls this directly
no test coverage detected