Skip to content

Commit

Permalink
Limit integration tests to Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclert-canonical committed Dec 16, 2024
1 parent fe2efd8 commit bace284
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# See LICENSE file for licensing details.

import argparse
import platform
import subprocess

import pytest
Expand Down Expand Up @@ -43,6 +44,11 @@ def architecture() -> str:
).stdout.strip()


@pytest.fixture(autouse=True)
def version() -> str:
return platform.freedesktop_os_release()["VERSION_ID"]


@pytest.fixture
def only_amd64(architecture):
"""Pretty way to skip ARM tests."""
Expand All @@ -57,6 +63,13 @@ def only_arm64(architecture):
pytest.skip("Requires arm64 architecture")


@pytest.fixture
def only_ubuntu_jammy(version):
"""Pretty way to skip < Ubuntu 22.04 tests."""
if version != "22.04":
pytest.skip("Requires Ubuntu Jammy")


@pytest.fixture
def only_with_juju_secrets(juju_has_secrets):
"""Pretty way to skip Juju 3 tests."""
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@pytest.mark.group(1)
@pytest.mark.usefixtures("only_amd64")
@pytest.mark.usefixtures("only_amd64", "only_ubuntu_jammy")
async def test_arm_charm_on_amd_host(ops_test: OpsTest, mysql_router_charm_series: str) -> None:
"""Tries deploying an arm64 charm on amd64 host."""
charm = await get_charm(".", "arm64", 2)
Expand Down Expand Up @@ -48,7 +48,7 @@ async def test_arm_charm_on_amd_host(ops_test: OpsTest, mysql_router_charm_serie


@pytest.mark.group(1)
@pytest.mark.usefixtures("only_arm64")
@pytest.mark.usefixtures("only_amd64", "only_ubuntu_jammy")
async def test_amd_charm_on_arm_host(ops_test: OpsTest, mysql_router_charm_series: str) -> None:
"""Tries deploying an amd64 charm on arm64 host."""
charm = await get_charm(".", "amd64", 1)
Expand Down

0 comments on commit bace284

Please sign in to comment.