diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76d88f7..e2d019e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,14 +26,14 @@ jobs: python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - - name: Run tests in tests/ + - name: Run integration tests run: | - python -m unittest -v tests/*.py + python -m unittest -v tests/integration/*.py env: TESTS_DEBUG: 1 - - name: Run tests in pytests/ + - name: Run unit tests run: | - coverage run --source podman_compose -m unittest pytests/*.py + coverage run --source podman_compose -m unittest tests/unit/*.py - name: Report coverage run: | coverage combine diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f98e29..3d7bfef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,8 +54,8 @@ Note: Some steps are OPTIONAL but all are RECOMMENDED. 7. Run code coverage: ```shell - $ coverage run --source podman_compose -m unittest pytests/*.py - $ python -m unittest tests/*.py + $ coverage run --source podman_compose -m unittest tests/unit/*.py + $ python -m unittest tests/integration/*.py $ coverage combine $ coverage report $ coverage html diff --git a/tests/__init__.py b/tests/integration/__init__.py similarity index 100% rename from tests/__init__.py rename to tests/integration/__init__.py diff --git a/tests/additional_contexts/README.md b/tests/integration/additional_contexts/README.md similarity index 100% rename from tests/additional_contexts/README.md rename to tests/integration/additional_contexts/README.md diff --git a/tests/additional_contexts/data_for_dict/data.txt b/tests/integration/additional_contexts/data_for_dict/data.txt similarity index 100% rename from tests/additional_contexts/data_for_dict/data.txt rename to tests/integration/additional_contexts/data_for_dict/data.txt diff --git a/tests/additional_contexts/data_for_list/data.txt b/tests/integration/additional_contexts/data_for_list/data.txt similarity index 100% rename from tests/additional_contexts/data_for_list/data.txt rename to tests/integration/additional_contexts/data_for_list/data.txt diff --git a/tests/additional_contexts/project/Dockerfile b/tests/integration/additional_contexts/project/Dockerfile similarity index 100% rename from tests/additional_contexts/project/Dockerfile rename to tests/integration/additional_contexts/project/Dockerfile diff --git a/tests/additional_contexts/project/docker-compose.yml b/tests/integration/additional_contexts/project/docker-compose.yml similarity index 100% rename from tests/additional_contexts/project/docker-compose.yml rename to tests/integration/additional_contexts/project/docker-compose.yml diff --git a/tests/base_image/Dockerfile b/tests/integration/base_image/Dockerfile similarity index 100% rename from tests/base_image/Dockerfile rename to tests/integration/base_image/Dockerfile diff --git a/tests/build/README.md b/tests/integration/build/README.md similarity index 100% rename from tests/build/README.md rename to tests/integration/build/README.md diff --git a/tests/build/context/Dockerfile b/tests/integration/build/context/Dockerfile similarity index 100% rename from tests/build/context/Dockerfile rename to tests/integration/build/context/Dockerfile diff --git a/tests/build/context/Dockerfile-alt b/tests/integration/build/context/Dockerfile-alt similarity index 100% rename from tests/build/context/Dockerfile-alt rename to tests/integration/build/context/Dockerfile-alt diff --git a/tests/build/docker-compose.yml b/tests/integration/build/docker-compose.yml similarity index 100% rename from tests/build/docker-compose.yml rename to tests/integration/build/docker-compose.yml diff --git a/tests/build_fail/README.md b/tests/integration/build_fail/README.md similarity index 100% rename from tests/build_fail/README.md rename to tests/integration/build_fail/README.md diff --git a/tests/build_fail/context/Dockerfile b/tests/integration/build_fail/context/Dockerfile similarity index 100% rename from tests/build_fail/context/Dockerfile rename to tests/integration/build_fail/context/Dockerfile diff --git a/tests/build_fail/docker-compose.yml b/tests/integration/build_fail/docker-compose.yml similarity index 100% rename from tests/build_fail/docker-compose.yml rename to tests/integration/build_fail/docker-compose.yml diff --git a/tests/build_secrets/Dockerfile b/tests/integration/build_secrets/Dockerfile similarity index 100% rename from tests/build_secrets/Dockerfile rename to tests/integration/build_secrets/Dockerfile diff --git a/tests/build_secrets/docker-compose.yaml b/tests/integration/build_secrets/docker-compose.yaml similarity index 100% rename from tests/build_secrets/docker-compose.yaml rename to tests/integration/build_secrets/docker-compose.yaml diff --git a/tests/build_secrets/docker-compose.yaml.invalid b/tests/integration/build_secrets/docker-compose.yaml.invalid similarity index 100% rename from tests/build_secrets/docker-compose.yaml.invalid rename to tests/integration/build_secrets/docker-compose.yaml.invalid diff --git a/tests/build_secrets/my_secret b/tests/integration/build_secrets/my_secret similarity index 100% rename from tests/build_secrets/my_secret rename to tests/integration/build_secrets/my_secret diff --git a/tests/deps/README.md b/tests/integration/deps/README.md similarity index 100% rename from tests/deps/README.md rename to tests/integration/deps/README.md diff --git a/tests/deps/docker-compose.yaml b/tests/integration/deps/docker-compose.yaml similarity index 100% rename from tests/deps/docker-compose.yaml rename to tests/integration/deps/docker-compose.yaml diff --git a/tests/env-file-tests/.env b/tests/integration/env-file-tests/.env similarity index 100% rename from tests/env-file-tests/.env rename to tests/integration/env-file-tests/.env diff --git a/tests/env-file-tests/.gitignore b/tests/integration/env-file-tests/.gitignore similarity index 100% rename from tests/env-file-tests/.gitignore rename to tests/integration/env-file-tests/.gitignore diff --git a/tests/env-file-tests/README.md b/tests/integration/env-file-tests/README.md similarity index 100% rename from tests/env-file-tests/README.md rename to tests/integration/env-file-tests/README.md diff --git a/tests/env-file-tests/env-files/project-1.env b/tests/integration/env-file-tests/env-files/project-1.env similarity index 100% rename from tests/env-file-tests/env-files/project-1.env rename to tests/integration/env-file-tests/env-files/project-1.env diff --git a/tests/env-file-tests/env-files/project-2.env b/tests/integration/env-file-tests/env-files/project-2.env similarity index 100% rename from tests/env-file-tests/env-files/project-2.env rename to tests/integration/env-file-tests/env-files/project-2.env diff --git a/tests/env-file-tests/project/.env b/tests/integration/env-file-tests/project/.env similarity index 100% rename from tests/env-file-tests/project/.env rename to tests/integration/env-file-tests/project/.env diff --git a/tests/env-file-tests/project/container-compose.env-file-flat.yaml b/tests/integration/env-file-tests/project/container-compose.env-file-flat.yaml similarity index 100% rename from tests/env-file-tests/project/container-compose.env-file-flat.yaml rename to tests/integration/env-file-tests/project/container-compose.env-file-flat.yaml diff --git a/tests/env-file-tests/project/container-compose.env-file-obj-optional.yaml b/tests/integration/env-file-tests/project/container-compose.env-file-obj-optional.yaml similarity index 100% rename from tests/env-file-tests/project/container-compose.env-file-obj-optional.yaml rename to tests/integration/env-file-tests/project/container-compose.env-file-obj-optional.yaml diff --git a/tests/env-file-tests/project/container-compose.env-file-obj.yaml b/tests/integration/env-file-tests/project/container-compose.env-file-obj.yaml similarity index 100% rename from tests/env-file-tests/project/container-compose.env-file-obj.yaml rename to tests/integration/env-file-tests/project/container-compose.env-file-obj.yaml diff --git a/tests/env-file-tests/project/container-compose.load-.env-in-project.yaml b/tests/integration/env-file-tests/project/container-compose.load-.env-in-project.yaml similarity index 100% rename from tests/env-file-tests/project/container-compose.load-.env-in-project.yaml rename to tests/integration/env-file-tests/project/container-compose.load-.env-in-project.yaml diff --git a/tests/env-file-tests/project/container-compose.yaml b/tests/integration/env-file-tests/project/container-compose.yaml similarity index 100% rename from tests/env-file-tests/project/container-compose.yaml rename to tests/integration/env-file-tests/project/container-compose.yaml diff --git a/tests/env-tests/README.md b/tests/integration/env-tests/README.md similarity index 100% rename from tests/env-tests/README.md rename to tests/integration/env-tests/README.md diff --git a/tests/env-tests/container-compose.yml b/tests/integration/env-tests/container-compose.yml similarity index 100% rename from tests/env-tests/container-compose.yml rename to tests/integration/env-tests/container-compose.yml diff --git a/tests/exit-from/README.md b/tests/integration/exit-from/README.md similarity index 100% rename from tests/exit-from/README.md rename to tests/integration/exit-from/README.md diff --git a/tests/exit-from/docker-compose.yaml b/tests/integration/exit-from/docker-compose.yaml similarity index 100% rename from tests/exit-from/docker-compose.yaml rename to tests/integration/exit-from/docker-compose.yaml diff --git a/tests/extends/docker-compose.yaml b/tests/integration/extends/docker-compose.yaml similarity index 100% rename from tests/extends/docker-compose.yaml rename to tests/integration/extends/docker-compose.yaml diff --git a/tests/extends_w_empty_service/common-services.yml b/tests/integration/extends_w_empty_service/common-services.yml similarity index 100% rename from tests/extends_w_empty_service/common-services.yml rename to tests/integration/extends_w_empty_service/common-services.yml diff --git a/tests/extends_w_empty_service/docker-compose.yml b/tests/integration/extends_w_empty_service/docker-compose.yml similarity index 100% rename from tests/extends_w_empty_service/docker-compose.yml rename to tests/integration/extends_w_empty_service/docker-compose.yml diff --git a/tests/extends_w_file/common-services.yml b/tests/integration/extends_w_file/common-services.yml similarity index 100% rename from tests/extends_w_file/common-services.yml rename to tests/integration/extends_w_file/common-services.yml diff --git a/tests/extends_w_file/docker-compose.yml b/tests/integration/extends_w_file/docker-compose.yml similarity index 100% rename from tests/extends_w_file/docker-compose.yml rename to tests/integration/extends_w_file/docker-compose.yml diff --git a/tests/extends_w_file_subdir/docker-compose.yml b/tests/integration/extends_w_file_subdir/docker-compose.yml similarity index 100% rename from tests/extends_w_file_subdir/docker-compose.yml rename to tests/integration/extends_w_file_subdir/docker-compose.yml diff --git a/tests/extends_w_file_subdir/sub/docker-compose.yml b/tests/integration/extends_w_file_subdir/sub/docker-compose.yml similarity index 100% rename from tests/extends_w_file_subdir/sub/docker-compose.yml rename to tests/integration/extends_w_file_subdir/sub/docker-compose.yml diff --git a/tests/extends_w_file_subdir/sub/docker/example/Dockerfile b/tests/integration/extends_w_file_subdir/sub/docker/example/Dockerfile similarity index 100% rename from tests/extends_w_file_subdir/sub/docker/example/Dockerfile rename to tests/integration/extends_w_file_subdir/sub/docker/example/Dockerfile diff --git a/tests/in_pod/custom_x-podman_false/docker-compose.yml b/tests/integration/in_pod/custom_x-podman_false/docker-compose.yml similarity index 100% rename from tests/in_pod/custom_x-podman_false/docker-compose.yml rename to tests/integration/in_pod/custom_x-podman_false/docker-compose.yml diff --git a/tests/in_pod/custom_x-podman_not_exists/docker-compose.yml b/tests/integration/in_pod/custom_x-podman_not_exists/docker-compose.yml similarity index 100% rename from tests/in_pod/custom_x-podman_not_exists/docker-compose.yml rename to tests/integration/in_pod/custom_x-podman_not_exists/docker-compose.yml diff --git a/tests/in_pod/custom_x-podman_true/docker-compose.yml b/tests/integration/in_pod/custom_x-podman_true/docker-compose.yml similarity index 100% rename from tests/in_pod/custom_x-podman_true/docker-compose.yml rename to tests/integration/in_pod/custom_x-podman_true/docker-compose.yml diff --git a/tests/include/docker-compose.base.yaml b/tests/integration/include/docker-compose.base.yaml similarity index 100% rename from tests/include/docker-compose.base.yaml rename to tests/integration/include/docker-compose.base.yaml diff --git a/tests/include/docker-compose.extend.yaml b/tests/integration/include/docker-compose.extend.yaml similarity index 100% rename from tests/include/docker-compose.extend.yaml rename to tests/integration/include/docker-compose.extend.yaml diff --git a/tests/include/docker-compose.yaml b/tests/integration/include/docker-compose.yaml similarity index 100% rename from tests/include/docker-compose.yaml rename to tests/integration/include/docker-compose.yaml diff --git a/tests/interpolation/.env b/tests/integration/interpolation/.env similarity index 100% rename from tests/interpolation/.env rename to tests/integration/interpolation/.env diff --git a/tests/interpolation/docker-compose-colon-question-error.yml b/tests/integration/interpolation/docker-compose-colon-question-error.yml similarity index 100% rename from tests/interpolation/docker-compose-colon-question-error.yml rename to tests/integration/interpolation/docker-compose-colon-question-error.yml diff --git a/tests/interpolation/docker-compose-question-error.yml b/tests/integration/interpolation/docker-compose-question-error.yml similarity index 100% rename from tests/interpolation/docker-compose-question-error.yml rename to tests/integration/interpolation/docker-compose-question-error.yml diff --git a/tests/interpolation/docker-compose.yml b/tests/integration/interpolation/docker-compose.yml similarity index 100% rename from tests/interpolation/docker-compose.yml rename to tests/integration/interpolation/docker-compose.yml diff --git a/tests/ipam_default/docker-compose.yaml b/tests/integration/ipam_default/docker-compose.yaml similarity index 100% rename from tests/ipam_default/docker-compose.yaml rename to tests/integration/ipam_default/docker-compose.yaml diff --git a/tests/multicompose/README.md b/tests/integration/multicompose/README.md similarity index 100% rename from tests/multicompose/README.md rename to tests/integration/multicompose/README.md diff --git a/tests/multicompose/d1/1.env b/tests/integration/multicompose/d1/1.env similarity index 100% rename from tests/multicompose/d1/1.env rename to tests/integration/multicompose/d1/1.env diff --git a/tests/multicompose/d1/12.env b/tests/integration/multicompose/d1/12.env similarity index 100% rename from tests/multicompose/d1/12.env rename to tests/integration/multicompose/d1/12.env diff --git a/tests/multicompose/d1/2.env b/tests/integration/multicompose/d1/2.env similarity index 100% rename from tests/multicompose/d1/2.env rename to tests/integration/multicompose/d1/2.env diff --git a/tests/multicompose/d1/docker-compose.yml b/tests/integration/multicompose/d1/docker-compose.yml similarity index 100% rename from tests/multicompose/d1/docker-compose.yml rename to tests/integration/multicompose/d1/docker-compose.yml diff --git a/tests/multicompose/d2/12.env b/tests/integration/multicompose/d2/12.env similarity index 100% rename from tests/multicompose/d2/12.env rename to tests/integration/multicompose/d2/12.env diff --git a/tests/multicompose/d2/2.env b/tests/integration/multicompose/d2/2.env similarity index 100% rename from tests/multicompose/d2/2.env rename to tests/integration/multicompose/d2/2.env diff --git a/tests/multicompose/d2/docker-compose.yml b/tests/integration/multicompose/d2/docker-compose.yml similarity index 100% rename from tests/multicompose/d2/docker-compose.yml rename to tests/integration/multicompose/d2/docker-compose.yml diff --git a/tests/nethost/docker-compose.yaml b/tests/integration/nethost/docker-compose.yaml similarity index 100% rename from tests/nethost/docker-compose.yaml rename to tests/integration/nethost/docker-compose.yaml diff --git a/tests/netprio/docker-compose.yaml b/tests/integration/netprio/docker-compose.yaml similarity index 100% rename from tests/netprio/docker-compose.yaml rename to tests/integration/netprio/docker-compose.yaml diff --git a/tests/nets_test1/docker-compose.yml b/tests/integration/nets_test1/docker-compose.yml similarity index 100% rename from tests/nets_test1/docker-compose.yml rename to tests/integration/nets_test1/docker-compose.yml diff --git a/tests/nets_test1/test1.txt b/tests/integration/nets_test1/test1.txt similarity index 100% rename from tests/nets_test1/test1.txt rename to tests/integration/nets_test1/test1.txt diff --git a/tests/nets_test1/test2.txt b/tests/integration/nets_test1/test2.txt similarity index 100% rename from tests/nets_test1/test2.txt rename to tests/integration/nets_test1/test2.txt diff --git a/tests/nets_test2/docker-compose.yml b/tests/integration/nets_test2/docker-compose.yml similarity index 100% rename from tests/nets_test2/docker-compose.yml rename to tests/integration/nets_test2/docker-compose.yml diff --git a/tests/nets_test2/test1.txt b/tests/integration/nets_test2/test1.txt similarity index 100% rename from tests/nets_test2/test1.txt rename to tests/integration/nets_test2/test1.txt diff --git a/tests/nets_test2/test2.txt b/tests/integration/nets_test2/test2.txt similarity index 100% rename from tests/nets_test2/test2.txt rename to tests/integration/nets_test2/test2.txt diff --git a/tests/nets_test3/docker-compose.yml b/tests/integration/nets_test3/docker-compose.yml similarity index 100% rename from tests/nets_test3/docker-compose.yml rename to tests/integration/nets_test3/docker-compose.yml diff --git a/tests/nets_test3/test1.txt b/tests/integration/nets_test3/test1.txt similarity index 100% rename from tests/nets_test3/test1.txt rename to tests/integration/nets_test3/test1.txt diff --git a/tests/nets_test3/test2.txt b/tests/integration/nets_test3/test2.txt similarity index 100% rename from tests/nets_test3/test2.txt rename to tests/integration/nets_test3/test2.txt diff --git a/tests/nets_test_ip/docker-compose.yml b/tests/integration/nets_test_ip/docker-compose.yml similarity index 100% rename from tests/nets_test_ip/docker-compose.yml rename to tests/integration/nets_test_ip/docker-compose.yml diff --git a/tests/nets_test_ip/test1.txt b/tests/integration/nets_test_ip/test1.txt similarity index 100% rename from tests/nets_test_ip/test1.txt rename to tests/integration/nets_test_ip/test1.txt diff --git a/tests/nets_test_ip/test2.txt b/tests/integration/nets_test_ip/test2.txt similarity index 100% rename from tests/nets_test_ip/test2.txt rename to tests/integration/nets_test_ip/test2.txt diff --git a/tests/nets_test_ip/test3.txt b/tests/integration/nets_test_ip/test3.txt similarity index 100% rename from tests/nets_test_ip/test3.txt rename to tests/integration/nets_test_ip/test3.txt diff --git a/tests/nets_test_ip/test4.txt b/tests/integration/nets_test_ip/test4.txt similarity index 100% rename from tests/nets_test_ip/test4.txt rename to tests/integration/nets_test_ip/test4.txt diff --git a/tests/no_services/docker-compose.yaml b/tests/integration/no_services/docker-compose.yaml similarity index 100% rename from tests/no_services/docker-compose.yaml rename to tests/integration/no_services/docker-compose.yaml diff --git a/tests/pid/docker-compose.yml b/tests/integration/pid/docker-compose.yml similarity index 100% rename from tests/pid/docker-compose.yml rename to tests/integration/pid/docker-compose.yml diff --git a/tests/ports/docker-compose.yml b/tests/integration/ports/docker-compose.yml similarity index 100% rename from tests/ports/docker-compose.yml rename to tests/integration/ports/docker-compose.yml diff --git a/tests/ports/test1.txt b/tests/integration/ports/test1.txt similarity index 100% rename from tests/ports/test1.txt rename to tests/integration/ports/test1.txt diff --git a/tests/ports/test2.txt b/tests/integration/ports/test2.txt similarity index 100% rename from tests/ports/test2.txt rename to tests/integration/ports/test2.txt diff --git a/tests/profile/docker-compose.yml b/tests/integration/profile/docker-compose.yml similarity index 100% rename from tests/profile/docker-compose.yml rename to tests/integration/profile/docker-compose.yml diff --git a/tests/seccomp/docker-compose.yml b/tests/integration/seccomp/docker-compose.yml similarity index 100% rename from tests/seccomp/docker-compose.yml rename to tests/integration/seccomp/docker-compose.yml diff --git a/tests/secrets/bad_external_name/docker-compose.yaml b/tests/integration/secrets/bad_external_name/docker-compose.yaml similarity index 100% rename from tests/secrets/bad_external_name/docker-compose.yaml rename to tests/integration/secrets/bad_external_name/docker-compose.yaml diff --git a/tests/secrets/bad_external_target/docker-compose.yaml b/tests/integration/secrets/bad_external_target/docker-compose.yaml similarity index 100% rename from tests/secrets/bad_external_target/docker-compose.yaml rename to tests/integration/secrets/bad_external_target/docker-compose.yaml diff --git a/tests/secrets/docker-compose.yaml b/tests/integration/secrets/docker-compose.yaml similarity index 100% rename from tests/secrets/docker-compose.yaml rename to tests/integration/secrets/docker-compose.yaml diff --git a/tests/secrets/my_secret b/tests/integration/secrets/my_secret similarity index 100% rename from tests/secrets/my_secret rename to tests/integration/secrets/my_secret diff --git a/tests/secrets/print_secrets.sh b/tests/integration/secrets/print_secrets.sh similarity index 100% rename from tests/secrets/print_secrets.sh rename to tests/integration/secrets/print_secrets.sh diff --git a/tests/selinux/docker-compose.yml b/tests/integration/selinux/docker-compose.yml similarity index 100% rename from tests/selinux/docker-compose.yml rename to tests/integration/selinux/docker-compose.yml diff --git a/tests/short/data/redis/.keep b/tests/integration/short/data/redis/.keep similarity index 100% rename from tests/short/data/redis/.keep rename to tests/integration/short/data/redis/.keep diff --git a/tests/short/data/web/.keep b/tests/integration/short/data/web/.keep similarity index 100% rename from tests/short/data/web/.keep rename to tests/integration/short/data/web/.keep diff --git a/tests/short/docker-compose.yaml b/tests/integration/short/docker-compose.yaml similarity index 100% rename from tests/short/docker-compose.yaml rename to tests/integration/short/docker-compose.yaml diff --git a/tests/test_podman_compose.py b/tests/integration/test_podman_compose.py similarity index 72% rename from tests/test_podman_compose.py rename to tests/integration/test_podman_compose.py index 1ad0d6e..4d166d9 100644 --- a/tests/test_podman_compose.py +++ b/tests/integration/test_podman_compose.py @@ -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", ] diff --git a/tests/test_podman_compose_additional_contexts.py b/tests/integration/test_podman_compose_additional_contexts.py similarity index 100% rename from tests/test_podman_compose_additional_contexts.py rename to tests/integration/test_podman_compose_additional_contexts.py diff --git a/tests/test_podman_compose_build_secrets.py b/tests/integration/test_podman_compose_build_secrets.py similarity index 100% rename from tests/test_podman_compose_build_secrets.py rename to tests/integration/test_podman_compose_build_secrets.py diff --git a/tests/test_podman_compose_build_ulimits.py b/tests/integration/test_podman_compose_build_ulimits.py similarity index 100% rename from tests/test_podman_compose_build_ulimits.py rename to tests/integration/test_podman_compose_build_ulimits.py diff --git a/tests/test_podman_compose_config.py b/tests/integration/test_podman_compose_config.py similarity index 100% rename from tests/test_podman_compose_config.py rename to tests/integration/test_podman_compose_config.py diff --git a/tests/test_podman_compose_in_pod.py b/tests/integration/test_podman_compose_in_pod.py similarity index 79% rename from tests/test_podman_compose_in_pod.py rename to tests/integration/test_podman_compose_in_pod.py index ed66a17..33176bd 100644 --- a/tests/test_podman_compose_in_pod.py +++ b/tests/integration/test_podman_compose_in_pod.py @@ -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", diff --git a/tests/test_podman_compose_include.py b/tests/integration/test_podman_compose_include.py similarity index 92% rename from tests/test_podman_compose_include.py rename to tests/integration/test_podman_compose_include.py index cba7b0f..42db798 100644 --- a/tests/test_podman_compose_include.py +++ b/tests/integration/test_podman_compose_include.py @@ -12,14 +12,14 @@ class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin): Test that podman-compose can execute podman-compose -f up with include :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", "include", "docker-compose.yaml")), + str(main_path.joinpath("tests", "integration", "include", "docker-compose.yaml")), "up", "-d", ] diff --git a/tests/test_podman_compose_networks.py b/tests/integration/test_podman_compose_networks.py similarity index 100% rename from tests/test_podman_compose_networks.py rename to tests/integration/test_podman_compose_networks.py diff --git a/tests/test_podman_compose_tests.py b/tests/integration/test_podman_compose_tests.py similarity index 100% rename from tests/test_podman_compose_tests.py rename to tests/integration/test_podman_compose_tests.py diff --git a/tests/test_podman_compose_up_down.py b/tests/integration/test_podman_compose_up_down.py similarity index 100% rename from tests/test_podman_compose_up_down.py rename to tests/integration/test_podman_compose_up_down.py diff --git a/tests/test_utils.py b/tests/integration/test_utils.py similarity index 100% rename from tests/test_utils.py rename to tests/integration/test_utils.py diff --git a/tests/testlogs/docker-compose.yml b/tests/integration/testlogs/docker-compose.yml similarity index 100% rename from tests/testlogs/docker-compose.yml rename to tests/integration/testlogs/docker-compose.yml diff --git a/tests/uidmaps/docker-compose.yml b/tests/integration/uidmaps/docker-compose.yml similarity index 100% rename from tests/uidmaps/docker-compose.yml rename to tests/integration/uidmaps/docker-compose.yml diff --git a/tests/ulimit/Dockerfile b/tests/integration/ulimit/Dockerfile similarity index 100% rename from tests/ulimit/Dockerfile rename to tests/integration/ulimit/Dockerfile diff --git a/tests/ulimit/docker-compose.yaml b/tests/integration/ulimit/docker-compose.yaml similarity index 100% rename from tests/ulimit/docker-compose.yaml rename to tests/integration/ulimit/docker-compose.yaml diff --git a/tests/ulimit/ulimit.sh b/tests/integration/ulimit/ulimit.sh similarity index 100% rename from tests/ulimit/ulimit.sh rename to tests/integration/ulimit/ulimit.sh diff --git a/tests/ulimit_build/Dockerfile b/tests/integration/ulimit_build/Dockerfile similarity index 100% rename from tests/ulimit_build/Dockerfile rename to tests/integration/ulimit_build/Dockerfile diff --git a/tests/ulimit_build/docker-compose.yaml b/tests/integration/ulimit_build/docker-compose.yaml similarity index 100% rename from tests/ulimit_build/docker-compose.yaml rename to tests/integration/ulimit_build/docker-compose.yaml diff --git a/tests/ulimit_build/ulimit.sh b/tests/integration/ulimit_build/ulimit.sh similarity index 100% rename from tests/ulimit_build/ulimit.sh rename to tests/integration/ulimit_build/ulimit.sh diff --git a/tests/vol/README.md b/tests/integration/vol/README.md similarity index 100% rename from tests/vol/README.md rename to tests/integration/vol/README.md diff --git a/tests/vol/docker-compose.yaml b/tests/integration/vol/docker-compose.yaml similarity index 100% rename from tests/vol/docker-compose.yaml rename to tests/integration/vol/docker-compose.yaml diff --git a/tests/volumes_merge/docker-compose.override.yaml b/tests/integration/volumes_merge/docker-compose.override.yaml similarity index 100% rename from tests/volumes_merge/docker-compose.override.yaml rename to tests/integration/volumes_merge/docker-compose.override.yaml diff --git a/tests/volumes_merge/docker-compose.yaml b/tests/integration/volumes_merge/docker-compose.yaml similarity index 100% rename from tests/volumes_merge/docker-compose.yaml rename to tests/integration/volumes_merge/docker-compose.yaml diff --git a/tests/volumes_merge/index.txt b/tests/integration/volumes_merge/index.txt similarity index 100% rename from tests/volumes_merge/index.txt rename to tests/integration/volumes_merge/index.txt diff --git a/tests/volumes_merge/override.txt b/tests/integration/volumes_merge/override.txt similarity index 100% rename from tests/volumes_merge/override.txt rename to tests/integration/volumes_merge/override.txt diff --git a/tests/yamlmagic/docker-compose.yml b/tests/integration/yamlmagic/docker-compose.yml similarity index 100% rename from tests/yamlmagic/docker-compose.yml rename to tests/integration/yamlmagic/docker-compose.yml diff --git a/pytests/__init__.py b/tests/unit/__init__.py similarity index 100% rename from pytests/__init__.py rename to tests/unit/__init__.py diff --git a/pytests/test_can_merge_build.py b/tests/unit/test_can_merge_build.py similarity index 100% rename from pytests/test_can_merge_build.py rename to tests/unit/test_can_merge_build.py diff --git a/pytests/test_compose_exec_args.py b/tests/unit/test_compose_exec_args.py similarity index 100% rename from pytests/test_compose_exec_args.py rename to tests/unit/test_compose_exec_args.py diff --git a/pytests/test_compose_run_update_container_from_args.py b/tests/unit/test_compose_run_update_container_from_args.py similarity index 100% rename from pytests/test_compose_run_update_container_from_args.py rename to tests/unit/test_compose_run_update_container_from_args.py diff --git a/pytests/test_container_to_args.py b/tests/unit/test_container_to_args.py similarity index 95% rename from pytests/test_container_to_args.py rename to tests/unit/test_container_to_args.py index 9346b9b..5294ae1 100644 --- a/pytests/test_container_to_args.py +++ b/tests/unit/test_container_to_args.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 +import os import unittest -from os import path from unittest import mock from parameterized import parameterized @@ -28,6 +28,11 @@ def get_minimal_container(): } +def get_test_file_path(rel_path): + repo_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + return os.path.realpath(os.path.join(repo_root, rel_path)) + + class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): async def test_minimal(self): c = create_compose_mock() @@ -242,7 +247,7 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): c = create_compose_mock() cnt = get_minimal_container() - env_file = path.realpath('tests/env-file-tests/env-files/project-1.env') + env_file = get_test_file_path('tests/integration/env-file-tests/env-files/project-1.env') cnt['env_file'] = env_file args = await container_to_args(c, cnt) @@ -276,7 +281,7 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): c = create_compose_mock() cnt = get_minimal_container() - env_file = path.realpath('tests/env-file-tests/env-files/project-1.env') + env_file = get_test_file_path('tests/integration/env-file-tests/env-files/project-1.env') cnt['env_file'] = [env_file] args = await container_to_args(c, cnt) @@ -301,8 +306,8 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): c = create_compose_mock() cnt = get_minimal_container() - env_file = path.realpath('tests/env-file-tests/env-files/project-1.env') - env_file_2 = path.realpath('tests/env-file-tests/env-files/project-2.env') + env_file = get_test_file_path('tests/integration/env-file-tests/env-files/project-1.env') + env_file_2 = get_test_file_path('tests/integration/env-file-tests/env-files/project-2.env') cnt['env_file'] = [env_file, env_file_2] args = await container_to_args(c, cnt) @@ -331,7 +336,7 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): c = create_compose_mock() cnt = get_minimal_container() - env_file = path.realpath('tests/env-file-tests/env-files/project-1.env') + env_file = get_test_file_path('tests/integration/env-file-tests/env-files/project-1.env') cnt['env_file'] = {'path': env_file, 'required': True} args = await container_to_args(c, cnt) diff --git a/pytests/test_container_to_args_secrets.py b/tests/unit/test_container_to_args_secrets.py similarity index 100% rename from pytests/test_container_to_args_secrets.py rename to tests/unit/test_container_to_args_secrets.py diff --git a/pytests/test_get_net_args.py b/tests/unit/test_get_net_args.py similarity index 100% rename from pytests/test_get_net_args.py rename to tests/unit/test_get_net_args.py diff --git a/pytests/test_get_network_create_args.py b/tests/unit/test_get_network_create_args.py similarity index 100% rename from pytests/test_get_network_create_args.py rename to tests/unit/test_get_network_create_args.py diff --git a/pytests/test_normalize_depends_on.py b/tests/unit/test_normalize_depends_on.py similarity index 100% rename from pytests/test_normalize_depends_on.py rename to tests/unit/test_normalize_depends_on.py diff --git a/pytests/test_normalize_final_build.py b/tests/unit/test_normalize_final_build.py similarity index 100% rename from pytests/test_normalize_final_build.py rename to tests/unit/test_normalize_final_build.py diff --git a/pytests/test_normalize_service.py b/tests/unit/test_normalize_service.py similarity index 100% rename from pytests/test_normalize_service.py rename to tests/unit/test_normalize_service.py diff --git a/pytests/test_volumes.py b/tests/unit/test_volumes.py similarity index 100% rename from pytests/test_volumes.py rename to tests/unit/test_volumes.py