mirror of
https://github.com/containers/podman-compose.git
synced 2025-01-08 06:59:22 +01:00
tests/integration: Automate manual 'exit-from' tests
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
585d344d0a
commit
9e11c6bfbc
@ -1,15 +0,0 @@
|
|||||||
We have service named sh1 that exits with code 1 and sh2 that exists with code 2
|
|
||||||
|
|
||||||
```
|
|
||||||
podman-compose up --exit-code-from=sh1
|
|
||||||
echo $?
|
|
||||||
```
|
|
||||||
|
|
||||||
the above should give 1.
|
|
||||||
|
|
||||||
```
|
|
||||||
podman-compose up --exit-code-from=sh2
|
|
||||||
echo $?
|
|
||||||
```
|
|
||||||
|
|
||||||
the above should give 2.
|
|
@ -1,11 +1,5 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
too_long:
|
|
||||||
image: nopush/podman-compose-test
|
|
||||||
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 3600; exit 0"]
|
|
||||||
tmpfs:
|
|
||||||
- /run
|
|
||||||
- /tmp
|
|
||||||
sh1:
|
sh1:
|
||||||
image: nopush/podman-compose-test
|
image: nopush/podman-compose-test
|
||||||
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 1; exit 1"]
|
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 1; exit 1"]
|
||||||
|
54
tests/integration/test_podman_compose_exit_from.py
Normal file
54
tests/integration/test_podman_compose_exit_from.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# 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",
|
||||||
|
])
|
Loading…
Reference in New Issue
Block a user