From 8c964f5ad3df04f1dca2a27c348e90d4ae2a9371 Mon Sep 17 00:00:00 2001 From: Amit Saha Date: Wed, 25 Jan 2023 12:54:49 +1100 Subject: [PATCH] Update E2E test Signed-off-by: Amit Saha --- pkg/e2e/fixtures/logs-test/compose.yaml | 2 ++ pkg/e2e/logs_test.go | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/e2e/fixtures/logs-test/compose.yaml b/pkg/e2e/fixtures/logs-test/compose.yaml index cc919b718..5f9ba0e9d 100644 --- a/pkg/e2e/fixtures/logs-test/compose.yaml +++ b/pkg/e2e/fixtures/logs-test/compose.yaml @@ -6,3 +6,5 @@ services: hello: image: alpine command: echo hello + deploy: + replicas: 2 diff --git a/pkg/e2e/logs_test.go b/pkg/e2e/logs_test.go index cec80a624..d22347b61 100644 --- a/pkg/e2e/logs_test.go +++ b/pkg/e2e/logs_test.go @@ -56,9 +56,13 @@ func TestLocalComposeLogs(t *testing.T) { t.Run("logs hello index", func(t *testing.T) { res := c.RunDockerComposeCmd(t, "--project-name", projectName, "logs", "--index", "2", "hello") - // TODO: see if there is a way we can verify that the logs is from the second replica - // or if we need to.. - res.Assert(t, icmd.Expected{Out: `hello`}) + + // docker-compose logs hello + // logs-test-hello-2 | hello + // logs-test-hello-1 | hello + t.Log(res.Stdout()) + assert.Assert(t, !strings.Contains(res.Stdout(), "hello-1")) + assert.Assert(t, strings.Contains(res.Stdout(), "hello-2")) }) t.Run("down", func(t *testing.T) {