From e3c0cf0f69a8b824e0095af11a961de664f9cca1 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 16 Dec 2024 13:31:39 +0100 Subject: [PATCH] e2e test to prevent future regression Signed-off-by: Nicolas De Loof --- pkg/e2e/fixtures/recreate-volumes/bind.yaml | 5 +++++ pkg/e2e/volumes_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkg/e2e/fixtures/recreate-volumes/bind.yaml diff --git a/pkg/e2e/fixtures/recreate-volumes/bind.yaml b/pkg/e2e/fixtures/recreate-volumes/bind.yaml new file mode 100644 index 0000000000..a67244ca53 --- /dev/null +++ b/pkg/e2e/fixtures/recreate-volumes/bind.yaml @@ -0,0 +1,5 @@ +services: + app: + image: alpine + volumes: + - .:/my_vol diff --git a/pkg/e2e/volumes_test.go b/pkg/e2e/volumes_test.go index ebb4e1b241..8ed6b68130 100644 --- a/pkg/e2e/volumes_test.go +++ b/pkg/e2e/volumes_test.go @@ -161,3 +161,16 @@ func TestUpRecreateVolumes(t *testing.T) { res = c.RunDockerCmd(t, "volume", "inspect", fmt.Sprintf("%s_my_vol", projectName), "-f", "{{ index .Labels \"foo\" }}") res.Assert(t, icmd.Expected{Out: "zot"}) } + +func TestUpRecreateVolumes_IgnoreBinds(t *testing.T) { + c := NewCLI(t) + const projectName = "compose-e2e-recreate-volumes" + t.Cleanup(func() { + c.cleanupWithDown(t, projectName) + }) + + c.RunDockerComposeCmd(t, "-f", "./fixtures/recreate-volumes/bind.yaml", "--project-name", projectName, "up", "-d") + + res := c.RunDockerComposeCmd(t, "-f", "./fixtures/recreate-volumes/bind.yaml", "--project-name", projectName, "up", "-d") + assert.Check(t, !strings.Contains(res.Combined(), "Recreated")) +}