From d2a6c2c200c9630965d36ca9becd91939eed1cc0 Mon Sep 17 00:00:00 2001 From: Laura Brehm Date: Mon, 1 Aug 2022 16:56:26 +0200 Subject: [PATCH] Add E2E tests for `compose stop` with compose file Signed-off-by: Laura Brehm --- pkg/e2e/fixtures/start-stop/other.yaml | 5 +++++ pkg/e2e/start_stop_test.go | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkg/e2e/fixtures/start-stop/other.yaml diff --git a/pkg/e2e/fixtures/start-stop/other.yaml b/pkg/e2e/fixtures/start-stop/other.yaml new file mode 100644 index 000000000..c28cbd09b --- /dev/null +++ b/pkg/e2e/fixtures/start-stop/other.yaml @@ -0,0 +1,5 @@ +services: + a-different-one: + image: nginx:alpine + and-another-one: + image: nginx:alpine \ No newline at end of file diff --git a/pkg/e2e/start_stop_test.go b/pkg/e2e/start_stop_test.go index bbfade1fb..1a16d089d 100644 --- a/pkg/e2e/start_stop_test.go +++ b/pkg/e2e/start_stop_test.go @@ -246,3 +246,19 @@ func TestStartStopMultipleServices(t *testing.T) { fmt.Sprintf("Missing start message for %s\n%s", svc, res.Combined())) } } + +func TestStartStopMultipleFiles(t *testing.T) { + cli := NewParallelCLI(t, WithEnv("COMPOSE_PROJECT_NAME=e2e-start-stop-svc-multiple-files")) + t.Cleanup(func() { + cli.RunDockerComposeCmd(t, "-p", "e2e-start-stop-svc-multiple-files", "down", "--remove-orphans") + }) + + cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/compose.yaml", "up", "-d") + cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/other.yaml", "up", "-d") + + res := cli.RunDockerComposeCmd(t, "-f", "./fixtures/start-stop/compose.yaml", "stop") + assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-simple-1 Stopped"), res.Combined()) + assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-another-1 Stopped"), res.Combined()) + assert.Assert(t, !strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-a-different-one-1 Stopped"), res.Combined()) + assert.Assert(t, !strings.Contains(res.Combined(), "Container e2e-start-stop-svc-multiple-files-and-another-one-1 Stopped"), res.Combined()) +}