| 1 |
|
| 2 |
|
| 3 |
import os |
| 4 |
import unittest |
| 5 |
|
| 6 |
from tests.integration.test_utils import RunSubprocessMixin |
| 7 |
from tests.integration.test_utils import podman_compose_path |
| 8 |
from tests.integration.test_utils import test_path |
| 9 |
|
| 10 |
|
| 11 |
def compose_yaml_path() -> str: |
| 12 |
"""Returns the path to the compose file used for this test module""" |
| 13 |
base_path = os.path.join(test_path(), "extra_hosts") |
| 14 |
return os.path.join(base_path, "docker-compose.yml") |
| 15 |
|
| 16 |
|
| 17 |
class TestComposeExtraHosts(unittest.TestCase, RunSubprocessMixin): |
| 18 |
def test_extra_hosts(self) -> None: |
| 19 |
try: |
| 20 |
self.run_subprocess_assert_returncode([ |
| 21 |
podman_compose_path(), |
| 22 |
"-f", |
| 23 |
compose_yaml_path(), |
| 24 |
"build", |
| 25 |
"--no-cache", |
| 26 |
]) |
| 27 |
|
| 28 |
self.run_subprocess_assert_returncode([ |
| 29 |
podman_compose_path(), |
| 30 |
"-f", |
| 31 |
compose_yaml_path(), |
| 32 |
"up", |
| 33 |
"-d", |
| 34 |
]) |
| 35 |
|
| 36 |
finally: |
| 37 |
self.run_subprocess_assert_returncode([ |
| 38 |
podman_compose_path(), |
| 39 |
"-f", |
| 40 |
compose_yaml_path(), |
| 41 |
"down", |
| 42 |
]) |