From 7f18b47a9acfece3411bfada46d9565a7035d2bd Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 22 Jun 2021 09:55:00 +0200 Subject: [PATCH] prefer canonical `compose.yaml` file name Signed-off-by: Nicolas De Loof --- .../{compose.yml => compose.yaml} | 0 aci/e2e/e2e-aci_test.go | 2 +- local/e2e/compose/cancel_test.go | 2 +- local/e2e/compose/compose_build_test.go | 6 +++--- local/e2e/compose/compose_run_test.go | 14 +++++++------- local/e2e/compose/cp_test.go | 18 +++++++++--------- .../{docker-compose.yml => compose.yaml} | 0 .../build-test/{compose.yml => compose.yaml} | 0 .../{docker-compose.yml => compose.yaml} | 0 local/e2e/compose/fixtures/ipam/compose.yaml | 0 .../restart-test/{compose.yml => compose.yaml} | 0 .../run-test/{compose.yml => compose.yaml} | 0 .../{compose.yml => compose.yaml} | 0 .../{compose.yml => compose.yaml} | 0 .../start-stop/{compose.yml => compose.yaml} | 0 .../volume-test/{compose.yml => compose.yaml} | 0 .../{compose.yml => compose.yaml} | 0 local/e2e/compose/metrics_test.go | 14 +++++++------- local/e2e/compose/restart_test.go | 4 ++-- local/e2e/compose/scan_message_test.go | 14 +++++++------- local/e2e/compose/start_stop_test.go | 10 +++++----- pkg/compose/kill_test.go | 2 +- .../{docker-compose.yml => compose.yaml} | 0 23 files changed, 43 insertions(+), 43 deletions(-) rename aci/e2e/aci_secrets_resources/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/build-infinite/{docker-compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/build-test/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/cp-test/{docker-compose.yml => compose.yaml} (100%) create mode 100644 local/e2e/compose/fixtures/ipam/compose.yaml rename local/e2e/compose/fixtures/restart-test/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/run-test/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/simple-build-test/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/simple-composefile/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/start-stop/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/volume-test/{compose.yml => compose.yaml} (100%) rename local/e2e/compose/fixtures/wrong-composefile/{compose.yml => compose.yaml} (100%) rename pkg/compose/testdata/{docker-compose.yml => compose.yaml} (100%) diff --git a/aci/e2e/aci_secrets_resources/compose.yml b/aci/e2e/aci_secrets_resources/compose.yaml similarity index 100% rename from aci/e2e/aci_secrets_resources/compose.yml rename to aci/e2e/aci_secrets_resources/compose.yaml diff --git a/aci/e2e/e2e-aci_test.go b/aci/e2e/e2e-aci_test.go index 766b67cf2..5a15fa5c2 100644 --- a/aci/e2e/e2e-aci_test.go +++ b/aci/e2e/e2e-aci_test.go @@ -553,7 +553,7 @@ func TestUpSecretsResources(t *testing.T) { secret2Value = "another_password\n" ) - composefilePath := filepath.Join("aci_secrets_resources", "compose.yml") + composefilePath := filepath.Join("aci_secrets_resources", "compose.yaml") c := NewParallelE2eCLI(t, binDir) _, _, _ = setupTestResourceGroup(t, c) diff --git a/local/e2e/compose/cancel_test.go b/local/e2e/compose/cancel_test.go index 7c57ab994..d920408ec 100644 --- a/local/e2e/compose/cancel_test.go +++ b/local/e2e/compose/cancel_test.go @@ -56,7 +56,7 @@ func TestComposeCancel(t *testing.T) { s.ResetUsage() c.RunDockerCmd("compose", "ls") - buildProjectPath := "../compose/fixtures/build-infinite/docker-compose.yml" + buildProjectPath := "../compose/fixtures/build-infinite/compose.yaml" // require a separate groupID from the process running tests, in order to simulate ctrl+C from a terminal. // sending kill signal diff --git a/local/e2e/compose/compose_build_test.go b/local/e2e/compose/compose_build_test.go index c49f81686..2269e1028 100644 --- a/local/e2e/compose/compose_build_test.go +++ b/local/e2e/compose/compose_build_test.go @@ -118,7 +118,7 @@ func TestLocalComposeBuildStaticDockerfilePath(t *testing.T) { assert.NilError(t, err) defer os.RemoveAll(dir) //nolint:errcheck - assert.NilError(t, ioutil.WriteFile(filepath.Join(dir, "docker-compose.yml"), []byte(`services: + assert.NilError(t, ioutil.WriteFile(filepath.Join(dir, "compose.yaml"), []byte(`services: service1: build: context: `+dir+`/service1 @@ -139,11 +139,11 @@ func TestLocalComposeBuildStaticDockerfilePath(t *testing.T) { RUN echo "world" `), 0644)) - res := c.RunDockerCmd("compose", "-f", filepath.Join(dir, "docker-compose.yml"), "build") + res := c.RunDockerCmd("compose", "-f", filepath.Join(dir, "compose.yaml"), "build") res.Assert(t, icmd.Expected{Out: `RUN echo "hello"`}) res.Assert(t, icmd.Expected{Out: `RUN echo "world"`}) - c.RunDockerCmd("compose", "-f", filepath.Join(dir, "docker-compose.yml"), "down", "--rmi", "all") + c.RunDockerCmd("compose", "-f", filepath.Join(dir, "compose.yaml"), "down", "--rmi", "all") }) } diff --git a/local/e2e/compose/compose_run_test.go b/local/e2e/compose/compose_run_test.go index ff8397b83..cfb4514bf 100644 --- a/local/e2e/compose/compose_run_test.go +++ b/local/e2e/compose/compose_run_test.go @@ -31,11 +31,11 @@ func TestLocalComposeRun(t *testing.T) { c := NewParallelE2eCLI(t, binDir) t.Run("compose run", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back") + res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "back") lines := Lines(res.Stdout()) assert.Equal(t, lines[len(lines)-1], "Hello there!!", res.Stdout()) assert.Assert(t, !strings.Contains(res.Combined(), "orphan")) - res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back", "echo", "Hello one more time") + res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "back", "echo", "Hello one more time") lines = Lines(res.Stdout()) assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout()) assert.Assert(t, !strings.Contains(res.Combined(), "orphan")) @@ -70,7 +70,7 @@ func TestLocalComposeRun(t *testing.T) { }) t.Run("compose run --rm", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--rm", "back", "/bin/sh", "-c", "echo Hello again") + res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--rm", "back", "/bin/sh", "-c", "echo Hello again") lines := Lines(res.Stdout()) assert.Equal(t, lines[len(lines)-1], "Hello again", res.Stdout()) @@ -79,7 +79,7 @@ func TestLocalComposeRun(t *testing.T) { }) t.Run("down", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down") + c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "down") res := c.RunDockerCmd("ps", "--all") assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout()) }) @@ -87,7 +87,7 @@ func TestLocalComposeRun(t *testing.T) { t.Run("compose run --volumes", func(t *testing.T) { wd, err := os.Getwd() assert.NilError(t, err) - res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--volumes", wd+":/foo", "back", "/bin/sh", "-c", "ls /foo") + res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--volumes", wd+":/foo", "back", "/bin/sh", "-c", "ls /foo") res.Assert(t, icmd.Expected{Out: "compose_run_test.go"}) res = c.RunDockerCmd("ps", "--all") @@ -95,13 +95,13 @@ func TestLocalComposeRun(t *testing.T) { }) t.Run("compose run --publish", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--publish", "8081:80", "-d", "back", "/bin/sh", "-c", "sleep 1") + c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--publish", "8081:80", "-d", "back", "/bin/sh", "-c", "sleep 1") res := c.RunDockerCmd("ps") assert.Assert(t, strings.Contains(res.Stdout(), "8081->80/tcp"), res.Stdout()) }) t.Run("down", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down") + c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "down") res := c.RunDockerCmd("ps", "--all") assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout()) }) diff --git a/local/e2e/compose/cp_test.go b/local/e2e/compose/cp_test.go index 5b5678303..9e9724b24 100644 --- a/local/e2e/compose/cp_test.go +++ b/local/e2e/compose/cp_test.go @@ -33,7 +33,7 @@ func TestCopy(t *testing.T) { const projectName = "copy_e2e" t.Cleanup(func() { - c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "--project-name", projectName, "down") + c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "--project-name", projectName, "down") os.Remove("./fixtures/cp-test/from-default.txt") //nolint:errcheck os.Remove("./fixtures/cp-test/from-indexed.txt") //nolint:errcheck @@ -41,7 +41,7 @@ func TestCopy(t *testing.T) { }) t.Run("start service", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "--project-name", projectName, "up", "--scale", "nginx=5", "-d") + c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "--project-name", projectName, "up", "--scale", "nginx=5", "-d") }) t.Run("make sure service is running", func(t *testing.T) { @@ -50,7 +50,7 @@ func TestCopy(t *testing.T) { }) t.Run("copy to container copies the file to the first container by default", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/default.txt") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/default.txt") res.Assert(t, icmd.Expected{ExitCode: 0}) output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/default.txt").Stdout() @@ -61,7 +61,7 @@ func TestCopy(t *testing.T) { }) t.Run("copy to container with a given index copies the file to the given container", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--index=3", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/indexed.txt") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--index=3", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/indexed.txt") res.Assert(t, icmd.Expected{ExitCode: 0}) output := c.RunDockerCmd("exec", projectName+"_nginx_3", "cat", "/tmp/indexed.txt").Stdout() @@ -72,7 +72,7 @@ func TestCopy(t *testing.T) { }) t.Run("copy to container with the all flag copies the file to all containers", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--all", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/all.txt") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--all", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/all.txt") res.Assert(t, icmd.Expected{ExitCode: 0}) output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/all.txt").Stdout() @@ -86,7 +86,7 @@ func TestCopy(t *testing.T) { }) t.Run("copy from a container copies the file to the host from the first container by default", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "nginx:/tmp/default.txt", "./fixtures/cp-test/from-default.txt") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "nginx:/tmp/default.txt", "./fixtures/cp-test/from-default.txt") res.Assert(t, icmd.Expected{ExitCode: 0}) data, err := os.ReadFile("./fixtures/cp-test/from-default.txt") @@ -95,7 +95,7 @@ func TestCopy(t *testing.T) { }) t.Run("copy from a container with a given index copies the file to host", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--index=3", "nginx:/tmp/indexed.txt", "./fixtures/cp-test/from-indexed.txt") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--index=3", "nginx:/tmp/indexed.txt", "./fixtures/cp-test/from-indexed.txt") res.Assert(t, icmd.Expected{ExitCode: 0}) data, err := os.ReadFile("./fixtures/cp-test/from-indexed.txt") @@ -104,13 +104,13 @@ func TestCopy(t *testing.T) { }) t.Run("copy to and from a container also work with folder", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "./fixtures/cp-test/cp-folder", "nginx:/tmp") + res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "./fixtures/cp-test/cp-folder", "nginx:/tmp") res.Assert(t, icmd.Expected{ExitCode: 0}) output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/cp-folder/cp-me.txt").Stdout() assert.Assert(t, strings.Contains(output, `hello world from folder`), output) - res = c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "nginx:/tmp/cp-folder", "./fixtures/cp-test/cp-folder2") + res = c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "nginx:/tmp/cp-folder", "./fixtures/cp-test/cp-folder2") res.Assert(t, icmd.Expected{ExitCode: 0}) data, err := os.ReadFile("./fixtures/cp-test/cp-folder2/cp-me.txt") diff --git a/local/e2e/compose/fixtures/build-infinite/docker-compose.yml b/local/e2e/compose/fixtures/build-infinite/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/build-infinite/docker-compose.yml rename to local/e2e/compose/fixtures/build-infinite/compose.yaml diff --git a/local/e2e/compose/fixtures/build-test/compose.yml b/local/e2e/compose/fixtures/build-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/build-test/compose.yml rename to local/e2e/compose/fixtures/build-test/compose.yaml diff --git a/local/e2e/compose/fixtures/cp-test/docker-compose.yml b/local/e2e/compose/fixtures/cp-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/cp-test/docker-compose.yml rename to local/e2e/compose/fixtures/cp-test/compose.yaml diff --git a/local/e2e/compose/fixtures/ipam/compose.yaml b/local/e2e/compose/fixtures/ipam/compose.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/local/e2e/compose/fixtures/restart-test/compose.yml b/local/e2e/compose/fixtures/restart-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/restart-test/compose.yml rename to local/e2e/compose/fixtures/restart-test/compose.yaml diff --git a/local/e2e/compose/fixtures/run-test/compose.yml b/local/e2e/compose/fixtures/run-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/run-test/compose.yml rename to local/e2e/compose/fixtures/run-test/compose.yaml diff --git a/local/e2e/compose/fixtures/simple-build-test/compose.yml b/local/e2e/compose/fixtures/simple-build-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/simple-build-test/compose.yml rename to local/e2e/compose/fixtures/simple-build-test/compose.yaml diff --git a/local/e2e/compose/fixtures/simple-composefile/compose.yml b/local/e2e/compose/fixtures/simple-composefile/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/simple-composefile/compose.yml rename to local/e2e/compose/fixtures/simple-composefile/compose.yaml diff --git a/local/e2e/compose/fixtures/start-stop/compose.yml b/local/e2e/compose/fixtures/start-stop/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/start-stop/compose.yml rename to local/e2e/compose/fixtures/start-stop/compose.yaml diff --git a/local/e2e/compose/fixtures/volume-test/compose.yml b/local/e2e/compose/fixtures/volume-test/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/volume-test/compose.yml rename to local/e2e/compose/fixtures/volume-test/compose.yaml diff --git a/local/e2e/compose/fixtures/wrong-composefile/compose.yml b/local/e2e/compose/fixtures/wrong-composefile/compose.yaml similarity index 100% rename from local/e2e/compose/fixtures/wrong-composefile/compose.yml rename to local/e2e/compose/fixtures/wrong-composefile/compose.yaml diff --git a/local/e2e/compose/metrics_test.go b/local/e2e/compose/metrics_test.go index 140da80e0..9ced51215 100644 --- a/local/e2e/compose/metrics_test.go +++ b/local/e2e/compose/metrics_test.go @@ -49,21 +49,21 @@ func TestComposeMetrics(t *testing.T) { t.Run("catch specific failure metrics", func(t *testing.T) { s.ResetUsage() - res := c.RunDockerOrExitError("compose", "-f", "../compose/fixtures/does-not-exist/compose.yml", "build") - expectedErr := "compose/fixtures/does-not-exist/compose.yml: no such file or directory" + res := c.RunDockerOrExitError("compose", "-f", "../compose/fixtures/does-not-exist/compose.yaml", "build") + expectedErr := "compose/fixtures/does-not-exist/compose.yaml: no such file or directory" if runtime.GOOS == "windows" { - expectedErr = "does-not-exist\\compose.yml: The system cannot find the path specified" + expectedErr = "does-not-exist\\compose.yaml: The system cannot find the path specified" } res.Assert(t, icmd.Expected{ExitCode: 14, Err: expectedErr}) - res = c.RunDockerOrExitError("compose", "-f", "../compose/fixtures/wrong-composefile/compose.yml", "up", "-d") + res = c.RunDockerOrExitError("compose", "-f", "../compose/fixtures/wrong-composefile/compose.yaml", "up", "-d") res.Assert(t, icmd.Expected{ExitCode: 15, Err: "services.simple Additional property wrongField is not allowed"}) res = c.RunDockerOrExitError("compose", "up") res.Assert(t, icmd.Expected{ExitCode: 14, Err: "can't find a suitable configuration file in this directory or any parent: not found"}) - res = c.RunDockerOrExitError("compose", "up", "-f", "../compose/fixtures/wrong-composefile/compose.yml") + res = c.RunDockerOrExitError("compose", "up", "-f", "../compose/fixtures/wrong-composefile/compose.yaml") res.Assert(t, icmd.Expected{ExitCode: 16, Err: "unknown shorthand flag: 'f' in -f"}) - res = c.RunDockerOrExitError("compose", "up", "--file", "../compose/fixtures/wrong-composefile/compose.yml") + res = c.RunDockerOrExitError("compose", "up", "--file", "../compose/fixtures/wrong-composefile/compose.yaml") res.Assert(t, icmd.Expected{ExitCode: 16, Err: "unknown flag: --file"}) - res = c.RunDockerOrExitError("compose", "donw", "--file", "../compose/fixtures/wrong-composefile/compose.yml") + res = c.RunDockerOrExitError("compose", "donw", "--file", "../compose/fixtures/wrong-composefile/compose.yaml") res.Assert(t, icmd.Expected{ExitCode: 16, Err: `unknown docker command: "compose donw"`}) res = c.RunDockerOrExitError("compose", "--file", "../compose/fixtures/wrong-composefile/build-error.yml", "build") res.Assert(t, icmd.Expected{ExitCode: 17, Err: `line 17: unknown instruction: WRONG`}) diff --git a/local/e2e/compose/restart_test.go b/local/e2e/compose/restart_test.go index 902541bf4..e23854d38 100644 --- a/local/e2e/compose/restart_test.go +++ b/local/e2e/compose/restart_test.go @@ -42,7 +42,7 @@ func TestRestart(t *testing.T) { // This is just to ensure the containers do NOT exist c.RunDockerOrExitError("compose", "--project-name", projectName, "down") - res := c.RunDockerOrExitError("compose", "-f", "./fixtures/restart-test/compose.yml", "--project-name", projectName, "up", "-d") + res := c.RunDockerOrExitError("compose", "-f", "./fixtures/restart-test/compose.yaml", "--project-name", projectName, "up", "-d") assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-restart_restart_1 Started"), res.Combined()) c.WaitForCmdResult(c.NewDockerCmd("compose", "--project-name", projectName, "ps", "-a", "--format", "json"), @@ -52,7 +52,7 @@ func TestRestart(t *testing.T) { res = c.RunDockerOrExitError("compose", "--project-name", projectName, "ps", "-a") testify.Regexp(t, getServiceRegx("restart", "exited"), res.Stdout()) - _ = c.RunDockerOrExitError("compose", "-f", "./fixtures/restart-test/compose.yml", "--project-name", projectName, "restart") + _ = c.RunDockerOrExitError("compose", "-f", "./fixtures/restart-test/compose.yaml", "--project-name", projectName, "restart") // Give the same time but it must NOT exit time.Sleep(time.Second) diff --git a/local/e2e/compose/scan_message_test.go b/local/e2e/compose/scan_message_test.go index 9c0db2507..35c8ff7f9 100644 --- a/local/e2e/compose/scan_message_test.go +++ b/local/e2e/compose/scan_message_test.go @@ -65,18 +65,18 @@ func TestDisplayScanMessageAfterBuild(t *testing.T) { }) t.Run("display on compose build", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test-compose-build", "build") + res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test-compose-build", "build") defer c.RunDockerOrExitError("rmi", "-f", "scan-msg-test-compose-build_nginx") res.Assert(t, icmd.Expected{Err: "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them"}) }) t.Run("do not display on compose build with quiet flag", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test-quiet", "build", "--quiet") + res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test-quiet", "build", "--quiet") assert.Assert(t, !strings.Contains(res.Combined(), "docker scan"), res.Combined()) res = c.RunDockerCmd("rmi", "-f", "scan-msg-test-quiet_nginx") assert.Assert(t, !strings.Contains(res.Combined(), "No such image")) - res = c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test-q", "build", "-q") + res = c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test-q", "build", "-q") defer c.RunDockerOrExitError("rmi", "-f", "scan-msg-test-q_nginx") assert.Assert(t, !strings.Contains(res.Combined(), "docker scan"), res.Combined()) }) @@ -84,14 +84,14 @@ func TestDisplayScanMessageAfterBuild(t *testing.T) { _ = c.RunDockerOrExitError("rmi", "scan-msg-test_nginx") t.Run("display on compose up if image is built", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test", "up", "-d") - defer c.RunDockerOrExitError("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test", "down") + res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test", "up", "-d") + defer c.RunDockerOrExitError("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test", "down") res.Assert(t, icmd.Expected{Err: "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them"}) }) t.Run("do not display on compose up if no image built", func(t *testing.T) { // re-run the same Compose aproject - res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test", "up", "-d") - defer c.RunDockerOrExitError("compose", "-f", "./fixtures/simple-build-test/compose.yml", "-p", "scan-msg-test", "down", "--rmi", "all") + res := c.RunDockerCmd("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test", "up", "-d") + defer c.RunDockerOrExitError("compose", "-f", "./fixtures/simple-build-test/compose.yaml", "-p", "scan-msg-test", "down", "--rmi", "all") assert.Assert(t, !strings.Contains(res.Combined(), "docker scan"), res.Combined()) }) diff --git a/local/e2e/compose/start_stop_test.go b/local/e2e/compose/start_stop_test.go index 854f3f1c7..047c1fe8c 100644 --- a/local/e2e/compose/start_stop_test.go +++ b/local/e2e/compose/start_stop_test.go @@ -44,7 +44,7 @@ func TestStartStop(t *testing.T) { } t.Run("Up a project", func(t *testing.T) { - res := c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yml", "--project-name", projectName, "up", "-d") + res := c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yaml", "--project-name", projectName, "up", "-d") assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop_simple_1 Started"), res.Combined()) res = c.RunDockerCmd("compose", "ls", "--all") @@ -56,7 +56,7 @@ func TestStartStop(t *testing.T) { }) t.Run("stop project", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yml", "--project-name", projectName, "stop") + c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yaml", "--project-name", projectName, "stop") res := c.RunDockerCmd("compose", "ls") assert.Assert(t, !strings.Contains(res.Combined(), "e2e-start-stop"), res.Combined()) @@ -73,21 +73,21 @@ func TestStartStop(t *testing.T) { }) t.Run("start project", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yml", "--project-name", projectName, "start") + c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yaml", "--project-name", projectName, "start") res := c.RunDockerCmd("compose", "ls") testify.Regexp(t, getProjectRegx("running"), res.Stdout()) }) t.Run("pause project", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yml", "--project-name", projectName, "pause") + c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yaml", "--project-name", projectName, "pause") res := c.RunDockerCmd("compose", "ls", "--all") testify.Regexp(t, getProjectRegx("paused"), res.Stdout()) }) t.Run("unpause project", func(t *testing.T) { - c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yml", "--project-name", projectName, "unpause") + c.RunDockerCmd("compose", "-f", "./fixtures/start-stop/compose.yaml", "--project-name", projectName, "unpause") res := c.RunDockerCmd("compose", "ls") testify.Regexp(t, getProjectRegx("running"), res.Stdout()) diff --git a/pkg/compose/kill_test.go b/pkg/compose/kill_test.go index cc75f8bfa..b3a8e3749 100644 --- a/pkg/compose/kill_test.go +++ b/pkg/compose/kill_test.go @@ -84,7 +84,7 @@ func testContainer(service string, id string) moby.Container { func containerLabels(service string) map[string]string { workingdir, _ := filepath.Abs("testdata") - composefile := filepath.Join(workingdir, "docker-compose.yml") + composefile := filepath.Join(workingdir, "compose.yaml") return map[string]string{ compose.ServiceLabel: service, compose.ConfigFilesLabel: composefile, diff --git a/pkg/compose/testdata/docker-compose.yml b/pkg/compose/testdata/compose.yaml similarity index 100% rename from pkg/compose/testdata/docker-compose.yml rename to pkg/compose/testdata/compose.yaml