Skip to content

Commit

Permalink
[DPE-4977] Run tests against juju 3.6 on a nightly schedule (#601)
Browse files Browse the repository at this point in the history
* Ensure that integration tests pass on juju 3.6 and amd64

* Correctly comment pull_request CI + always run integration tests against latest lxd version

* Use juju-snap-channel instead of juju-agent-version

* Update pylibjuju to 3.5.2.0

* Revert libjuju to 3.5.0.0

* Explicity specify base as ubuntu@22.04 instead of using series=jammy

* Use libjuju 3.5.0.0 in juju 3.6 workflow

* Only run juju 3.6 tests on nightly schedule

* Add juju snap channel to the integration CI name
  • Loading branch information
shayancanonical authored Sep 11, 2024
1 parent 61bd261 commit 01cfd3e
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 59 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ jobs:
allure_on_amd64: false
- agent: 3.4.5 # renovate: juju-agent-pin-minor
allure_on_amd64: true
- snap_channel: 3.6/beta
allure_on_amd64: false
architecture:
- amd64
include:
- juju:
agent: 3.4.5 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture: arm64
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
- juju:
snap_channel: 3.6/beta
allure_on_amd64: false
architecture: arm64
name: Integration | ${{ matrix.juju.agent || matrix.juju.snap_channel }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
Expand All @@ -76,8 +82,8 @@ jobs:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
cloud: lxd
lxd-snap-channel: 5.21/stable
juju-agent-version: ${{ matrix.juju.agent }}
juju-snap-channel: ${{ matrix.juju.snap_channel }}
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
_beta_allure_report: ${{ matrix.juju.allure_on_amd64 && matrix.architecture == 'amd64' }}
secrets:
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pytest-operator = "^0.36.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
juju = "<=3.5.0.0"
juju = "3.5.0.0"
boto3 = "*"
tenacity = "*"
landscape-api-py3 = "^0.9.0"
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/ha_tests/test_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from ..helpers import APPLICATION_NAME, CHARM_SERIES, db_connect, scale_application
from ..helpers import APPLICATION_NAME, CHARM_BASE, db_connect, scale_application
from .helpers import (
app_name,
are_writes_increasing,
Expand All @@ -32,7 +32,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
charm,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)
# Deploy the continuous writes application charm if it wasn't already deployed.
Expand All @@ -42,7 +42,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
APPLICATION_NAME,
application_name=APPLICATION_NAME,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
)

Expand Down Expand Up @@ -122,7 +122,7 @@ async def test_no_data_replicated_between_clusters(ops_test: OpsTest, continuous
charm,
application_name=new_cluster_app,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)
await ops_test.model.wait_for_idle(
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ha_tests/test_restore_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pytest_operator.plugin import OpsTest

from ..helpers import (
CHARM_SERIES,
CHARM_BASE,
db_connect,
get_password,
get_patroni_cluster,
Expand Down Expand Up @@ -41,7 +41,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
charm,
application_name=FIRST_APPLICATION,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
storage={"pgdata": {"pool": "lxd-btrfs", "size": 2048}},
config={"profile": "testing"},
)
Expand All @@ -51,7 +51,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
charm,
application_name=SECOND_APPLICATION,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ha_tests/test_self_healing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tenacity import Retrying, stop_after_delay, wait_fixed

from ..helpers import (
CHARM_SERIES,
CHARM_BASE,
db_connect,
get_machine_from_unit,
get_password,
Expand Down Expand Up @@ -76,7 +76,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
charm,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
storage={"pgdata": {"pool": "lxd-btrfs", "size": 2048}},
config={"profile": "testing"},
)
Expand All @@ -87,7 +87,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
APPLICATION_NAME,
application_name=APPLICATION_NAME,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
)

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/ha_tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from ..helpers import (
APPLICATION_NAME,
CHARM_SERIES,
CHARM_BASE,
)
from ..juju_ import juju_major_version
from .helpers import (
Expand Down Expand Up @@ -44,7 +44,7 @@ async def test_app_force_removal(ops_test: OpsTest, charm: str):
charm,
application_name=APPLICATION_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
storage={"pgdata": {"pool": "lxd-btrfs", "size": 8046}},
config={"profile": "testing"},
)
Expand Down Expand Up @@ -150,7 +150,7 @@ async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str):
charm,
application_name=DUP_APPLICATION_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
attach_storage=[tag.storage(garbage_storage)],
config={"profile": "testing"},
)
Expand Down Expand Up @@ -191,7 +191,7 @@ async def test_app_resources_conflicts_v2(ops_test: OpsTest, charm: str):
charm,
application_name=DUP_APPLICATION_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
wait_fixed,
)

CHARM_SERIES = "jammy"
CHARM_BASE = "ubuntu@22.04"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
DATABASE_APP_NAME = METADATA["name"]
STORAGE_PATH = METADATA["storage"]["pgdata"]["location"]
Expand Down Expand Up @@ -1118,7 +1118,7 @@ async def backup_operations(
charm,
application_name=database_app_name,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)

Expand Down
18 changes: 11 additions & 7 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pytest_operator.plugin import OpsTest

from .. import markers
from ..helpers import CHARM_SERIES, assert_sync_standbys, get_leader_unit, scale_application
from ..helpers import CHARM_BASE, assert_sync_standbys, get_leader_unit, scale_application
from ..juju_ import juju_major_version
from .helpers import (
build_connection_string,
Expand Down Expand Up @@ -49,21 +49,21 @@ async def test_deploy_charms(ops_test: OpsTest, charm):
APPLICATION_APP_NAME,
application_name=APPLICATION_APP_NAME,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
),
ops_test.model.deploy(
charm,
application_name=DATABASE_APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
),
ops_test.model.deploy(
charm,
application_name=ANOTHER_DATABASE_APP_NAME,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
),
)
Expand Down Expand Up @@ -218,6 +218,7 @@ async def test_two_applications_doesnt_share_the_same_relation_data(ops_test: Op
APPLICATION_APP_NAME,
application_name=another_application_app_name,
channel="edge",
base=CHARM_BASE,
)
await ops_test.model.wait_for_idle(apps=all_app_names, status="active")

