Move all tests to single directory "tests"

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas
2024-06-26 11:01:48 +03:00
parent d38b26bb01
commit 18472b53ac
134 changed files with 118 additions and 53 deletions

View File

@ -9,12 +9,12 @@ from .test_utils import RunSubprocessMixin
def base_path():
"""Returns the base path for the project"""
return Path(__file__).parent.parent
return Path(__file__).parent.parent.parent
def test_path():
"""Returns the path to the tests directory"""
return os.path.join(base_path(), "tests")
return os.path.join(base_path(), "tests/integration")
def podman_compose_path():
@ -29,14 +29,18 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
includes a build context
:return:
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"coverage",
"run",
str(main_path.joinpath("podman_compose.py")),
"-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")),
str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"up",
"-d",
]
@ -46,7 +50,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"run",
str(main_path.joinpath("podman_compose.py")),
"-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")),
str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"ps",
"--format",
'{{.Image}}',
@ -60,7 +68,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode([
str(main_path.joinpath("podman_compose.py")),
"-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")),
str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"down",
])
@ -81,13 +93,17 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
includes an empty service. (e.g. if the file is used as placeholder for more complex
configurations.)
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
str(main_path.joinpath("podman_compose.py")),
"-f",
str(main_path.joinpath("tests", "extends_w_empty_service", "docker-compose.yml")),
str(
main_path.joinpath(
"tests", "integration", "extends_w_empty_service", "docker-compose.yml"
)
),
"up",
"-d",
]

View File

@ -9,12 +9,12 @@ from .test_utils import RunSubprocessMixin
def base_path():
"""Returns the base path for the project"""
return Path(__file__).parent.parent
return Path(__file__).parent.parent.parent
def test_path():
"""Returns the path to the tests directory"""
return os.path.join(base_path(), "tests")
return os.path.join(base_path(), "tests/integration")
def podman_compose_path():
@ -33,14 +33,16 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
Test that podman-compose will not create a pod, when x-podman in_pod=false and command line
does not provide this option
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
str(main_path.joinpath("podman_compose.py")),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"up",
"-d",
@ -51,7 +53,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
podman_compose_path(),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"down",
]
@ -70,7 +74,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
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
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
command_up = [
@ -79,7 +83,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=True",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"up",
"-d",
@ -99,7 +105,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
@ -107,7 +113,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=False",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"up",
"-d",
@ -118,7 +126,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
podman_compose_path(),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"down",
]
@ -137,7 +147,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
Test that podman-compose will not create a pod, when x-podman in_pod=false and command line
command line in_pod=""
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
@ -145,7 +155,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"up",
"-d",
@ -156,7 +168,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
podman_compose_path(),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_false", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_false", "docker-compose.yml"
)
),
"down",
]
@ -176,7 +190,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
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
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container is not created, so command 'down' is not needed
@ -185,7 +199,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
str(main_path.joinpath("podman_compose.py")),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_true", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_true", "docker-compose.yml"
)
),
"up",
"-d",
@ -206,7 +222,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
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
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container is not created, so command 'down' is not needed
@ -216,7 +232,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=True",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_true", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_true", "docker-compose.yml"
)
),
"up",
"-d",
@ -236,7 +254,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
@ -244,7 +262,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=False",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_true", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_true", "docker-compose.yml"
)
),
"up",
"-d",
@ -255,7 +275,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
podman_compose_path(),
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_true", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_true", "docker-compose.yml"
)
),
"down",
]
@ -274,7 +296,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
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
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container is not created, so command 'down' is not needed
@ -284,7 +306,9 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"--in-pod=",
"-f",
str(
main_path.joinpath("tests", "in_pod", "custom_x-podman_true", "docker-compose.yml")
main_path.joinpath(
"tests", "integration", "in_pod", "custom_x-podman_true", "docker-compose.yml"
)
),
"up",
"-d",
@ -306,7 +330,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
Test that podman-compose does not allow pod creating when --userns and --pod are set
together: throws an error
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container is not created, so command 'down' is not needed
@ -316,7 +340,11 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"-f",
str(
main_path.joinpath(
"tests", "in_pod", "custom_x-podman_not_exists", "docker-compose.yml"
"tests",
"integration",
"in_pod",
"custom_x-podman_not_exists",
"docker-compose.yml",
)
),
"up",
@ -338,7 +366,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
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
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container was not created, so command 'down' is not needed
@ -349,7 +377,11 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"-f",
str(
main_path.joinpath(
"tests", "in_pod", "custom_x-podman_not_exists", "docker-compose.yml"
"tests",
"integration",
"in_pod",
"custom_x-podman_not_exists",
"docker-compose.yml",
)
),
"up",
@ -370,7 +402,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"""
Test that podman-compose will not create a pod as command line sets in_pod=False
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
@ -379,7 +411,11 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"-f",
str(
main_path.joinpath(
"tests", "in_pod", "custom_x-podman_not_exists", "docker-compose.yml"
"tests",
"integration",
"in_pod",
"custom_x-podman_not_exists",
"docker-compose.yml",
)
),
"up",
@ -392,7 +428,11 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"-f",
str(
main_path.joinpath(
"tests", "in_pod", "custom_x-podman_not_exists", "docker-compose.yml"
"tests",
"integration",
"in_pod",
"custom_x-podman_not_exists",
"docker-compose.yml",
)
),
"down",
@ -413,7 +453,7 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
Test that podman-compose does not allow pod creating when --userns and --pod are set
together: throws an error
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
# FIXME: creates a pod anyway, although it should not
# Container was not created, so command 'down' is not needed
@ -424,7 +464,11 @@ class TestPodmanComposeInPod(unittest.TestCase, RunSubprocessMixin):
"-f",
str(
main_path.joinpath(
"tests", "in_pod", "custom_x-podman_not_exists", "docker-compose.yml"
"tests",
"integration",
"in_pod",
"custom_x-podman_not_exists",
"docker-compose.yml",
)
),
"up",

Some files were not shown because too many files have changed in this diff Show More