mirror of
https://github.com/containers/podman-compose.git
synced 2025-02-05 12:59:40 +01:00
tests/integration: Move test "ports" to corresponding directory
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
3cee4e015c
commit
9f7ae38bac
1
tests/integration/ports/__init__.py
Normal file
1
tests/integration/ports/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
|
85
tests/integration/ports/test_podman_compose_ports.py
Normal file
85
tests/integration/ports/test_podman_compose_ports.py
Normal file
@ -0,0 +1,85 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
"""
|
||||
test_podman_compose_up_down.py
|
||||
|
||||
Tests the podman compose up and down commands used to create and remove services.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
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
|
||||
|
||||
|
||||
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
|
||||
def test_up_with_ports(self):
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"up",
|
||||
"-d",
|
||||
"--force-recreate",
|
||||
]
|
||||
|
||||
down_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes",
|
||||
]
|
||||
|
||||
try:
|
||||
self.run_subprocess_assert_returncode(up_cmd)
|
||||
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode(down_cmd)
|
||||
|
||||
def test_down_with_orphans(self):
|
||||
container_id, _ = self.run_subprocess_assert_returncode([
|
||||
"podman",
|
||||
"run",
|
||||
"--rm",
|
||||
"-d",
|
||||
"nopush/podman-compose-test",
|
||||
"dumb-init",
|
||||
"/bin/busybox",
|
||||
"httpd",
|
||||
"-f",
|
||||
"-h",
|
||||
"/etc/",
|
||||
"-p",
|
||||
"8000",
|
||||
])
|
||||
|
||||
down_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes",
|
||||
"--remove-orphans",
|
||||
]
|
||||
|
||||
self.run_subprocess_assert_returncode(down_cmd)
|
||||
|
||||
self.run_subprocess_assert_returncode(
|
||||
[
|
||||
"podman",
|
||||
"container",
|
||||
"exists",
|
||||
container_id.decode("utf-8"),
|
||||
],
|
||||
1,
|
||||
)
|
@ -16,34 +16,6 @@ from tests.integration.test_utils import RunSubprocessMixin
|
||||
|
||||
|
||||
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
|
||||
def test_up_with_ports(self):
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"up",
|
||||
"-d",
|
||||
"--force-recreate",
|
||||
]
|
||||
|
||||
down_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes",
|
||||
]
|
||||
|
||||
try:
|
||||
self.run_subprocess_assert_returncode(up_cmd)
|
||||
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode(down_cmd)
|
||||
|
||||
def test_down_with_vols(self):
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
@ -83,42 +55,3 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
|
||||
self.run_subprocess(["podman", "volume", "rm", "actual-name-of-volume"])
|
||||
self.assertEqual(return_code, 0)
|
||||
|
||||
def test_down_with_orphans(self):
|
||||
container_id, _ = self.run_subprocess_assert_returncode([
|
||||
"podman",
|
||||
"run",
|
||||
"--rm",
|
||||
"-d",
|
||||
"nopush/podman-compose-test",
|
||||
"dumb-init",
|
||||
"/bin/busybox",
|
||||
"httpd",
|
||||
"-f",
|
||||
"-h",
|
||||
"/etc/",
|
||||
"-p",
|
||||
"8000",
|
||||
])
|
||||
|
||||
down_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
os.path.join(test_path(), "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes",
|
||||
"--remove-orphans",
|
||||
]
|
||||
|
||||
self.run_subprocess_assert_returncode(down_cmd)
|
||||
|
||||
self.run_subprocess_assert_returncode(
|
||||
[
|
||||
"podman",
|
||||
"container",
|
||||
"exists",
|
||||
container_id.decode("utf-8"),
|
||||
],
|
||||
1,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user