tests/integration: Add test for run command failure exit code

Test is added to confirm that `run` command forwards non-zero failure
exit code.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
Monika Kairaityte
2025-07-02 20:02:03 +03:00
parent 256b51c8ee
commit c1ca9166c6

View File

@ -51,3 +51,26 @@ class TestComposeBuildFailMulti(unittest.TestCase, RunSubprocessMixin):
compose_yaml_path(), compose_yaml_path(),
"down", "down",
]) ])
def test_run_command_fail(self) -> None:
# test that run command is able to return other than "0" return code
try:
output, error = self.run_subprocess_assert_returncode(
[
podman_compose_path(),
"-f",
compose_yaml_path(),
"run",
"bad",
],
expected_returncode=125,
)
self.assertIn("RUN false", str(output))
self.assertIn("while running runtime: exit status 1", str(error))
finally:
self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_yaml_path(),
"down",
])