From c621096f04ffd66c8a1e6d16033ffa9930347216 Mon Sep 17 00:00:00 2001 From: Monika Kairaityte Date: Mon, 8 Jul 2024 18:39:56 +0200 Subject: [PATCH] tests/integration: Automate 'build_failed' manual test --- .../test_podman_compose_build_fail.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/integration/test_podman_compose_build_fail.py 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 0000000..357515f --- /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_utils import RunSubprocessMixin + +from .test_podman_compose import podman_compose_path +from .test_podman_compose import test_path + + +def compose_yaml_path(): + """ "Returns the path to the compose file used for this test module""" + print("PATH = ", os.path.join(test_path(), "build_fail")) + return os.path.join(test_path(), "build_fail") + + +class TestComposeBuildFail(unittest.TestCase, RunSubprocessMixin): + def test_build_fail(self): + command_build = [ + podman_compose_path(), + "-f", + os.path.join(compose_yaml_path(), "docker-compose.yml"), + "build", + ] + output, error = self.run_subprocess_assert_returncode(command_build, + expected_returncode=127) + self.assertTrue("RUN this_command_does_not_exist" in str(output)) + self.assertTrue("this_command_does_not_exist: not found" in str(error)) + self.assertTrue("while running runtime: exit status 127" in str(error))