Expand Down Expand Up @@ -446,7 +447,7 @@ async def test_admin_role(ops_test: OpsTest):
all_app_names = [DATA_INTEGRATOR_APP_NAME]
all_app_names.extend(APP_NAMES)
async with ops_test.fast_forward():
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME)
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME, base=CHARM_BASE)
await ops_test.model.wait_for_idle(apps=[DATA_INTEGRATOR_APP_NAME], status="blocked")
await ops_test.model.applications[DATA_INTEGRATOR_APP_NAME].set_config({
"database-name": DATA_INTEGRATOR_APP_NAME.replace("-", "_"),
Expand Down Expand Up @@ -535,7 +536,9 @@ async def test_invalid_extra_user_roles(ops_test: OpsTest):
another_data_integrator_app_name = f"another-{DATA_INTEGRATOR_APP_NAME}"
data_integrator_apps_names = [DATA_INTEGRATOR_APP_NAME, another_data_integrator_app_name]
await ops_test.model.deploy(
DATA_INTEGRATOR_APP_NAME, application_name=another_data_integrator_app_name
DATA_INTEGRATOR_APP_NAME,
application_name=another_data_integrator_app_name,
base=CHARM_BASE,
)
await ops_test.model.wait_for_idle(
apps=[another_data_integrator_app_name], status="blocked"
Expand Down Expand Up @@ -592,14 +595,15 @@ async def test_nextcloud_db_blocked(ops_test: OpsTest, charm: str) -> None:
charm,
application_name=DATABASE_APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
),
ops_test.model.deploy(
"nextcloud",
channel="edge",
application_name="nextcloud",
num_units=1,
base=CHARM_BASE,
),
)
await asyncio.gather(
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/new_relations/test_relations_coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
from pytest_operator.plugin import OpsTest

from ..helpers import CHARM_SERIES, DATABASE_APP_NAME
from ..helpers import CHARM_BASE, DATABASE_APP_NAME
from .helpers import build_connection_string
from .test_new_relations import DATA_INTEGRATOR_APP_NAME

Expand All @@ -29,13 +29,13 @@ async def test_relations(ops_test: OpsTest, charm):
charm,
application_name=DATABASE_APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)
await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=3000)

# Creating first time relation with user role
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME)
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME, base=CHARM_BASE)
await ops_test.model.applications[DATA_INTEGRATOR_APP_NAME].set_config({
"database-name": DATA_INTEGRATOR_APP_NAME.replace("-", "_"),
})
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/relations/test_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from ..helpers import CHARM_SERIES, METADATA
from ..helpers import CHARM_BASE, METADATA
from ..new_relations.test_new_relations import APPLICATION_APP_NAME, build_connection_string
from ..relations.helpers import get_legacy_db_connection_str

Expand Down Expand Up @@ -37,14 +37,14 @@ async def test_deploy_charms(ops_test: OpsTest, charm):
APPLICATION_APP_NAME,
application_name=DATABASE_APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
),
ops_test.model.deploy(
charm,
application_name=APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
config={
"profile": "testing",
"plugin_unaccent_enable": "True",
Expand All @@ -55,7 +55,7 @@ async def test_deploy_charms(ops_test: OpsTest, charm):
APPLICATION_APP_NAME,
application_name=DB_APP_NAME,
num_units=1,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
),
)
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from . import architecture
from .helpers import (
CHARM_SERIES,
CHARM_BASE,
DATABASE_APP_NAME,
MOVE_RESTORED_CLUSTER_TO_ANOTHER_BUCKET,
backup_operations,
Expand Down Expand Up @@ -220,11 +220,13 @@ async def test_restore_on_new_cluster(ops_test: OpsTest, github_secrets, charm)
"""Test that is possible to restore a backup to another PostgreSQL cluster."""
previous_database_app_name = f"{DATABASE_APP_NAME}-gcp"
database_app_name = f"new-{DATABASE_APP_NAME}"
await ops_test.model.deploy(charm, application_name=previous_database_app_name)
await ops_test.model.deploy(
charm, application_name=previous_database_app_name, base=CHARM_BASE
)
await ops_test.model.deploy(
charm,
application_name=database_app_name,
series=CHARM_SERIES,
base=CHARM_BASE,
)
await ops_test.model.relate(previous_database_app_name, S3_INTEGRATOR_APP_NAME)
await ops_test.model.relate(database_app_name, S3_INTEGRATOR_APP_NAME)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_backups_pitr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from . import architecture
from .helpers import (
CHARM_SERIES,
CHARM_BASE,
DATABASE_APP_NAME,
MOVE_RESTORED_CLUSTER_TO_ANOTHER_BUCKET,
construct_endpoint,
Expand Down Expand Up @@ -114,7 +114,7 @@ async def pitr_backup_operations(
charm,
application_name=database_app_name,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from locales import SNAP_LOCALES

from .helpers import (
CHARM_SERIES,
CHARM_BASE,
DATABASE_APP_NAME,
STORAGE_PATH,
check_cluster_members,
Expand Down Expand Up @@ -49,7 +49,7 @@ async def test_deploy(ops_test: OpsTest, charm: str):
charm,
application_name=DATABASE_APP_NAME,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
)

Expand Down
Loading

0 comments on commit 01cfd3e

Please sign in to comment.