From e981c35863572c2f552b685b40a84279bececc70 Mon Sep 17 00:00:00 2001 From: Amit Saha Date: Tue, 24 Jan 2023 06:21:01 +1100 Subject: [PATCH] Add failing test Signed-off-by: Amit Saha --- docs/reference/docker_compose_logs.yaml | 11 +++++++++++ pkg/e2e/fixtures/logs-test/compose.yaml | 3 +++ pkg/e2e/logs_test.go | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/docs/reference/docker_compose_logs.yaml b/docs/reference/docker_compose_logs.yaml index 3a13cb293..228de0951 100644 --- a/docs/reference/docker_compose_logs.yaml +++ b/docs/reference/docker_compose_logs.yaml @@ -16,6 +16,17 @@ options: experimentalcli: false kubernetes: false swarm: false + - option: index + value_type: int + default_value: "1" + description: | + Index of the container if there are multiple instances of a service [default: 1]. + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false - option: no-color value_type: bool default_value: "false" diff --git a/pkg/e2e/fixtures/logs-test/compose.yaml b/pkg/e2e/fixtures/logs-test/compose.yaml index cc919b718..e07680e6e 100644 --- a/pkg/e2e/fixtures/logs-test/compose.yaml +++ b/pkg/e2e/fixtures/logs-test/compose.yaml @@ -6,3 +6,6 @@ services: hello: image: alpine command: echo hello + deploy: + mode: replicated + replicas: 2 diff --git a/pkg/e2e/logs_test.go b/pkg/e2e/logs_test.go index b8b48b65d..1c7cfe163 100644 --- a/pkg/e2e/logs_test.go +++ b/pkg/e2e/logs_test.go @@ -54,6 +54,13 @@ func TestLocalComposeLogs(t *testing.T) { res.Assert(t, icmd.Expected{Out: `hello`}) }) + t.Run("logs hello index", func(t *testing.T) { + res := c.RunDockerComposeCmd(t, "--project-name", projectName, "--index", "2", "logs", "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`}) + }) + t.Run("down", func(t *testing.T) { _ = c.RunDockerComposeCmd(t, "--project-name", projectName, "down") })