mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-09 05:54:34 +02:00
tests/integration: Move test "exit_from" to corresponding directory
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
67
tests/integration/exit-from/test_podman_compose_exit_from.py
Normal file
67
tests/integration/exit-from/test_podman_compose_exit_from.py
Normal file
@ -0,0 +1,67 @@
|
||||
# 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():
|
||||
return os.path.join(os.path.join(test_path(), "exit-from"), "docker-compose.yaml")
|
||||
|
||||
|
||||
class TestComposeExitFrom(unittest.TestCase, RunSubprocessMixin):
|
||||
def test_exit_code_sh1(self):
|
||||
try:
|
||||
self.run_subprocess_assert_returncode(
|
||||
[
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"up",
|
||||
"--exit-code-from=sh1",
|
||||
],
|
||||
1,
|
||||
)
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"down",
|
||||
])
|
||||
|
||||
def test_exit_code_sh2(self):
|
||||
try:
|
||||
self.run_subprocess_assert_returncode(
|
||||
[
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"up",
|
||||
"--exit-code-from=sh2",
|
||||
],
|
||||
2,
|
||||
)
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"down",
|
||||
])
|
||||
|
||||
def test_podman_compose_exit_from(self):
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "exit-from", "docker-compose.yaml"),
|
||||
"up",
|
||||
]
|
||||
|
||||
self.run_subprocess_assert_returncode(up_cmd + ["--exit-code-from", "sh1"], 1)
|
||||
self.run_subprocess_assert_returncode(up_cmd + ["--exit-code-from", "sh2"], 2)
|
Reference in New Issue
Block a user