From b4280fb561cbddc96c3d10065e8d9813f52ab100 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 9 Apr 2024 15:04:35 +0200 Subject: [PATCH] e2e test for --all-resources Signed-off-by: Nicolas De Loof --- pkg/e2e/fixtures/resources/compose.yaml | 5 +++++ pkg/e2e/up_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkg/e2e/fixtures/resources/compose.yaml diff --git a/pkg/e2e/fixtures/resources/compose.yaml b/pkg/e2e/fixtures/resources/compose.yaml new file mode 100644 index 00000000000..4823688803e --- /dev/null +++ b/pkg/e2e/fixtures/resources/compose.yaml @@ -0,0 +1,5 @@ +volumes: + my_vol: {} + +networks: + my_net: {} \ No newline at end of file diff --git a/pkg/e2e/up_test.go b/pkg/e2e/up_test.go index c38f9cd5a2e..bbd25fb864e 100644 --- a/pkg/e2e/up_test.go +++ b/pkg/e2e/up_test.go @@ -22,6 +22,7 @@ package e2e import ( "context" "errors" + "fmt" "os/exec" "strings" "syscall" @@ -165,3 +166,15 @@ func TestUpWithDependencyNotRequired(t *testing.T) { assert.Assert(t, strings.Contains(res.Combined(), "foo"), res.Combined()) assert.Assert(t, strings.Contains(res.Combined(), " optional dependency \"bar\" failed to start"), res.Combined()) } + +func TestUpWithAllResources(t *testing.T) { + c := NewCLI(t) + const projectName = "compose-e2e-all-resources" + t.Cleanup(func() { + c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "-v") + }) + + res := c.RunDockerComposeCmd(t, "-f", "./fixtures/resources/compose.yaml", "--all-resources", "--project-name", projectName, "up") + assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol" Created`, projectName)), res.Combined()) + assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net Created`, projectName)), res.Combined()) +}