diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 05053994..be14d3e2 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -12,7 +12,7 @@ on: - cron: '0 */8 * * *' jobs: integration: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v3 @@ -31,7 +31,7 @@ jobs: - name: Install package dependencies run: | sudo apt-get update - sudo apt-get --assume-yes --no-install-recommends install libsystemd0 libsystemd-dev pkg-config + sudo apt-get --assume-yes --no-install-recommends install libsystemd0 libsystemd-dev pkg-config podman-compose - name: Install test requirements run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6501a8c0..21845c80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,12 +43,7 @@ We recommend setting up a Python virtual environment to install the test depende ### Integration tests -Integration tests require the addition of [docker](https://docs.docker.com/engine/install/) or [podman](https://podman.io/getting-started/installation) and [docker-compose](https://docs.docker.com/compose/install/). -We recommend installing the Python implementation of `docker-compose` via pip: - -``` -pip install docker-compose -``` +Integration tests require the addition of [docker](https://docs.docker.com/engine/install/) or [podman](https://podman.io/getting-started/installation). Then install the collection directly from your local repo and execute the tests: diff --git a/requirements.txt b/requirements.txt index f59c591b..dc9875ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,8 @@ aiohttp aiokafka azure-servicebus dpath -kafka-python +# kafka-python +kafka-python-ng psycopg pyyaml systemd-python; sys_platform != 'darwin' diff --git a/test_requirements.txt b/test_requirements.txt index 6386d87f..c9c6f83e 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -5,6 +5,7 @@ asyncmock pytest-asyncio pytest-timeout ansible +podman-compose requests ansible-rulebook tox diff --git a/tests/integration/event_source_kafka/test_kafka_source.py b/tests/integration/event_source_kafka/test_kafka_source.py index bb02c7d5..25556c53 100644 --- a/tests/integration/event_source_kafka/test_kafka_source.py +++ b/tests/integration/event_source_kafka/test_kafka_source.py @@ -1,6 +1,7 @@ import json import os import subprocess +import sys import pytest from kafka import KafkaProducer @@ -21,9 +22,9 @@ def kafka_certs(): def kafka_broker(): cwd = os.path.join(TESTS_PATH, "event_source_kafka") print(cwd) - result = subprocess.run(["docker-compose", "up", "-d"], cwd=cwd, check=True) + result = subprocess.run([sys.executable, "-m", "podman_compose", "up", "-d"], cwd=cwd, check=True) yield result - subprocess.run(["docker-compose", "down", "-v"], cwd=cwd, check=True) + subprocess.run([sys.executable, "-m", "podman_compose", "down", "-v"], cwd=cwd, check=True) @pytest.fixture(scope="session") diff --git a/tox.ini b/tox.ini index 4bd47735..a0c0cc72 100644 --- a/tox.ini +++ b/tox.ini @@ -12,12 +12,19 @@ requires = pylint [testenv] -basepython = python3.9, python3.10 +basepython = python3.9, python3.10, python3.11, python3.12 [testenv:lint] deps = pre-commit desc = Run linters commands = pre-commit run -a +[testenv:integration] +description = Run integration tests +deps = -r{toxinidir}/test_requirements.txt +commands = + ansible-galaxy collection install . + pytest tests/integration -vvv -s + [testenv:ruff] deps = -r{toxinidir}/lint_requirements.txt commands = ruff check --select ALL --ignore INP001,RUF100,FA102,PLR0913 -q extensions/eda/plugins