From da434013e311a3f5eb1d6c0ab4da9a0ebc709a0e Mon Sep 17 00:00:00 2001 From: Joana Hrotko Date: Fri, 22 Mar 2024 20:40:40 +0000 Subject: [PATCH] Remove COMPOSE_MENU env from e2e tests Signed-off-by: Joana Hrotko --- Dockerfile | 1 - Makefile | 1 - pkg/e2e/build_test.go | 4 ++-- pkg/e2e/compose_run_test.go | 2 +- pkg/e2e/compose_test.go | 4 ++-- pkg/e2e/compose_up_test.go | 6 +++--- pkg/e2e/logs_test.go | 2 +- pkg/e2e/metrics_test.go | 4 ++-- pkg/e2e/pause_test.go | 2 +- pkg/e2e/up_test.go | 1 + 10 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index d04ce27d2..bb6ed8f26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,7 +101,6 @@ RUN --mount=type=bind,target=. \ FROM build-base AS test ARG CGO_ENABLED=0 ARG BUILD_TAGS -ENV COMPOSE_MENU=FALSE RUN --mount=type=bind,target=. \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod \ diff --git a/Makefile b/Makefile index 3b91c83ee..a69fa57bf 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ # limitations under the License. PKG := github.com/docker/compose/v2 -export COMPOSE_MENU = FALSE VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags) GO_LDFLAGS ?= -w -X ${PKG}/internal.Version=${VERSION} diff --git a/pkg/e2e/build_test.go b/pkg/e2e/build_test.go index 8c87b99c2..c56f5a4a3 100644 --- a/pkg/e2e/build_test.go +++ b/pkg/e2e/build_test.go @@ -331,13 +331,13 @@ func TestBuildPlatformsWithCorrectBuildxConfig(t *testing.T) { }) t.Run("multi-arch up --build", func(t *testing.T) { - res := c.RunDockerComposeCmdNoCheck(t, "--project-directory", "fixtures/build-test/platforms", "up", "--build") + res := c.RunDockerComposeCmdNoCheck(t, "--project-directory", "fixtures/build-test/platforms", "up", "--build", "--menu=false") assert.NilError(t, res.Error, res.Stderr()) res.Assert(t, icmd.Expected{Out: "platforms-1 exited with code 0"}) }) t.Run("use DOCKER_DEFAULT_PLATFORM value when up --build", func(t *testing.T) { - cmd := c.NewDockerComposeCmd(t, "--project-directory", "fixtures/build-test/platforms", "up", "--build") + cmd := c.NewDockerComposeCmd(t, "--project-directory", "fixtures/build-test/platforms", "up", "--build", "--menu=false") res := icmd.RunCmd(cmd, func(cmd *icmd.Cmd) { cmd.Env = append(cmd.Env, "DOCKER_DEFAULT_PLATFORM=linux/amd64") }) diff --git a/pkg/e2e/compose_run_test.go b/pkg/e2e/compose_run_test.go index ceec152a8..69b20ab2f 100644 --- a/pkg/e2e/compose_run_test.go +++ b/pkg/e2e/compose_run_test.go @@ -135,7 +135,7 @@ func TestLocalComposeRun(t *testing.T) { t.Run("run starts only container and dependencies", func(t *testing.T) { // ensure that even if another service is up run does not start it: https://github.com/docker/compose/issues/9459 - res := c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/deps.yaml", "up", "service_b") + res := c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/deps.yaml", "up", "service_b", "--menu=false") res.Assert(t, icmd.Success) res = c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/deps.yaml", "run", "service_a") diff --git a/pkg/e2e/compose_test.go b/pkg/e2e/compose_test.go index 1de52cfca..ce5752f25 100644 --- a/pkg/e2e/compose_test.go +++ b/pkg/e2e/compose_test.go @@ -165,7 +165,7 @@ func TestAttachRestart(t *testing.T) { func TestInitContainer(t *testing.T) { c := NewParallelCLI(t) - res := c.RunDockerComposeCmd(t, "--ansi=never", "--project-directory", "./fixtures/init-container", "up") + res := c.RunDockerComposeCmd(t, "--ansi=never", "--project-directory", "./fixtures/init-container", "up", "--menu=false") defer c.RunDockerComposeCmd(t, "-p", "init-container", "down") testify.Regexp(t, "foo-1 | hello(?m:.*)bar-1 | world", res.Stdout()) } @@ -293,7 +293,7 @@ func TestStopWithDependenciesAttached(t *testing.T) { cleanup() t.Cleanup(cleanup) - res := c.RunDockerComposeCmd(t, "-f", "./fixtures/dependencies/compose.yaml", "-p", projectName, "up", "--attach-dependencies", "foo") + res := c.RunDockerComposeCmd(t, "-f", "./fixtures/dependencies/compose.yaml", "-p", projectName, "up", "--attach-dependencies", "foo", "--menu=false") res.Assert(t, icmd.Expected{Out: "exited with code 0"}) } diff --git a/pkg/e2e/compose_up_test.go b/pkg/e2e/compose_up_test.go index d8ec6d183..87cfebce2 100644 --- a/pkg/e2e/compose_up_test.go +++ b/pkg/e2e/compose_up_test.go @@ -51,7 +51,7 @@ func TestUpExitCodeFrom(t *testing.T) { c := NewParallelCLI(t) const projectName = "e2e-exit-code-from" - res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/start-fail/start-depends_on-long-lived.yaml", "--project-name", projectName, "up", "--exit-code-from=failure", "failure") + res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/start-fail/start-depends_on-long-lived.yaml", "--project-name", projectName, "up", "--menu=false", "--exit-code-from=failure", "failure") res.Assert(t, icmd.Expected{ExitCode: 42}) c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") @@ -61,7 +61,7 @@ func TestUpExitCodeFromContainerKilled(t *testing.T) { c := NewParallelCLI(t) const projectName = "e2e-exit-code-from-kill" - res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/start-fail/start-depends_on-long-lived.yaml", "--project-name", projectName, "up", "--exit-code-from=test") + res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/start-fail/start-depends_on-long-lived.yaml", "--project-name", projectName, "up", "--menu=false", "--exit-code-from=test") res.Assert(t, icmd.Expected{ExitCode: 143}) c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") @@ -85,7 +85,7 @@ func TestStdoutStderr(t *testing.T) { c := NewParallelCLI(t) const projectName = "e2e-stdout-stderr" - res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/stdout-stderr/compose.yaml", "--project-name", projectName, "up") + res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/stdout-stderr/compose.yaml", "--project-name", projectName, "up", "--menu=false") res.Assert(t, icmd.Expected{Out: "log to stdout", Err: "log to stderr"}) c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") diff --git a/pkg/e2e/logs_test.go b/pkg/e2e/logs_test.go index 7c2b1df20..01abed8f4 100644 --- a/pkg/e2e/logs_test.go +++ b/pkg/e2e/logs_test.go @@ -116,7 +116,7 @@ func TestLocalComposeLargeLogs(t *testing.T) { } assert.NilError(t, f.Close()) - cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/logs-test/cat.yaml", "--project-name", projectName, "up", "--abort-on-container-exit") + cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/logs-test/cat.yaml", "--project-name", projectName, "up", "--abort-on-container-exit", "--menu=false") cmd.Stdout = io.Discard res := icmd.RunCmd(cmd) res.Assert(t, icmd.Expected{Out: "test-1 exited with code 0"}) diff --git a/pkg/e2e/metrics_test.go b/pkg/e2e/metrics_test.go index adee7da5c..9ad45ed2b 100644 --- a/pkg/e2e/metrics_test.go +++ b/pkg/e2e/metrics_test.go @@ -37,9 +37,9 @@ func TestComposeMetrics(t *testing.T) { res.Assert(t, icmd.Expected{ExitCode: 15, Err: "services.simple Additional property wrongField is not allowed"}) res = c.RunDockerComposeCmdNoCheck(t, "up") res.Assert(t, icmd.Expected{ExitCode: 14, Err: "no configuration file provided: not found"}) - res = c.RunDockerComposeCmdNoCheck(t, "up", "-f", "fixtures/wrong-composefile/compose.yaml") + res = c.RunDockerComposeCmdNoCheck(t, "up", "-f", "fixtures/wrong-composefile/compose.yaml", "--menu=false") res.Assert(t, icmd.Expected{ExitCode: 16, Err: "unknown shorthand flag: 'f' in -f"}) - res = c.RunDockerComposeCmdNoCheck(t, "up", "--file", "fixtures/wrong-composefile/compose.yaml") + res = c.RunDockerComposeCmdNoCheck(t, "up", "--file", "fixtures/wrong-composefile/compose.yaml", "--menu=false") res.Assert(t, icmd.Expected{ExitCode: 16, Err: "unknown flag: --file"}) res = c.RunDockerComposeCmdNoCheck(t, "donw", "--file", "fixtures/wrong-composefile/compose.yaml") res.Assert(t, icmd.Expected{ExitCode: 16, Err: `unknown docker command: "compose donw"`}) diff --git a/pkg/e2e/pause_test.go b/pkg/e2e/pause_test.go index ef1c18db1..200301a24 100644 --- a/pkg/e2e/pause_test.go +++ b/pkg/e2e/pause_test.go @@ -104,7 +104,7 @@ func TestPauseServiceAlreadyPaused(t *testing.T) { t.Cleanup(cleanup) // launch a and wait for it to come up - cli.RunDockerComposeCmd(t, "up", "--wait", "a") + cli.RunDockerComposeCmd(t, "up", "--menu=false", "--wait", "a") HTTPGetWithRetry(t, urlForService(t, cli, "a", 80), http.StatusOK, 50*time.Millisecond, 10*time.Second) // pause a twice - first time should pass, second time fail diff --git a/pkg/e2e/up_test.go b/pkg/e2e/up_test.go index bbd25fb86..e6e138c3b 100644 --- a/pkg/e2e/up_test.go +++ b/pkg/e2e/up_test.go @@ -71,6 +71,7 @@ func TestUpDependenciesNotStopped(t *testing.T) { testCmd := c.NewDockerComposeCmd(t, "-f=./fixtures/ups-deps-stop/compose.yaml", "up", + "--menu=false", "app", )