tests/integration: Add type annotations

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas 2025-05-24 17:10:15 +03:00
parent dedb081550
commit a3f48f830d
46 changed files with 175 additions and 167 deletions

View File

@ -2,7 +2,7 @@ import os
import subprocess
def create_base_test_image():
def create_base_test_image() -> None:
subprocess.check_call(
['podman', 'build', '-t', 'nopush/podman-compose-test', '.'],
cwd=os.path.join(os.path.dirname(__file__), "base_image"),

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path(failure_order):
def compose_yaml_path(failure_order: str) -> str:
return os.path.join(test_path(), "abort", f"docker-compose-fail-{failure_order}.yaml")
@ -25,7 +25,7 @@ class TestComposeAbort(unittest.TestCase, RunSubprocessMixin):
("exit", "none", 0),
("failure", "none", 0),
])
def test_abort(self, abort_type, failure_order, expected_exit_code):
def test_abort(self, abort_type: str, failure_order: str, expected_exit_code: int) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -11,13 +11,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
""" "Returns the path to the compose file used for this test module"""
return os.path.join(test_path(), "additional_contexts", "project")
class TestComposeBuildAdditionalContexts(unittest.TestCase):
def test_build_additional_context(self):
def test_build_additional_context(self) -> None:
"""podman build should receive additional contexts as --build-context
See additional_context/project/docker-compose.yaml for context paths

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path(scenario):
def compose_yaml_path(scenario: str) -> str:
return os.path.join(
os.path.join(test_path(), "default_net_behavior"), f"docker-compose_{scenario}.yaml"
)
@ -27,13 +27,13 @@ class TestComposeDefaultNetBehavior(unittest.TestCase, RunSubprocessMixin):
('two_nets_compat', 'default_net_behavior_default'),
('with_default_compat', 'default_net_behavior_default'),
])
def test_nethost(self, scenario, default_net):
def test_nethost(self, scenario: str, default_net: str) -> None:
try:
self.run_subprocess_assert_returncode(
[podman_compose_path(), "-f", compose_yaml_path(scenario), "up", "-d"],
)
container_id, _ = self.run_subprocess_assert_returncode(
container_id_out, _ = self.run_subprocess_assert_returncode(
[
podman_compose_path(),
"-f",
@ -43,7 +43,7 @@ class TestComposeDefaultNetBehavior(unittest.TestCase, RunSubprocessMixin):
'{{.ID}}',
],
)
container_id = container_id.decode('utf-8').split('\n')[0]
container_id = container_id_out.decode('utf-8').split('\n')[0]
output, _ = self.run_subprocess_assert_returncode(
[
"podman",

View File

@ -9,12 +9,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path(suffix=""):
def compose_yaml_path(suffix: str = "") -> str:
return os.path.join(os.path.join(test_path(), "deps"), f"docker-compose{suffix}.yaml")
class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin):
def test_deps(self):
def test_deps(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -37,7 +37,7 @@ class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_run_nodeps(self):
def test_run_nodeps(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -62,7 +62,7 @@ class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_up_nodeps(self):
def test_up_nodeps(self) -> None:
try:
self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -89,7 +89,7 @@ class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_podman_compose_run(self):
def test_podman_compose_run(self) -> None:
"""
This will test depends_on as well
"""
@ -143,7 +143,7 @@ class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin):
class TestComposeConditionalDeps(unittest.TestCase, RunSubprocessMixin):
def test_deps_succeeds(self):
def test_deps_succeeds(self) -> None:
suffix = "-conditional-succeeds"
try:
output, _ = self.run_subprocess_assert_returncode([
@ -167,7 +167,7 @@ class TestComposeConditionalDeps(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_deps_fails(self):
def test_deps_fails(self) -> None:
suffix = "-conditional-fails"
try:
output, _ = self.run_subprocess_assert_returncode([
@ -188,10 +188,10 @@ class TestComposeConditionalDeps(unittest.TestCase, RunSubprocessMixin):
class TestComposeConditionalDepsHealthy(unittest.TestCase, PodmanAwareRunSubprocessMixin):
def setUp(self):
def setUp(self) -> None:
self.podman_version = self.retrieve_podman_version()
def test_up_deps_healthy(self):
def test_up_deps_healthy(self) -> None:
suffix = "-conditional-healthy"
try:
self.run_subprocess_assert_returncode([
@ -261,6 +261,6 @@ class TestComposeConditionalDepsHealthy(unittest.TestCase, PodmanAwareRunSubproc
self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_yaml_path(),
compose_yaml_path(suffix),
"down",
])

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_base_path():
def compose_base_path() -> str:
return os.path.join(test_path(), "env_file_tests")
class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
def test_path_env_file_inline(self):
def test_path_env_file_inline(self) -> None:
# Test taking env variable value directly from env-file when its path is inline path
base_path = compose_base_path()
path_compose_file = os.path.join(base_path, "project/container-compose.yaml")
@ -42,7 +42,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_path_env_file_flat_in_compose_file(self):
def test_path_env_file_flat_in_compose_file(self) -> None:
# Test taking env variable value from env-file/project-1.env which was declared in
# compose file's env_file
base_path = compose_base_path()
@ -74,7 +74,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_path_env_file_obj_in_compose_file(self):
def test_path_env_file_obj_in_compose_file(self) -> None:
# take variable value from env-file project-1.env which was declared in compose
# file's env_file by -path: ...
base_path = compose_base_path()
@ -106,7 +106,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_exists_optional_env_file_path_in_compose_file(self):
def test_exists_optional_env_file_path_in_compose_file(self) -> None:
# test taking env variable values from several env-files when one of them is optional
# and exists
base_path = compose_base_path()
@ -139,7 +139,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_missing_optional_env_file_path_in_compose_file(self):
def test_missing_optional_env_file_path_in_compose_file(self) -> None:
# test taking env variable values from several env-files when one of them is optional and
# is missing (silently skip it)
base_path = compose_base_path()
@ -173,7 +173,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_var_value_inline_overrides_env_file_path_inline(self):
def test_var_value_inline_overrides_env_file_path_inline(self) -> None:
# Test overriding env value when value is declared in inline command
base_path = compose_base_path()
path_compose_file = os.path.join(base_path, "project/container-compose.yaml")
@ -204,7 +204,7 @@ class TestComposeEnvFile(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_taking_env_variables_from_env_files_from_different_directories(self):
def test_taking_env_variables_from_env_files_from_different_directories(self) -> None:
# FIXME: It is not clear what this test actually tests, but from README.md it looks like:
# Test overriding env values by directory env-files-tests/.env file values
# and only take value from project/.env, when it does not exist in env-files-tests/.env

View File

@ -8,14 +8,14 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "env_tests"), "container-compose.yml")
class TestComposeEnv(unittest.TestCase, RunSubprocessMixin):
"""Test that inline environment variable overrides environment variable from compose file."""
def test_env(self):
def test_env(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -50,7 +50,7 @@ class TestComposeEnv(unittest.TestCase, RunSubprocessMixin):
- https://github.com/compose-spec/compose-spec/blob/main/04-version-and-name.md
"""
def test_project_name(self):
def test_project_name(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -68,7 +68,7 @@ class TestComposeEnv(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_project_name_override(self):
def test_project_name_override(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
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):
def test_exit_code_sh1(self) -> None:
try:
self.run_subprocess_assert_returncode(
[
@ -33,7 +33,7 @@ class TestComposeExitFrom(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_exit_code_sh2(self):
def test_exit_code_sh2(self) -> None:
try:
self.run_subprocess_assert_returncode(
[
@ -53,7 +53,7 @@ class TestComposeExitFrom(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_podman_compose_exit_from(self):
def test_podman_compose_exit_from(self) -> None:
up_cmd = [
"coverage",
"run",

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "extends"), "docker-compose.yaml")
class TestComposeExteds(unittest.TestCase, RunSubprocessMixin):
def test_extends_service_launch_echo(self):
def test_extends_service_launch_echo(self) -> None:
try:
self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -38,7 +38,7 @@ class TestComposeExteds(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_extends_service_launch_echo1(self):
def test_extends_service_launch_echo1(self) -> None:
try:
self.run_subprocess_assert_returncode([
podman_compose_path(),
@ -63,7 +63,7 @@ class TestComposeExteds(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_extends_service_launch_env1(self):
def test_extends_service_launch_env1(self) -> None:
try:
self.run_subprocess_assert_returncode([
podman_compose_path(),

View File

@ -9,12 +9,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "extends_w_empty_service"), "docker-compose.yml")
class TestComposeExtendsWithEmptyService(unittest.TestCase, RunSubprocessMixin):
def test_extends_w_empty_service(self):
def test_extends_w_empty_service(self) -> None:
try:
self.run_subprocess_assert_returncode(
[
@ -39,7 +39,7 @@ class TestComposeExtendsWithEmptyService(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_podman_compose_extends_w_empty_service(self):
def test_podman_compose_extends_w_empty_service(self) -> None:
"""
Test that podman-compose can execute podman-compose -f <file> up with extended File which
includes an empty service. (e.g. if the file is used as placeholder for more complex

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "extends_w_file"), "docker-compose.yml")
class TestComposeExtendsWithFile(unittest.TestCase, RunSubprocessMixin):
def test_extends_w_file(self): # when file is Dockerfile for building the image
def test_extends_w_file(self) -> None: # when file is Dockerfile for building the image
try:
self.run_subprocess_assert_returncode(
[

View File

@ -9,12 +9,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "extends_w_file_subdir"), "docker-compose.yml")
class TestComposeExtendsWithFileSubdir(unittest.TestCase, RunSubprocessMixin):
def test_extends_w_file_subdir(self): # when file is Dockerfile for building the image
def test_extends_w_file_subdir(self) -> None: # when file is Dockerfile for building the image
try:
self.run_subprocess_assert_returncode(
[
@ -39,7 +39,7 @@ class TestComposeExtendsWithFileSubdir(unittest.TestCase, RunSubprocessMixin):
"down",
])
def test_podman_compose_extends_w_file_subdir(self):
def test_podman_compose_extends_w_file_subdir(self) -> None:
"""
Test that podman-compose can execute podman-compose -f <file> up with extended File which
includes a build context

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import test_path
class TestFilesystem(unittest.TestCase, RunSubprocessMixin):
def test_compose_symlink(self):
def test_compose_symlink(self) -> None:
"""The context of podman-compose.yml should come from the same directory as the file even
if it is a symlink
"""

View File

@ -6,26 +6,26 @@ import unittest
from tests.integration.test_utils import RunSubprocessMixin
def base_path():
def base_path() -> str:
"""Returns the base path for the project"""
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
def test_path():
def test_path() -> str:
"""Returns the path to the tests directory"""
return os.path.join(base_path(), "tests/integration")
def podman_compose_path():
def podman_compose_path() -> str:
"""Returns the path to the podman compose script"""
return os.path.join(base_path(), "podman_compose.py")
def is_root():
def is_root() -> bool:
return os.geteuid() == 0
def failure_exitcode_when_rootful():
def failure_exitcode_when_rootful() -> int:
if is_root():
return 125
return 0
@ -37,7 +37,7 @@ def failure_exitcode_when_rootful():
# Test all combinations of command line argument in_pod and compose file argument in_pod.
class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# compose file provides x-podman in_pod=false
def test_x_podman_in_pod_false_command_line_in_pod_not_exists(self):
def test_x_podman_in_pod_false_command_line_in_pod_not_exists(self) -> None:
"""
Test that podman-compose will not create a pod, when x-podman in_pod=false and command line
does not provide this option
@ -82,7 +82,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# throws an error, can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, expected_returncode=1)
def test_x_podman_in_pod_false_command_line_in_pod_true(self):
def test_x_podman_in_pod_false_command_line_in_pod_true(self) -> None:
"""
Test that podman-compose does not allow pod creating even with command line in_pod=True
when --userns and --pod are set together: throws an error
@ -115,7 +115,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_false_command_line_in_pod_false(self):
def test_x_podman_in_pod_false_command_line_in_pod_false(self) -> None:
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
@ -160,7 +160,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)
def test_x_podman_in_pod_false_command_line_in_pod_empty_string(self):
def test_x_podman_in_pod_false_command_line_in_pod_empty_string(self) -> None:
"""
Test that podman-compose will not create a pod, when x-podman in_pod=false and command line
command line in_pod=""
@ -207,7 +207,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode(command_rm_pod, 1)
# compose file provides x-podman in_pod=true
def test_x_podman_in_pod_true_command_line_in_pod_not_exists(self):
def test_x_podman_in_pod_true_command_line_in_pod_not_exists(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together even when x-podman in_pod=true: throws an error
@ -240,7 +240,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_true_command_line_in_pod_true(self):
def test_x_podman_in_pod_true_command_line_in_pod_true(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together even when x-podman in_pod=true and and command line in_pod=True: throws an error
@ -274,7 +274,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_true_command_line_in_pod_false(self):
def test_x_podman_in_pod_true_command_line_in_pod_false(self) -> None:
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
@ -319,7 +319,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)
def test_x_podman_in_pod_true_command_line_in_pod_empty_string(self):
def test_x_podman_in_pod_true_command_line_in_pod_empty_string(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together even when x-podman in_pod=true and command line in_pod="": throws an error
@ -354,7 +354,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode(command_rm_pod)
# compose file does not provide x-podman in_pod
def test_x_podman_in_pod_not_exists_command_line_in_pod_not_exists(self):
def test_x_podman_in_pod_not_exists_command_line_in_pod_not_exists(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together: throws an error
@ -387,7 +387,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_not_exists_command_line_in_pod_true(self):
def test_x_podman_in_pod_not_exists_command_line_in_pod_true(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together even when x-podman in_pod=true: throws an error
@ -421,7 +421,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_not_exists_command_line_in_pod_false(self):
def test_x_podman_in_pod_not_exists_command_line_in_pod_false(self) -> None:
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
@ -467,7 +467,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)
def test_x_podman_in_pod_custom_name(self):
def test_x_podman_in_pod_custom_name(self) -> None:
"""
Test that podman-compose will create a pod with a custom name
"""
@ -494,7 +494,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
command_rm_pod = ["podman", "pod", "rm", "custom_test_pod_name"]
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_in_pod_not_exists_command_line_in_pod_empty_string(self):
def test_x_podman_in_pod_not_exists_command_line_in_pod_empty_string(self) -> None:
"""
Test that podman-compose does not allow pod creating when --userns and --pod are set
together: throws an error

View File

@ -7,7 +7,7 @@ from tests.integration.test_utils import RunSubprocessMixin
class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin):
def test_podman_compose_include(self):
def test_podman_compose_include(self) -> None:
"""
Test that podman-compose can execute podman-compose -f <file> up with include
:return:

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "interpolation"), "docker-compose.yml")
class TestComposeInterpolation(unittest.TestCase, RunSubprocessMixin):
def test_interpolation(self):
def test_interpolation(self) -> None:
try:
self.run_subprocess_assert_returncode([
"env",

View File

@ -9,12 +9,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "ipam_default"), "docker-compose.yaml")
class TestComposeIpamDefault(unittest.TestCase, RunSubprocessMixin):
def test_ipam_default(self):
def test_ipam_default(self) -> None:
try:
self.run_subprocess_assert_returncode(
[podman_compose_path(), "-f", compose_yaml_path(), "up", "-d"],

View File

@ -12,7 +12,7 @@ from tests.integration.test_utils import test_path
class TestLifetime(unittest.TestCase, RunSubprocessMixin):
def test_up_single_container(self):
def test_up_single_container(self) -> None:
"""Podman compose up should be able to start containers one after another"""
compose_path = os.path.join(test_path(), "lifetime/up_single_container/docker-compose.yml")
@ -68,7 +68,7 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
("no_ports", "up_single_container_many_times"),
("with_ports", "up_single_container_many_times_with_ports"),
])
def test_up_single_container_many_times(self, name, subdir):
def test_up_single_container_many_times(self, name: str, subdir: str) -> None:
"""Podman compose up should be able to start a container many times after it finishes
running.
"""

View File

@ -9,7 +9,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_attribute/docker-compose.yaml",
@ -18,7 +18,7 @@ def compose_yaml_path():
class TestComposeOverrideTagAttribute(unittest.TestCase, RunSubprocessMixin):
# test if a service attribute from docker-compose.yaml file is overridden
def test_override_tag_attribute(self):
def test_override_tag_attribute(self) -> None:
override_file = os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_attribute/docker-compose.override_attribute.yaml",

View File

@ -9,7 +9,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_service/docker-compose.yaml",
@ -18,7 +18,7 @@ def compose_yaml_path():
class TestComposeOverrideTagService(unittest.TestCase, RunSubprocessMixin):
# test if whole service from docker-compose.yaml file is overridden in another file
def test_override_tag_service(self):
def test_override_tag_service(self) -> None:
override_file = os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_service/docker-compose.override_service.yaml",

View File

@ -8,7 +8,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(
test_path(),
"merge/reset_and_override_tags/reset_tag_attribute/docker-compose.yaml",
@ -17,7 +17,7 @@ def compose_yaml_path():
class TestComposeResetTagAttribute(unittest.TestCase, RunSubprocessMixin):
# test if the attribute of the service is correctly reset
def test_reset_tag_attribute(self):
def test_reset_tag_attribute(self) -> None:
reset_file = os.path.join(
test_path(),
"merge/reset_and_override_tags/reset_tag_attribute/docker-compose.reset_attribute.yaml",

View File

@ -8,7 +8,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(
test_path(), "merge/reset_and_override_tags/reset_tag_service/docker-compose.yaml"
)
@ -16,7 +16,7 @@ def compose_yaml_path():
class TestComposeResetTagService(unittest.TestCase, RunSubprocessMixin):
# test if whole service from docker-compose.yaml file is reset
def test_reset_tag_service(self):
def test_reset_tag_service(self) -> None:
reset_file = os.path.join(
test_path(),
"merge/reset_and_override_tags/reset_tag_service/docker-compose.reset_service.yaml",

View File

@ -9,14 +9,14 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path(compose_name):
def compose_yaml_path(compose_name: str) -> str:
""" "Returns the path to the compose file used for this test module"""
base_path = os.path.join(test_path(), "merge/volumes_merge/")
return os.path.join(base_path, compose_name)
class TestComposeVolumesMerge(unittest.TestCase, RunSubprocessMixin):
def test_volumes_merge(self):
def test_volumes_merge(self) -> None:
# test if additional compose file overrides host path and access mode of a volume
try:
self.run_subprocess_assert_returncode([

View File

@ -8,12 +8,12 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "multicompose"), "docker-compose.yml")
class TestComposeMulticompose(unittest.TestCase, RunSubprocessMixin):
def test_multicompose(self):
def test_multicompose(self) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -10,20 +10,20 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nethost"), "docker-compose.yaml")
class TestComposeNethost(unittest.TestCase, RunSubprocessMixin):
# check if container listens for http requests and sends response back
# as network_mode: host allows to connect to container easily
def test_nethost(self):
def test_nethost(self) -> None:
try:
self.run_subprocess_assert_returncode(
[podman_compose_path(), "-f", compose_yaml_path(), "up", "-d"],
)
container_id, _ = self.run_subprocess_assert_returncode(
container_id_out, _ = self.run_subprocess_assert_returncode(
[
podman_compose_path(),
"-f",
@ -33,7 +33,7 @@ class TestComposeNethost(unittest.TestCase, RunSubprocessMixin):
'{{.ID}}',
],
)
container_id = container_id.decode('utf-8').split('\n')[0]
container_id = container_id_out.decode('utf-8').split('\n')[0]
output, _ = self.run_subprocess_assert_returncode(
[
"podman",

View File

@ -11,13 +11,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nets_test1"), "docker-compose.yml")
class TestComposeNetsTest1(unittest.TestCase, RunSubprocessMixin):
# test if port mapping works as expected
def test_nets_test1(self):
def test_nets_test1(self) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -11,13 +11,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nets_test2"), "docker-compose.yml")
class TestComposeNetsTest2(unittest.TestCase, RunSubprocessMixin):
# test if port mapping works as expected with networks top-level element
def test_nets_test2(self):
def test_nets_test2(self) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nets_test3"), "docker-compose.yml")
@ -28,8 +28,12 @@ class TestComposeNetsTest3(unittest.TestCase, RunSubprocessMixin):
("nets_test3_web1_1", "alias21", b"", 1),
])
def test_nets_test3(
self, container_name, nework_alias_name, expected_text, expected_returncode
):
self,
container_name: str,
nework_alias_name: str,
expected_text: bytes,
expected_returncode: int,
) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -8,14 +8,14 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nets_test_ip"), "docker-compose.yml")
class TestComposeNetsTestIp(unittest.TestCase, RunSubprocessMixin):
# test if services retain custom ipv4_address and mac_address matching the subnet provided
# in networks top-level element
def test_nets_test_ip(self):
def test_nets_test_ip(self) -> None:
try:
self.run_subprocess_assert_returncode(
[

View File

@ -9,6 +9,7 @@ Tests the podman networking parameters
# pylint: disable=redefined-outer-name
import os
import unittest
from typing import Generator
from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import podman_compose_path
@ -17,11 +18,11 @@ from tests.integration.test_utils import test_path
class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
@staticmethod
def compose_file():
def compose_file() -> str:
"""Returns the path to the compose file used for this test module"""
return os.path.join(test_path(), "nets_test_ip", "docker-compose.yml")
def teardown(self):
def teardown(self) -> Generator[None, None, None]:
"""
Ensures that the services within the "profile compose file" are removed between
each test case.
@ -40,7 +41,7 @@ class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
]
self.run_subprocess(down_cmd)
def test_networks(self):
def test_networks(self) -> None:
up_cmd = [
"coverage",
"run",
@ -115,7 +116,7 @@ class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
self.assertIn(f"ether {mac}", out.decode('utf-8'))
self.assertIn(f"inet {ip}/", out.decode('utf-8'))
def test_down_with_network(self):
def test_down_with_network(self) -> None:
try:
self.run_subprocess_assert_returncode([
"coverage",

View File

@ -10,10 +10,10 @@ from tests.integration.test_utils import test_path
class TestPodmanComposeNetworkInterfaceName(RunSubprocessMixin, unittest.TestCase):
def compose_file(self):
def compose_file(self) -> str:
return os.path.join(test_path(), "network_interface_name", "docker-compose.yml")
def up(self):
def up(self) -> None:
up_cmd = [
"coverage",
"run",
@ -26,7 +26,7 @@ class TestPodmanComposeNetworkInterfaceName(RunSubprocessMixin, unittest.TestCas
]
self.run_subprocess_assert_returncode(up_cmd)
def down(self):
def down(self) -> None:
down_cmd = [
"coverage",
"run",
@ -38,7 +38,7 @@ class TestPodmanComposeNetworkInterfaceName(RunSubprocessMixin, unittest.TestCas
]
self.run_subprocess(down_cmd)
def test_interface_name(self):
def test_interface_name(self) -> None:
try:
self.up()

View File

@ -11,18 +11,18 @@ from tests.integration.test_utils import test_path
class TestPodmanComposeNetworkScopedAliases(RunSubprocessMixin, unittest.TestCase):
@staticmethod
def compose_file():
def compose_file() -> str:
"""Returns the path to the compose file used for this test module"""
return os.path.join(test_path(), "network_scoped_aliases", "docker-compose.yaml")
def test_network_scoped_aliases(self):
def test_network_scoped_aliases(self) -> None:
try:
self.up()
self.verify()
finally:
self.down()
def up(self):
def up(self) -> None:
up_cmd = [
"coverage",
"run",
@ -36,7 +36,7 @@ class TestPodmanComposeNetworkScopedAliases(RunSubprocessMixin, unittest.TestCas
self.run_subprocess_assert_returncode(up_cmd)
def down(self):
def down(self) -> None:
down_cmd = [
"coverage",
"run",
@ -48,7 +48,7 @@ class TestPodmanComposeNetworkScopedAliases(RunSubprocessMixin, unittest.TestCas
]
self.run_subprocess(down_cmd)
def verify(self):
def verify(self) -> None:
expected_results = [
("utils-net0", "web1", ["172.19.3.11"]),
("utils-net0", "secure-web", ["172.19.3.11"]),
@ -72,7 +72,7 @@ class TestPodmanComposeNetworkScopedAliases(RunSubprocessMixin, unittest.TestCas
addresses = self.parse_dnslookup(out.decode())
self.assertEqual(addresses, expected_result)
def parse_dnslookup(self, output):
def parse_dnslookup(self, output: str) -> list[str]:
lines = output.splitlines()
addresses = []
for line in lines:

View File

@ -8,13 +8,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "no_services"), "docker-compose.yaml")
class TestComposeNoServices(unittest.TestCase, RunSubprocessMixin):
# test if a network was created, but not the services
def test_no_services(self):
def test_no_services(self) -> None:
try:
output, return_code = self.run_subprocess_assert_returncode(
[

View File

@ -7,23 +7,23 @@ import unittest
from tests.integration.test_utils import RunSubprocessMixin
def base_path():
def base_path() -> str:
"""Returns the base path for the project"""
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
def test_path():
def test_path() -> str:
"""Returns the path to the tests directory"""
return os.path.join(base_path(), "tests/integration")
def podman_compose_path():
def podman_compose_path() -> str:
"""Returns the path to the podman compose script"""
return os.path.join(base_path(), "podman_compose.py")
class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
def load_pod_info(self, pod_name):
def load_pod_info(self, pod_name: str) -> dict:
output, _ = self.run_subprocess_assert_returncode([
"podman",
"pod",
@ -37,7 +37,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
return pod_info[0]
return pod_info
def run_pod_args_test(self, config, args, expected):
def run_pod_args_test(self, config: str, args: list, expected: list) -> None:
"""
Helper to run podman up with a docker-compose.yml config, additional
(--pod-args) arguments and compare the CreateCommand of the resulting
@ -78,7 +78,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
command_rm_pod = ["podman", "pod", "rm", pod_name]
self.run_subprocess_assert_returncode(command_rm_pod)
def test_x_podman_pod_args_unset_unset(self):
def test_x_podman_pod_args_unset_unset(self) -> None:
"""
Test that podman-compose will use the default pod-args when unset in
both docker-compose.yml and command line
@ -89,7 +89,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
["--infra=false", "--share="],
)
def test_x_podman_pod_args_unset_empty(self):
def test_x_podman_pod_args_unset_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when unset in
docker-compose.yml and passing an empty value on the command line
@ -100,7 +100,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
[],
)
def test_x_podman_pod_args_unset_set(self):
def test_x_podman_pod_args_unset_set(self) -> None:
"""
Test that podman-compose will use the passed pod-args when unset in
docker-compose.yml and passing a non-empty value on the command line
@ -111,7 +111,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
["--infra=false", "--share=", "--cpus=1"],
)
def test_x_podman_pod_args_empty_unset(self):
def test_x_podman_pod_args_empty_unset(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to an
empty value in docker-compose.yml and unset on the command line
@ -122,7 +122,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
[],
)
def test_x_podman_pod_args_empty_empty(self):
def test_x_podman_pod_args_empty_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to an
empty value in both docker-compose.yml and command line
@ -133,7 +133,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
[],
)
def test_x_podman_pod_args_empty_set(self):
def test_x_podman_pod_args_empty_set(self) -> None:
"""
Test that podman-compose will use the passed pod-args when set to an
empty value in docker-compose.yml and passing a non-empty value on the
@ -145,7 +145,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
["--infra=false", "--share=", "--cpus=1"],
)
def test_x_podman_pod_args_set_unset(self):
def test_x_podman_pod_args_set_unset(self) -> None:
"""
Test that podman-compose will use the set pod-args when set to a
non-empty value in docker-compose.yml and unset on the command line
@ -156,7 +156,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
["--infra=false", "--share=", "--cpus=2"],
)
def test_x_podman_pod_args_set_empty(self):
def test_x_podman_pod_args_set_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to a
non-empty value in docker-compose.yml and passing an empty value on
@ -168,7 +168,7 @@ class TestPodmanComposePodArgs(unittest.TestCase, RunSubprocessMixin):
[],
)
def test_x_podman_pod_args_set_set(self):
def test_x_podman_pod_args_set_set(self) -> None:
"""
Test that podman-compose will use the passed pod-args when set to a
non-empty value in both docker-compose.yml and command line

View File

@ -15,7 +15,7 @@ from tests.integration.test_utils import test_path
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
def test_up_with_ports(self):
def test_up_with_ports(self) -> None:
up_cmd = [
"coverage",
"run",

View File

@ -17,13 +17,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def profile_compose_file():
def profile_compose_file() -> str:
""" "Returns the path to the `profile` compose file used for this test module"""
return os.path.join(test_path(), "profile", "docker-compose.yml")
class TestComposeConfig(unittest.TestCase, RunSubprocessMixin):
def test_config_no_profiles(self):
def test_config_no_profiles(self) -> None:
"""
Tests podman-compose config command without profile enablement.
"""
@ -59,7 +59,7 @@ class TestComposeConfig(unittest.TestCase, RunSubprocessMixin):
),
],
)
def test_config_profiles(self, profiles, expected_services):
def test_config_profiles(self, profiles: list, expected_services: dict) -> None:
"""
Tests podman-compose
:param profiles: The enabled profiles for the parameterized test.
@ -81,7 +81,7 @@ class TestComposeConfig(unittest.TestCase, RunSubprocessMixin):
self.assertEqual(expected_services, actual_services)
def test_config_quiet(self):
def test_config_quiet(self) -> None:
"""
Tests podman-compose config command with the --quiet flag.
"""

View File

@ -9,6 +9,7 @@ Tests the podman compose up and down commands used to create and remove services
# pylint: disable=redefined-outer-name
import os
import unittest
from typing import List
from parameterized import parameterized
@ -17,13 +18,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def profile_compose_file():
def profile_compose_file() -> str:
""" "Returns the path to the `profile` compose file used for this test module"""
return os.path.join(test_path(), "profile", "docker-compose.yml")
class TestUpDown(unittest.TestCase, RunSubprocessMixin):
def tearDown(self):
def tearDown(self) -> None:
"""
Ensures that the services within the "profile compose file" are removed between each test
case.
@ -60,7 +61,7 @@ class TestUpDown(unittest.TestCase, RunSubprocessMixin):
),
],
)
def test_up(self, profiles, expected_services):
def test_up(self, profiles: List[str], expected_services: dict) -> None:
up_cmd = [
"coverage",
"run",

View File

@ -8,7 +8,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "seccomp"), "docker-compose.yml")
@ -20,7 +20,7 @@ class TestComposeSeccomp(unittest.TestCase, RunSubprocessMixin):
)
# test if seccomp uses custom seccomp profile file 'default.json' where command mkdir is not
# allowed
def test_seccomp(self):
def test_seccomp(self) -> None:
try:
output, _, return_code = self.run_subprocess(
[podman_compose_path(), "-f", compose_yaml_path(), "run", "--rm", "web1"],

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path():
def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "secrets"), "docker-compose.yaml")
@ -22,12 +22,12 @@ class TestComposeNoSecrets(unittest.TestCase, RunSubprocessMixin):
"podman_compose_test_secret_custom_name",
]
def setUp(self):
def setUp(self) -> None:
for secret in self.created_secrets:
p = Popen(["podman", "secret", "create", secret, "-"], stdin=PIPE)
p.communicate(secret.encode('utf-8'))
def tearDown(self):
def tearDown(self) -> None:
for secret in self.created_secrets:
self.run_subprocess_assert_returncode([
"podman",
@ -37,7 +37,7 @@ class TestComposeNoSecrets(unittest.TestCase, RunSubprocessMixin):
])
# test if secrets are saved and available in respective files of a container
def test_secrets(self):
def test_secrets(self) -> None:
try:
_, error, _ = self.run_subprocess(
[

View File

@ -11,7 +11,7 @@ from tests.integration.test_utils import test_path
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
def test_selinux(self):
def test_selinux(self) -> None:
# test if when using volumes type:bind with selinux:z option, container ackquires a
# respective host:source:z mapping in CreateCommand list
compose_path = os.path.join(test_path(), "selinux", "docker-compose.yml")

View File

@ -8,13 +8,13 @@ from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path
def compose_yaml_path(test_ref_folder):
def compose_yaml_path(test_ref_folder: str) -> str:
return os.path.join(test_path(), "service_scale", test_ref_folder, "docker-compose.yml")
class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
# scale-up using `scale` prarmeter in docker-compose.yml
def test_scaleup_scale_parameter(self):
def test_scaleup_scale_parameter(self) -> None:
try:
output, _, return_code = self.run_subprocess([
podman_compose_path(),
@ -43,7 +43,7 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
])
# scale-up using `deploy => replicas` prarmeter in docker-compose.yml
def test_scaleup_deploy_replicas_parameter(self):
def test_scaleup_deploy_replicas_parameter(self) -> None:
try:
output, _, return_code = self.run_subprocess([
podman_compose_path(),
@ -72,7 +72,7 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
])
# scale-up using `--scale <SERVICE>=<number of replicas>` argument in CLI
def test_scaleup_cli(self):
def test_scaleup_cli(self) -> None:
try:
output, _, return_code = self.run_subprocess([
podman_compose_path(),

View File

@ -7,17 +7,17 @@ import time
from pathlib import Path
def base_path():
def base_path() -> Path:
"""Returns the base path for the project"""
return Path(__file__).parent.parent.parent
def test_path():
def test_path() -> str:
"""Returns the path to the tests directory"""
return os.path.join(base_path(), "tests/integration")
def podman_compose_path():
def podman_compose_path() -> str:
"""Returns the path to the podman compose script"""
return os.path.join(base_path(), "podman_compose.py")
@ -31,10 +31,10 @@ def is_systemd_available():
class RunSubprocessMixin:
def is_debug_enabled(self):
def is_debug_enabled(self) -> bool:
return "TESTS_DEBUG" in os.environ
def run_subprocess(self, args):
def run_subprocess(self, args: list[str]) -> tuple[bytes, bytes, int]:
begin = time.time()
if self.is_debug_enabled():
print("TEST_CALL", args)
@ -50,11 +50,13 @@ class RunSubprocessMixin:
print("STDERR:", err.decode('utf-8'))
return out, err, proc.returncode
def run_subprocess_assert_returncode(self, args, expected_returncode=0):
def run_subprocess_assert_returncode(
self, args: list[str], expected_returncode: int = 0
) -> tuple[bytes, bytes]:
out, err, returncode = self.run_subprocess(args)
decoded_out = out.decode('utf-8')
decoded_err = err.decode('utf-8')
self.assertEqual(
self.assertEqual( # type: ignore[attr-defined]
returncode,
expected_returncode,
f"Invalid return code of process {returncode} != {expected_returncode}\n"

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import test_path
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
def test_uidmaps(self):
def test_uidmaps(self) -> None:
compose_path = os.path.join(test_path(), "uidmaps", "docker-compose.yml")
try:
self.run_subprocess_assert_returncode([

View File

@ -10,7 +10,7 @@ from tests.integration.test_utils import test_path
class TestUlimit(unittest.TestCase, RunSubprocessMixin):
def test_ulimit(self):
def test_ulimit(self) -> None:
compose_path = os.path.join(test_path(), "ulimit/docker-compose.yaml")
try:
self.run_subprocess_assert_returncode([

View File

@ -26,7 +26,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"--force-recreate",
]
def setUp(self):
def setUp(self) -> None:
"""
Retag the debian image before each test to no mess with the other integration tests when
testing the `--rmi` argument
@ -40,7 +40,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode(tag_cmd)
@classmethod
def tearDownClass(cls):
def tearDownClass(cls) -> None:
"""
Ensures that the images that were created for this tests will be removed
"""
@ -54,7 +54,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
]
cls().run_subprocess_assert_returncode(rmi_cmd)
def test_down(self):
def test_down(self) -> None:
down_cmd = [
"coverage",
"run",
@ -116,7 +116,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"docker.io/library/debian:up-down-test",
])
def test_down_with_volumes(self):
def test_down_with_volumes(self) -> None:
down_cmd = [
"coverage",
"run",
@ -179,7 +179,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"docker.io/library/debian:up-down-test",
])
def test_down_without_orphans(self):
def test_down_without_orphans(self) -> None:
down_cmd = [
"coverage",
"run",
@ -258,7 +258,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
)
self.run_subprocess_assert_returncode(["podman", "volume", "exists", "up_down_web2_vol"], 1)
def test_down_with_orphans(self):
def test_down_with_orphans(self) -> None:
down_cmd = [
"coverage",
"run",
@ -322,7 +322,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"docker.io/library/debian:up-down-test",
])
def test_down_with_images_default(self):
def test_down_with_images_default(self) -> None:
down_cmd = [
"coverage",
"run",
@ -379,7 +379,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
["podman", "image", "exists", "docker.io/library/debian:up-down-test"], 1
)
def test_down_with_images_all(self):
def test_down_with_images_all(self) -> None:
down_cmd = [
"coverage",
"run",
@ -437,7 +437,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
["podman", "image", "exists", "docker.io/library/debian:up-down-test"], 1
)
def test_down_with_images_all_and_orphans(self):
def test_down_with_images_all_and_orphans(self) -> None:
down_cmd = [
"coverage",
"run",
@ -497,7 +497,7 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
["podman", "image", "exists", "docker.io/library/debian:up-down-test"], 1
)
def test_down_with_images_local(self):
def test_down_with_images_local(self) -> None:
down_cmd = [
"coverage",
"run",

View File

@ -16,7 +16,7 @@ from tests.integration.test_utils import test_path
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
def test_down_with_vols(self):
def test_down_with_vols(self) -> None:
up_cmd = [
"coverage",
"run",