Skip to content

Commit d2a6c2c

Browse files
committed
Add E2E tests for compose stop with compose file
Signed-off-by: Laura Brehm <[email protected]>
1 parent f6e96dd commit d2a6c2c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
a-different-one:
3+
image: nginx:alpine
4+
and-another-one:
5+
image: nginx:alpine

pkg/e2e/start_stop_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,19 @@ func TestStartStopMultipleServices(t *testing.T) {
246246
fmt.Sprintf("Missing start message for %s\n%s", svc, res.Combined()))
247247
}
248248
}
249+
250+
func TestStartStopMultipleFiles(t *testing.T) {
251+
cli := NewParallelCLI(t, WithEnv("COMPOSE_PROJECT_NAME=e2e-start-stop-svc-multiple-files"))
252+
t.Cleanup(func() {
253+
cli.RunDockerComposeCmd(t, "-p", "e2e-start-stop-svc-multiple-files", "down", "--remove-orphans")
254+
})
255+
256+
cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/compose.yaml", "up", "-d")
257+
cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/other.yaml", "up", "-d")
258+
259+
res := cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/compose.yaml", "stop")
260+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-simple-1 Stopped"), res.Combined())
261+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-another-1 Stopped"), res.Combined())
262+
assert.Assert(t, !strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-a-different-one-1 Stopped"), res.Combined())
263+
assert.Assert(t, !strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-and-another-one-1 Stopped"), res.Combined())
264+
}

0 commit comments

Comments
 (0)