1
0
Fork 0

Set pytest.fixture scope to class, add Swarm E2E tests, and update Docker Swarm configurations

- Modified `pytest.fixture` scope to `class` across tests to improve fixture lifecycle and reduce setup overhead.
- Introduced a new `tests_e2e/test_swarm.py` test suite for Docker Swarm stack configurations.
- Added E2E tests for Swarm mode with scenarios such as basic services and combined plugins.
- Updated HAProxy image in Swarm stack `.yml` files to `byjg/easy-haproxy:local` for local testing consistency.
- Added `swarm` marker in `pyproject.toml` for differentiating Docker Swarm-specific tests.
- Updated GitHub workflows to include a new Swarm E2E test pipeline.
This commit is contained in:
Joao Gilberto Magalhaes 2026-02-18 15:28:07 -05:00
parent 16fcee4280
commit d9c7ff89cc
11 changed files with 682 additions and 22 deletions

View file

@ -121,7 +121,7 @@ def create_cloudflare_ips_file():
_cloudflare_ips_created = True
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_basic_ssl() -> Generator[None, None, None]:
"""Fixture for docker-compose.yml (Basic SSL)"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose.yml"))
@ -130,7 +130,7 @@ def docker_compose_basic_ssl() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_jwt_validator() -> Generator[None, None, None]:
"""Fixture for docker-compose-jwt-validator.yml"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-jwt-validator.yml"))
@ -139,7 +139,7 @@ def docker_compose_jwt_validator() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_multi_containers() -> Generator[None, None, None]:
"""Fixture for docker-compose-multi-containers.yml"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-multi-containers.yml"))
@ -148,7 +148,7 @@ def docker_compose_multi_containers() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_php_fpm() -> Generator[None, None, None]:
"""Fixture for docker-compose-php-fpm.yml"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-php-fpm.yml"))
@ -157,7 +157,7 @@ def docker_compose_php_fpm() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_plugins_combined() -> Generator[None, None, None]:
"""Fixture for docker-compose-plugins-combined.yml"""
# Create cloudflare_ips.lst (required by this compose file)
@ -169,7 +169,7 @@ def docker_compose_plugins_combined() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_ip_whitelist() -> Generator[None, None, None]:
"""Fixture for docker-compose-ip-whitelist.yml"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-ip-whitelist.yml"))
@ -178,7 +178,7 @@ def docker_compose_ip_whitelist() -> Generator[None, None, None]:
fixture.down()
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_cloudflare() -> Generator[None, None, None]:
"""Fixture for docker-compose-cloudflare.yml"""
# Create cloudflare_ips.lst (required by this compose file)
@ -751,7 +751,7 @@ class TestCloudflare:
# Test: docker-compose-changed-label.yml - Custom Label Prefix
# =============================================================================
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_changed_label() -> Generator[None, None, None]:
"""Fixture for docker-compose-changed-label.yml"""
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-changed-label.yml"))
@ -843,7 +843,7 @@ class TestChangedLabel:
# Test: docker-compose-acme-e2e.yml - ACME/Certbot with Pebble
# =============================================================================
@pytest.fixture
@pytest.fixture(scope="class")
def docker_compose_acme() -> Generator[None, None, None]:
"""Fixture for docker-compose-acme-e2e.yml - ACME/Certbot E2E test"""
volume_name = "docker_certbot-certs"