mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-18 21:20:53 +02:00
77 lines
2.0 KiB
Python
77 lines
2.0 KiB
Python
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
import os
|
|
import unittest
|
|
|
|
from tests.integration.test_utils import RunSubprocessMixin
|
|
from tests.integration.test_utils import podman_compose_path
|
|
from tests.integration.test_utils import test_path
|
|
|
|
|
|
def compose_yaml_path(failure_order):
|
|
return os.path.join(
|
|
test_path(),
|
|
"abort",
|
|
f"docker-compose-fail-{failure_order}.yaml"
|
|
)
|
|
|
|
|
|
def test_abort_command(failure_order, abort_type):
|
|
return [
|
|
podman_compose_path(),
|
|
"-f",
|
|
compose_yaml_path(failure_order),
|
|
"up",
|
|
f"--abort-on-container-{abort_type}",
|
|
]
|
|
|
|
|
|
class TestComposeAbort(unittest.TestCase, RunSubprocessMixin):
|
|
def test_abort_on_exit_fail_first(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("first", "exit"),
|
|
0,
|
|
)
|
|
|
|
def test_abort_on_failure_fail_first(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("first", "failure"),
|
|
1,
|
|
)
|
|
|
|
def test_abort_on_exit_fail_second(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("second", "exit"),
|
|
0,
|
|
)
|
|
|
|
def test_abort_on_failure_fail_second(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("second", "failure"),
|
|
1,
|
|
)
|
|
|
|
def test_abort_on_exit_fail_simultaneous(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("simultaneous", "exit"),
|
|
0,
|
|
)
|
|
|
|
def test_abort_on_failure_fail_simultaneous(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("simultaneous", "failure"),
|
|
1,
|
|
)
|
|
|
|
def test_abort_on_exit_fail_none(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("none", "exit"),
|
|
0,
|
|
)
|
|
|
|
def test_abort_on_failure_fail_none(self):
|
|
self.run_subprocess_assert_returncode(
|
|
test_abort_command("none", "failure"),
|
|
0,
|
|
)
|