MCPcopy
hub / github.com/docker/compose / TestWaitOnInfinity

Function TestWaitOnInfinity

pkg/e2e/wait_test.go:56–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func 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
91func TestWaitAndDrop(t *testing.T) {
92 const projectName = "e2e-wait-and-drop"

Callers

nothing calls this directly

Calls 5

NewParallelCLIFunction · 0.85
RunDockerComposeCmdMethod · 0.80
NewDockerComposeCmdMethod · 0.80
KillMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected