Remove COMPOSE_MENU env from e2e tests

Signed-off-by: Joana Hrotko <joana.hrotko@docker.com>
This commit is contained in:
Joana Hrotko 2024-03-22 20:40:40 +00:00 committed by Joana H
parent ace69c96a7
commit da434013e3
10 changed files with 13 additions and 14 deletions

View File

@ -101,7 +101,6 @@ RUN --mount=type=bind,target=. \
FROM build-base AS test FROM build-base AS test
ARG CGO_ENABLED=0 ARG CGO_ENABLED=0
ARG BUILD_TAGS ARG BUILD_TAGS
ENV COMPOSE_MENU=FALSE
RUN --mount=type=bind,target=. \ RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/go/pkg/mod \

View File

@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
PKG := github.com/docker/compose/v2 PKG := github.com/docker/compose/v2
export COMPOSE_MENU = FALSE
VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags) VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
GO_LDFLAGS ?= -w -X ${PKG}/internal.Version=${VERSION} GO_LDFLAGS ?= -w -X ${PKG}/internal.Version=${VERSION}

View File

@ -331,13 +331,13 @@ func TestBuildPlatformsWithCorrectBuildxConfig(t *testing.T) {
}) })
t.Run("multi-arch up --build", func(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()) assert.NilError(t, res.Error, res.Stderr())
res.Assert(t, icmd.Expected{Out: "platforms-1 exited with code 0"}) 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) { 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) { res := icmd.RunCmd(cmd, func(cmd *icmd.Cmd) {
cmd.Env = append(cmd.Env, "DOCKER_DEFAULT_PLATFORM=linux/amd64") cmd.Env = append(cmd.Env, "DOCKER_DEFAULT_PLATFORM=linux/amd64")
}) })

View File

@ -135,7 +135,7 @@ func TestLocalComposeRun(t *testing.T) {
t.Run("run starts only container and dependencies", func(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 // 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.Assert(t, icmd.Success)
res = c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/deps.yaml", "run", "service_a") res = c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/deps.yaml", "run", "service_a")

View File

@ -165,7 +165,7 @@ func TestAttachRestart(t *testing.T) {
func TestInitContainer(t *testing.T) { func TestInitContainer(t *testing.T) {
c := NewParallelCLI(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") defer c.RunDockerComposeCmd(t, "-p", "init-container", "down")
testify.Regexp(t, "foo-1 | hello(?m:.*)bar-1 | world", res.Stdout()) testify.Regexp(t, "foo-1 | hello(?m:.*)bar-1 | world", res.Stdout())
} }
@ -293,7 +293,7 @@ func TestStopWithDependenciesAttached(t *testing.T) {
cleanup() cleanup()
t.Cleanup(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"}) res.Assert(t, icmd.Expected{Out: "exited with code 0"})
} }

View File

@ -51,7 +51,7 @@ func TestUpExitCodeFrom(t *testing.T) {
c := NewParallelCLI(t) c := NewParallelCLI(t)
const projectName = "e2e-exit-code-from" 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}) res.Assert(t, icmd.Expected{ExitCode: 42})
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")
@ -61,7 +61,7 @@ func TestUpExitCodeFromContainerKilled(t *testing.T) {
c := NewParallelCLI(t) c := NewParallelCLI(t)
const projectName = "e2e-exit-code-from-kill" 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}) res.Assert(t, icmd.Expected{ExitCode: 143})
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")
@ -85,7 +85,7 @@ func TestStdoutStderr(t *testing.T) {
c := NewParallelCLI(t) c := NewParallelCLI(t)
const projectName = "e2e-stdout-stderr" 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"}) res.Assert(t, icmd.Expected{Out: "log to stdout", Err: "log to stderr"})
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")

View File

@ -116,7 +116,7 @@ func TestLocalComposeLargeLogs(t *testing.T) {
} }
assert.NilError(t, f.Close()) 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 cmd.Stdout = io.Discard
res := icmd.RunCmd(cmd) res := icmd.RunCmd(cmd)
res.Assert(t, icmd.Expected{Out: "test-1 exited with code 0"}) res.Assert(t, icmd.Expected{Out: "test-1 exited with code 0"})

View File

@ -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.Assert(t, icmd.Expected{ExitCode: 15, Err: "services.simple Additional property wrongField is not allowed"})
res = c.RunDockerComposeCmdNoCheck(t, "up") res = c.RunDockerComposeCmdNoCheck(t, "up")
res.Assert(t, icmd.Expected{ExitCode: 14, Err: "no configuration file provided: not found"}) 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.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.Assert(t, icmd.Expected{ExitCode: 16, Err: "unknown flag: --file"})
res = c.RunDockerComposeCmdNoCheck(t, "donw", "--file", "fixtures/wrong-composefile/compose.yaml") res = c.RunDockerComposeCmdNoCheck(t, "donw", "--file", "fixtures/wrong-composefile/compose.yaml")
res.Assert(t, icmd.Expected{ExitCode: 16, Err: `unknown docker command: "compose donw"`}) res.Assert(t, icmd.Expected{ExitCode: 16, Err: `unknown docker command: "compose donw"`})

View File

@ -104,7 +104,7 @@ func TestPauseServiceAlreadyPaused(t *testing.T) {
t.Cleanup(cleanup) t.Cleanup(cleanup)
// launch a and wait for it to come up // 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) 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 // pause a twice - first time should pass, second time fail

View File

@ -71,6 +71,7 @@ func TestUpDependenciesNotStopped(t *testing.T) {
testCmd := c.NewDockerComposeCmd(t, testCmd := c.NewDockerComposeCmd(t,
"-f=./fixtures/ups-deps-stop/compose.yaml", "-f=./fixtures/ups-deps-stop/compose.yaml",
"up", "up",
"--menu=false",
"app", "app",
) )