Skip to content

Commit

Permalink
Run integration tests on arm64 (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical authored Jun 26, 2024
1 parent bad961d commit 50f49ba
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 62 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v16.2.0

unit-test:
name: Unit test charm
Expand All @@ -44,7 +44,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v16.2.0
with:
cache: true

Expand All @@ -55,22 +55,30 @@ jobs:
juju:
- agent: 2.9.49 # renovate: latest juju 2
libjuju: ==2.9.49.0 # renovate: latest libjuju 2
allure: false
allure_on_amd64: false
- agent: 3.1.8 # renovate: latest juju 3
allure: true
name: Integration test charm | ${{ matrix.juju.agent }}
allure_on_amd64: true
architecture:
- amd64
include:
- juju:
agent: 3.1.8 # renovate: latest juju 3
allure_on_amd64: true
architecture: arm64
name: Integration test charm | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v16.2.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
cloud: microk8s
microk8s-snap-channel: 1.29-strict/stable
juju-agent-version: ${{ matrix.juju.agent }}
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
_beta_allure_report: ${{ matrix.juju.allure }}
_beta_allure_report: ${{ matrix.juju.allure_on_amd64 && matrix.architecture == 'amd64' }}
secrets:
integration-test: |
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v16.2.0

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v16.2.0
with:
channel: 14/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/_sync_docs.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/_sync_docs.yaml@v16.2.0
secrets:
discourse-api-user: ${{ secrets.DISCOURSE_API_USERNAME }}
discourse-api-key: ${{ secrets.DISCOURSE_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v16.0.1
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v16.2.0
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
28 changes: 9 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ optional = true
[tool.poetry.group.integration.dependencies]
lightkube = "^0.15.3"
pytest = "^8.2.2"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.0.1", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.2.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.35.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.0.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.0.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.0.1", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.2.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.2.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.2.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
juju = "<=3.5.0.0"
psycopg2-binary = "^2.9.9"
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/architecture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import subprocess

architecture = subprocess.run(
["dpkg", "--print-architecture"], capture_output=True, check=True, encoding="utf-8"
).stdout.strip()
23 changes: 14 additions & 9 deletions tests/integration/ha_tests/test_async_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# See LICENSE file for licensing details.
import contextlib
import logging
import subprocess
from asyncio import gather
from typing import Optional

Expand All @@ -14,15 +15,8 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from tests.integration import markers
from tests.integration.ha_tests.helpers import (
are_writes_increasing,
check_writes,
get_standby_leader,
get_sync_standby,
start_continuous_writes,
)
from tests.integration.helpers import (
from .. import architecture, markers
from ..helpers import (
APPLICATION_NAME,
DATABASE_APP_NAME,
build_and_deploy,
Expand All @@ -33,6 +27,13 @@
scale_application,
wait_for_relation_removed_between,
)
from .helpers import (
are_writes_increasing,
check_writes,
get_standby_leader,
get_sync_standby,
start_continuous_writes,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -72,6 +73,10 @@ async def second_model(ops_test: OpsTest, first_model, request) -> Model:
second_model_name = f"{first_model.info.name}-other"
if second_model_name not in await ops_test._controller.list_models():
await ops_test._controller.add_model(second_model_name)
subprocess.run(["juju", "switch", second_model_name], check=True)
subprocess.run(
["juju", "set-model-constraints", f"arch={architecture.architecture}"], check=True
)
second_model = Model()
await second_model.connect(model_name=second_model_name)
yield second_model
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/ha_tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from .. import markers
from ..helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
Expand Down Expand Up @@ -43,6 +44,7 @@


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_app_force_removal(ops_test: OpsTest):
"""Remove unit with force while storage is alive."""
Expand Down Expand Up @@ -103,6 +105,7 @@ async def test_app_force_removal(ops_test: OpsTest):


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_app_garbage_ignorance(ops_test: OpsTest):
"""Test charm deploy in dirty environment with garbage storage."""
Expand Down Expand Up @@ -155,6 +158,7 @@ async def test_app_garbage_ignorance(ops_test: OpsTest):


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_app_resources_conflicts(ops_test: OpsTest):
"""Test application deploy in dirty environment with garbage storage from another application."""
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/ha_tests/test_upgrade_from_stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, wait_fixed

from .. import markers
from ..helpers import (
APPLICATION_NAME,
DATABASE_APP_NAME,
Expand All @@ -31,6 +32,7 @@


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
"""Simple test to ensure that the PostgreSQL and application charms get deployed."""
Expand All @@ -56,6 +58,7 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_pre_upgrade_check(ops_test: OpsTest) -> None:
"""Test that the pre-upgrade-check action runs successfully."""
Expand Down Expand Up @@ -88,6 +91,7 @@ async def test_pre_upgrade_check(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_upgrade_from_stable(ops_test: OpsTest, continuous_writes):
"""Test updating from stable channel."""
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@

import pytest

from . import architecture
from .juju_ import juju_major_version

juju2 = pytest.mark.skipif(juju_major_version != 2, reason="Requires juju 2")
juju3 = pytest.mark.skipif(juju_major_version != 3, reason="Requires juju 3")
juju_secrets = pytest.mark.skipif(juju_major_version < 3, reason="Requires juju secrets")
amd64_only = pytest.mark.skipif(
architecture.architecture != "amd64", reason="Requires amd64 architecture"
)
arm64_only = pytest.mark.skipif(
architecture.architecture != "arm64", reason="Requires arm64 architecture"
)
3 changes: 3 additions & 0 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, wait_fixed

from .. import markers
from ..helpers import (
CHARM_SERIES,
check_database_users_existence,
Expand Down Expand Up @@ -586,6 +587,7 @@ async def test_invalid_extra_user_roles(ops_test: OpsTest):


@pytest.mark.group(1)
@markers.amd64_only # discourse-k8s charm not available for arm64
async def test_discourse(ops_test: OpsTest):
# Deploy Discourse and Redis.
await gather(
Expand Down Expand Up @@ -662,6 +664,7 @@ async def test_discourse(ops_test: OpsTest):


@pytest.mark.group(1)
@markers.amd64_only # indico charm not available for arm64
async def test_indico_datatabase(ops_test: OpsTest) -> None:
"""Tests deploying and relating to the Indico charm."""
async with ops_test.fast_forward(fast_interval="30s"):
Expand Down
Loading

0 comments on commit 50f49ba

Please sign in to comment.