From d6f842b042d2f2926901305336527b3eaadf067a Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Wed, 30 Aug 2023 16:01:15 -0400 Subject: [PATCH] test: e2e test reliability improvements (#10950) * Use unique project name prefixes (some of these tests assert on output using the project name as a magic string, so could be impacted by other tests with the same project name prefix) * Tear down port range project before starting to try and avoid race conditions with the engine and port assignment Signed-off-by: Milas Bowman --- pkg/e2e/compose_up_test.go | 8 ++++++-- pkg/e2e/profiles_test.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/e2e/compose_up_test.go b/pkg/e2e/compose_up_test.go index 45c457240..d8ec6d183 100644 --- a/pkg/e2e/compose_up_test.go +++ b/pkg/e2e/compose_up_test.go @@ -71,10 +71,14 @@ func TestPortRange(t *testing.T) { c := NewParallelCLI(t) const projectName = "e2e-port-range" + reset := func() { + c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans", "--timeout=0") + } + reset() + t.Cleanup(reset) + res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/port-range/compose.yaml", "--project-name", projectName, "up", "-d") res.Assert(t, icmd.Success) - - c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans") } func TestStdoutStderr(t *testing.T) { diff --git a/pkg/e2e/profiles_test.go b/pkg/e2e/profiles_test.go index e5fc3fdb4..5115c0d3e 100644 --- a/pkg/e2e/profiles_test.go +++ b/pkg/e2e/profiles_test.go @@ -31,7 +31,7 @@ const ( func TestExplicitProfileUsage(t *testing.T) { c := NewParallelCLI(t) - const projectName = "compose-e2e-profiles" + const projectName = "compose-e2e-explicit-profiles" const profileName = "test-profile" t.Run("compose up with profile", func(t *testing.T) { @@ -132,7 +132,7 @@ func TestNoProfileUsage(t *testing.T) { func TestActiveProfileViaTargetedService(t *testing.T) { c := NewParallelCLI(t) - const projectName = "compose-e2e-profiles-via-target-service" + const projectName = "compose-e2e-via-target-service-profiles" const profileName = "test-profile" t.Run("compose up with service name", func(t *testing.T) {