Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
fail-fast: false
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
podman-version: ['4.3.1', '5.4.2']

runs-on: ubuntu-latest
container:
Expand All @@ -20,10 +21,53 @@ jobs:
options: --privileged --cgroupns=host
steps:
- uses: actions/checkout@v5
- name: Install dependencies
- name: Install podman-4.3.1
if: matrix.podman-version == '4.3.1'
run: |
set -e
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y podman
- name: Install dependencies for dpkg
if: matrix.podman-version == '5.4.2'
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive apt update -y
DEBIAN_FRONTEND=noninteractive apt-get install -y conmon golang-github-containers-common libgpgme11 libsubid4
DEBIAN_FRONTEND=noninteractive apt update -y && apt upgrade -y buildah
- name: Install podman-5.4.2 and required dependencies from .deb files in podman-compose-test-data repository
if: matrix.podman-version == '5.4.2'
shell: bash
run: |
BASE_URLS=(
"https://raw.githubusercontent.com/mokibit/podman-compose-test-data/main/deb_files/podman-5.4.2"
"https://raw.githubusercontent.com/mokibit/podman-compose-test-data/main/deb_files/crun-1.21"
"https://raw.githubusercontent.com/mokibit/podman-compose-test-data/main/deb_files/netavark-1.14"
"https://raw.githubusercontent.com/mokibit/podman-compose-test-data/main/deb_files/aardvark-dns-1.14"
)
DEB_FILES=(
"podman_5.4.2+composetest-1_amd64.deb"
"crun_1.21-1_amd64.deb"
"netavark_1.14.0-2_amd64.deb"
"aardvark-dns_1.14.0-3_amd64.deb"
)
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
for i in "${!BASE_URLS[@]}"; do
url="${BASE_URLS[i]}/${DEB_FILES[i]}"
echo "Downloading $url ..."
curl -fsSL -o "$TMPDIR/${DEB_FILES[i]}" "$url"
done
echo "Installing packages ..."
apt-get update -qq
apt-get install -y -qq "$TMPDIR"/*.deb
- name: Verify installation of podman-5.4.2, crun-1.21, netavark-1.14, aardvark-dns-1.14
run: |
podman --version
echo "crun version: $(dpkg -l | awk '$2=="crun" {print $3}')"
echo "netavark version: $(dpkg -l | awk '$2=="netavark" {print $3}')"
echo "aardvark-dns version: $(dpkg -l | awk '$2=="aardvark-dns" {print $3}')"
- name: Install other test dependencies
run: |
set -e
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/deps/test_podman_compose_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@

from tests.integration.test_utils import PodmanAwareRunSubprocessMixin
from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import is_systemd_available
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


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):
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_deps(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
Expand Down Expand Up @@ -89,6 +93,7 @@ def test_up_nodeps(self) -> None:
"down",
])

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_podman_compose_run(self) -> None:
"""
This will test depends_on as well
Expand Down Expand Up @@ -143,6 +148,7 @@ def test_podman_compose_run(self) -> None:


class TestComposeConditionalDeps(unittest.TestCase, RunSubprocessMixin):
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_deps_succeeds(self) -> None:
suffix = "-conditional-succeeds"
try:
Expand Down Expand Up @@ -191,6 +197,7 @@ class TestComposeConditionalDepsHealthy(unittest.TestCase, PodmanAwareRunSubproc
def setUp(self) -> None:
self.podman_version = self.retrieve_podman_version()

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_up_deps_healthy(self) -> None:
suffix = "-conditional-healthy"
try:
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/in_pod/test_podman_compose_in_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def base_path() -> str:
Expand Down Expand Up @@ -37,6 +40,7 @@ def failure_exitcode_when_rootful() -> int:
# 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
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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
Expand Down Expand Up @@ -115,6 +119,7 @@ def test_x_podman_in_pod_false_command_line_in_pod_true(self) -> None:
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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
Expand Down Expand Up @@ -160,6 +165,7 @@ def test_x_podman_in_pod_false_command_line_in_pod_false(self) -> None:
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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
Expand Down Expand Up @@ -274,6 +280,7 @@ def test_x_podman_in_pod_true_command_line_in_pod_true(self) -> None:
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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
Expand Down Expand Up @@ -421,6 +428,7 @@ def test_x_podman_in_pod_not_exists_command_line_in_pod_true(self) -> None:
# been created) and have expected_returncode=1 (see FIXME above)
self.run_subprocess_assert_returncode(command_rm_pod)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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
Expand Down Expand Up @@ -467,6 +475,7 @@ def test_x_podman_in_pod_not_exists_command_line_in_pod_false(self) -> None:
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_in_pod_not_exists_command_line_in_pod_not_exists_docker_compat(self) -> None:
"""
Test that podman-compose will not create a pod when docker compat is requested.
Expand Down Expand Up @@ -518,6 +527,7 @@ def test_x_podman_in_pod_not_exists_command_line_in_pod_not_exists_docker_compat
# can not actually find this pod because it was not created
self.run_subprocess_assert_returncode(command_rm_pod, 1)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_in_pod_not_exists_command_line_in_pod_not_exists_env_var(self) -> None:
"""
Test that podman-compose will not create a pod when env var is set.
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/include/test_podman_compose_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
from pathlib import Path

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin):
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_podman_compose_include(self) -> None:
"""
Test that podman-compose can execute podman-compose -f <file> up with include
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/lifetime/test_lifetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from parameterized import parameterized

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


class TestLifetime(unittest.TestCase, RunSubprocessMixin):
def test_up_single_container(self) -> None:
Expand Down Expand Up @@ -69,6 +72,7 @@ def test_up_single_container(self) -> None:
("no_ports", "up_single_container_many_times"),
("with_ports", "up_single_container_many_times_with_ports"),
])
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def compose_yaml_path() -> str:
return os.path.join(
Expand All @@ -18,6 +21,7 @@ def compose_yaml_path() -> str:

class TestComposeOverrideTagAttribute(unittest.TestCase, RunSubprocessMixin):
# test if a service attribute from docker-compose.yaml file is overridden
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_override_tag_attribute(self) -> None:
override_file = os.path.join(
test_path(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def compose_yaml_path() -> str:
return os.path.join(
Expand All @@ -18,6 +21,7 @@ def compose_yaml_path() -> str:

class TestComposeOverrideTagService(unittest.TestCase, RunSubprocessMixin):
# test if whole service from docker-compose.yaml file is overridden in another file
@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_override_tag_service(self) -> None:
override_file = os.path.join(
test_path(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
from parameterized import parameterized

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def compose_yaml_path() -> str:
return os.path.join(os.path.join(test_path(), "nets_test3"), "docker-compose.yml")


@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
class TestComposeNetsTest3(unittest.TestCase, RunSubprocessMixin):
# test if services can access the networks of other services using their respective aliases
@parameterized.expand([
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/network/test_podman_compose_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from typing import Generator

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
@staticmethod
Expand All @@ -41,6 +44,7 @@ def teardown(self) -> Generator[None, None, None]:
]
self.run_subprocess(down_cmd)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_networks(self) -> None:
up_cmd = [
"coverage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


class TestPodmanComposeNetworkScopedAliases(RunSubprocessMixin, unittest.TestCase):
@staticmethod
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")

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_network_scoped_aliases(self) -> None:
try:
self.up()
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/pod_args/test_podman_compose_pod_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def base_path() -> str:
Expand Down Expand Up @@ -89,6 +92,7 @@ def test_x_podman_pod_args_unset_unset(self) -> None:
["--infra=false", "--share="],
)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_pod_args_unset_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when unset in
Expand All @@ -100,6 +104,7 @@ def test_x_podman_pod_args_unset_empty(self) -> None:
[],
)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_pod_args_unset_set(self) -> None:
"""
Test that podman-compose will use the passed pod-args when unset in
Expand All @@ -111,6 +116,7 @@ def test_x_podman_pod_args_unset_set(self) -> None:
["--infra=false", "--share=", "--cpus=1"],
)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_pod_args_empty_unset(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to an
Expand All @@ -122,6 +128,7 @@ def test_x_podman_pod_args_empty_unset(self) -> None:
[],
)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_pod_args_empty_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to an
Expand Down Expand Up @@ -156,6 +163,7 @@ def test_x_podman_pod_args_set_unset(self) -> None:
["--infra=false", "--share=", "--cpus=2"],
)

@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
def test_x_podman_pod_args_set_empty(self) -> None:
"""
Test that podman-compose will use empty pod-args when set to a
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/service_scale/test_podman_compose_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import get_podman_version
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path

SKIP_IF = get_podman_version() == get_podman_version().__class__("5.4.2")


def compose_yaml_path(test_ref_folder: str) -> str:
return os.path.join(test_path(), "service_scale", test_ref_folder, "docker-compose.yml")


@unittest.skipIf(SKIP_IF, "Breaks after updating podman to podman-5.4.2")
class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
# scale-up using `scale` prarmeter in docker-compose.yml
def test_scaleup_scale_parameter(self) -> None:
Expand Down
Loading