diff --git a/tests/integration/build_fail/README.md b/tests/integration/build_fail/README.md deleted file mode 100644 index 5d5b1ed5..00000000 --- a/tests/integration/build_fail/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Test podman-compose with build (fail scenario) - -```shell -podman-compose build || echo $? -``` - -expected output would be something like - -``` -STEP 1/3: FROM busybox -STEP 2/3: RUN this_command_does_not_exist -/bin/sh: this_command_does_not_exist: not found -Error: building at STEP "RUN this_command_does_not_exist": while running runtime: exit status 127 - -exit code: 127 -``` - -Expected `podman-compose` exit code: -```shell -echo $? -127 -``` diff --git a/tests/integration/test_podman_compose_build_fail.py b/tests/integration/test_podman_compose_build_fail.py new file mode 100644 index 00000000..1bb89a57 --- /dev/null +++ b/tests/integration/test_podman_compose_build_fail.py @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0 + +import os +import unittest + +from tests.integration.test_podman_compose import podman_compose_path +from tests.integration.test_podman_compose import test_path +from tests.integration.test_utils import RunSubprocessMixin + + +def compose_yaml_path(): + """ "Returns the path to the compose file used for this test module""" + base_path = os.path.join(test_path(), "build_fail") + return os.path.join(base_path, "docker-compose.yml") + + +class TestComposeBuildFail(unittest.TestCase, RunSubprocessMixin): + def test_build_fail(self): + output, error = self.run_subprocess_assert_returncode( + [ + podman_compose_path(), + "-f", + compose_yaml_path(), + "build", + ], + expected_returncode=127, + ) + self.assertIn("RUN this_command_does_not_exist", str(output)) + self.assertIn("this_command_does_not_exist: not found", str(error)) + self.assertIn("while running runtime: exit status 127", str(error))