From 02ec524ff0670bed4fb3a5de3262b0d8c9fa50fe Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 15:11:44 +0000 Subject: [PATCH 1/9] Ensure that integration tests pass on juju 3.6 and amd64 --- .github/workflows/ci.yaml | 3 +- .github/workflows/juju_3_6_ci.yaml | 45 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/juju_3_6_ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b5eae7f68..7670e625de 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,8 @@ concurrency: cancel-in-progress: true on: - pull_request: +# TODO: uncomment below before merging + # pull_request: paths-ignore: - '.gitignore' - '.jujuignore' diff --git a/.github/workflows/juju_3_6_ci.yaml b/.github/workflows/juju_3_6_ci.yaml new file mode 100644 index 0000000000..d4d7e297f5 --- /dev/null +++ b/.github/workflows/juju_3_6_ci.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Canonical Ltd. +# See LICENSE file for licensing details. +name: Juju 3.6 CI tests + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: # TODO: remove once PR is approved and confirmed tests passing on 3.6 + +jobs: + lint: + name: Lint + uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v18.0.0 + + build: + name: Build charm + uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v18.0.0 + with: + cache: true + + integration-test-3-6: + name: Integration | 3.6 + needs: + - lint + - build + uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v18.0.0 + with: + artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} + architecture: amd64 + cloud: lxd + juju-agent-version: 3.6-beta2 + libjuju-version-constraint: 3.5.2.0 + secrets: + # GitHub appears to redact each line of a multi-line secret + # Avoid putting `{` or `}` on a line by itself so that it doesn't get redacted in logs + integration-test: | + { "AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}", + "AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}", + "GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}", + "GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}", + "UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}", + "LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}", + "LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}", } \ No newline at end of file From aa5a952b90a79705608fcee8e60923df837bf960 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 15:19:42 +0000 Subject: [PATCH 2/9] Correctly comment pull_request CI + always run integration tests against latest lxd version --- .github/workflows/ci.yaml | 13 ++++++------- .github/workflows/juju_3_6_ci.yaml | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7670e625de..5d9fb1a929 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,12 +9,12 @@ concurrency: on: # TODO: uncomment below before merging # pull_request: - paths-ignore: - - '.gitignore' - - '.jujuignore' - - 'LICENSE' - - '**.md' - - .github/renovate.json5 + # paths-ignore: + # - '.gitignore' + # - '.jujuignore' + # - 'LICENSE' + # - '**.md' + # - .github/renovate.json5 schedule: - cron: '53 0 * * *' # Daily at 00:53 UTC # Triggered on push to branch "main" by .github/workflows/release.yaml @@ -76,7 +76,6 @@ 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 }} libjuju-version-constraint: ${{ matrix.juju.libjuju }} _beta_allure_report: ${{ matrix.juju.allure_on_amd64 && matrix.architecture == 'amd64' }} diff --git a/.github/workflows/juju_3_6_ci.yaml b/.github/workflows/juju_3_6_ci.yaml index d4d7e297f5..3591021d9c 100644 --- a/.github/workflows/juju_3_6_ci.yaml +++ b/.github/workflows/juju_3_6_ci.yaml @@ -42,4 +42,4 @@ jobs: "GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}", "UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}", "LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}", - "LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}", } \ No newline at end of file + "LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}", } From c8806d8f29d00f2ecde483ddb77e3a903576ad8f Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 15:29:41 +0000 Subject: [PATCH 3/9] Use juju-snap-channel instead of juju-agent-version --- .github/workflows/juju_3_6_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/juju_3_6_ci.yaml b/.github/workflows/juju_3_6_ci.yaml index 3591021d9c..06aed972c0 100644 --- a/.github/workflows/juju_3_6_ci.yaml +++ b/.github/workflows/juju_3_6_ci.yaml @@ -30,7 +30,7 @@ jobs: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} architecture: amd64 cloud: lxd - juju-agent-version: 3.6-beta2 + juju-snap-channel: 3.6/beta libjuju-version-constraint: 3.5.2.0 secrets: # GitHub appears to redact each line of a multi-line secret From 5c90d6bc0bed3c23d09067cf0030548afb003e55 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 19:51:22 +0000 Subject: [PATCH 4/9] Update pylibjuju to 3.5.2.0 --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 5aa405f7a2..716517af69 100644 --- a/poetry.lock +++ b/poetry.lock @@ -849,12 +849,12 @@ referencing = ">=0.31.0" [[package]] name = "juju" -version = "3.5.0.0" +version = "3.5.2.0" description = "Python library for Juju" optional = false python-versions = "*" files = [ - {file = "juju-3.5.0.0.tar.gz", hash = "sha256:c69fbe63cb12991690787ce3d70812390bf3ca62b6c5e9ef15df00c1f03dd7e6"}, + {file = "juju-3.5.2.0.tar.gz", hash = "sha256:dd9a36330e63acd8f62bf478fd7e385e51f44dc3918e7a67d0593fd054e1e80a"}, ] [package.dependencies] @@ -2380,4 +2380,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "2ed885414c44ded69eb557170c995f3a9de638e2a1251c0d7a8e5fd924047a64" +content-hash = "882d0be6d45e0de04b6b04062799bf5720d2e90ea956d6541396adba00fb670a" diff --git a/pyproject.toml b/pyproject.toml index 00ddc3ae59..b54c17e93d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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.2.0" +juju = "3.5.2.0" boto3 = "*" tenacity = "*" landscape-api-py3 = "^0.9.0" From 9ff7045dfed56cec145d629d9c168302957ad538 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 21:01:18 +0000 Subject: [PATCH 5/9] Revert libjuju to 3.5.0.0 --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6549f86a9d..5b34e5b5ed 100644 --- a/poetry.lock +++ b/poetry.lock @@ -850,12 +850,12 @@ referencing = ">=0.31.0" [[package]] name = "juju" -version = "3.5.2.0" +version = "3.5.0.0" description = "Python library for Juju" optional = false python-versions = "*" files = [ - {file = "juju-3.5.2.0.tar.gz", hash = "sha256:dd9a36330e63acd8f62bf478fd7e385e51f44dc3918e7a67d0593fd054e1e80a"}, + {file = "juju-3.5.0.0.tar.gz", hash = "sha256:c69fbe63cb12991690787ce3d70812390bf3ca62b6c5e9ef15df00c1f03dd7e6"}, ] [package.dependencies] @@ -2399,4 +2399,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "275328cc92b7fb99be00af9f93539f38b07be72533b8388f469f4604e6344d00" +content-hash = "ba5b7d2f51b6063ceb88f97b2e4758437f8bd41e8c62da33c6093d19b5846972" diff --git a/pyproject.toml b/pyproject.toml index e9eb8e5f67..3741f4db37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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.2.0" +juju = "3.5.0.0" boto3 = "*" tenacity = "*" landscape-api-py3 = "^0.9.0" From 2c9ecff9423ad50560b9c7215da085b660e1a44a Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 21:25:19 +0000 Subject: [PATCH 6/9] Explicity specify base as ubuntu@22.04 instead of using series=jammy --- tests/integration/ha_tests/test_replication.py | 8 ++++---- .../ha_tests/test_restore_cluster.py | 6 +++--- .../integration/ha_tests/test_self_healing.py | 6 +++--- tests/integration/ha_tests/test_smoke.py | 8 ++++---- tests/integration/helpers.py | 4 ++-- .../new_relations/test_new_relations.py | 18 +++++++++++------- .../new_relations/test_relations_coherence.py | 6 +++--- tests/integration/relations/test_relations.py | 8 ++++---- tests/integration/test_backups.py | 8 +++++--- tests/integration/test_backups_pitr.py | 10 ++++++---- tests/integration/test_charm.py | 4 ++-- tests/integration/test_config.py | 4 ++-- tests/integration/test_db.py | 10 +++++----- tests/integration/test_db_admin.py | 4 ++-- tests/integration/test_password_rotation.py | 4 ++-- tests/integration/test_plugins.py | 4 ++-- tests/integration/test_subordinates.py | 6 ++++-- tests/integration/test_tls.py | 6 +++--- 18 files changed, 67 insertions(+), 57 deletions(-) diff --git a/tests/integration/ha_tests/test_replication.py b/tests/integration/ha_tests/test_replication.py index 600e2997d4..23fc30f08d 100644 --- a/tests/integration/ha_tests/test_replication.py +++ b/tests/integration/ha_tests/test_replication.py @@ -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, @@ -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. @@ -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", ) @@ -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( diff --git a/tests/integration/ha_tests/test_restore_cluster.py b/tests/integration/ha_tests/test_restore_cluster.py index d6af07e251..0d4c3f9f49 100644 --- a/tests/integration/ha_tests/test_restore_cluster.py +++ b/tests/integration/ha_tests/test_restore_cluster.py @@ -7,7 +7,7 @@ from pytest_operator.plugin import OpsTest from ..helpers import ( - CHARM_SERIES, + CHARM_BASE, db_connect, get_password, get_patroni_cluster, @@ -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"}, ) @@ -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"}, ) diff --git a/tests/integration/ha_tests/test_self_healing.py b/tests/integration/ha_tests/test_self_healing.py index 0b37df9ff1..b68ba3dd4e 100644 --- a/tests/integration/ha_tests/test_self_healing.py +++ b/tests/integration/ha_tests/test_self_healing.py @@ -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, @@ -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"}, ) @@ -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", ) diff --git a/tests/integration/ha_tests/test_smoke.py b/tests/integration/ha_tests/test_smoke.py index 8da83ce3eb..2c954ee466 100644 --- a/tests/integration/ha_tests/test_smoke.py +++ b/tests/integration/ha_tests/test_smoke.py @@ -12,7 +12,7 @@ from ..helpers import ( APPLICATION_NAME, - CHARM_SERIES, + CHARM_BASE, ) from ..juju_ import juju_major_version from .helpers import ( @@ -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"}, ) @@ -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"}, ) @@ -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"}, ) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index f6e81dd38f..904b3452f6 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -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"] @@ -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"}, ) diff --git a/tests/integration/new_relations/test_new_relations.py b/tests/integration/new_relations/test_new_relations.py index 8b5457cc66..6ce4f14700 100644 --- a/tests/integration/new_relations/test_new_relations.py +++ b/tests/integration/new_relations/test_new_relations.py @@ -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, @@ -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"}, ), ) @@ -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") @@ -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("-", "_"), @@ -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" @@ -592,7 +595,7 @@ 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( @@ -600,6 +603,7 @@ async def test_nextcloud_db_blocked(ops_test: OpsTest, charm: str) -> None: channel="edge", application_name="nextcloud", num_units=1, + base=CHARM_BASE, ), ) await asyncio.gather( diff --git a/tests/integration/new_relations/test_relations_coherence.py b/tests/integration/new_relations/test_relations_coherence.py index 4955fe5d2b..3e2f1c2c8b 100644 --- a/tests/integration/new_relations/test_relations_coherence.py +++ b/tests/integration/new_relations/test_relations_coherence.py @@ -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 @@ -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("-", "_"), }) diff --git a/tests/integration/relations/test_relations.py b/tests/integration/relations/test_relations.py index a901856f6c..2a6522e114 100644 --- a/tests/integration/relations/test_relations.py +++ b/tests/integration/relations/test_relations.py @@ -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 @@ -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", @@ -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", ), ) diff --git a/tests/integration/test_backups.py b/tests/integration/test_backups.py index 6a83b981e5..70137b4f37 100644 --- a/tests/integration/test_backups.py +++ b/tests/integration/test_backups.py @@ -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, @@ -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) diff --git a/tests/integration/test_backups_pitr.py b/tests/integration/test_backups_pitr.py index 2a080e5dab..d2d7d9f4c8 100644 --- a/tests/integration/test_backups_pitr.py +++ b/tests/integration/test_backups_pitr.py @@ -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, @@ -96,8 +96,10 @@ async def cloud_configs(github_secrets) -> None: async def test_pitr_backup(ops_test: OpsTest, cloud_configs: Tuple[Dict, Dict], charm) -> None: """Build, deploy two units of PostgreSQL and do backup. Then, write new data into DB, switch WAL file and test point-in-time-recovery restore action.""" # Deploy S3 Integrator and TLS Certificates Operator. - await ops_test.model.deploy(S3_INTEGRATOR_APP_NAME) - await ops_test.model.deploy(TLS_CERTIFICATES_APP_NAME, config=TLS_CONFIG, channel=TLS_CHANNEL) + await ops_test.model.deploy(S3_INTEGRATOR_APP_NAME, base=CHARM_BASE) + await ops_test.model.deploy( + TLS_CERTIFICATES_APP_NAME, config=TLS_CONFIG, channel=TLS_CHANNEL, base=CHARM_BASE + ) for cloud, config in cloud_configs[0].items(): # Deploy and relate PostgreSQL to S3 integrator (one database app for each cloud for now @@ -108,7 +110,7 @@ async def test_pitr_backup(ops_test: OpsTest, cloud_configs: Tuple[Dict, Dict], charm, application_name=database_app_name, num_units=2, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing"}, ) diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index f0769be5f5..a4093894cd 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -16,7 +16,7 @@ from locales import SNAP_LOCALES from .helpers import ( - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, STORAGE_PATH, check_cluster_members, @@ -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"}, ) diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py index 25878e8253..e16a3d3d58 100644 --- a/tests/integration/test_config.py +++ b/tests/integration/test_config.py @@ -7,7 +7,7 @@ from pytest_operator.plugin import OpsTest from .helpers import ( - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, get_leader_unit, ) @@ -25,7 +25,7 @@ async def test_config_parameters(ops_test: OpsTest) -> None: await ops_test.model.deploy( charm, 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=1500) diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index 68b429ec57..822deb78a7 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -13,7 +13,7 @@ from . import markers from .helpers import ( APPLICATION_NAME, - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, assert_sync_standbys, build_connection_string, @@ -50,7 +50,7 @@ async def test_mailman3_core_db(ops_test: OpsTest, charm: str) -> None: charm, application_name=DATABASE_APP_NAME, num_units=DATABASE_UNITS, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing"}, ) @@ -200,14 +200,14 @@ async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None: APPLICATION_NAME, application_name=APPLICATION_NAME, config={"legacy_roles": True}, - series=CHARM_SERIES, + base=CHARM_BASE, channel="edge", ) await ops_test.model.deploy( APPLICATION_NAME, application_name=f"{APPLICATION_NAME}2", config={"legacy_roles": True}, - series=CHARM_SERIES, + base=CHARM_BASE, channel="edge", ) @@ -304,7 +304,7 @@ async def test_canonical_livepatch_onprem_bundle_db(ops_test: OpsTest) -> None: # aren't providing an Ubuntu Pro token (as this is just a test to ensure # the database works in the context of the relation with the Livepatch charm). overlay = { - "applications": {"ubuntu-advantage": {"charm": "ubuntu-advantage", "series": CHARM_SERIES}} + "applications": {"ubuntu-advantage": {"charm": "ubuntu-advantage", "base": CHARM_BASE}} } await deploy_and_relate_bundle_with_postgresql( ops_test, diff --git a/tests/integration/test_db_admin.py b/tests/integration/test_db_admin.py index 838ab48cac..3ac3d31d29 100644 --- a/tests/integration/test_db_admin.py +++ b/tests/integration/test_db_admin.py @@ -11,7 +11,7 @@ from tenacity import Retrying, stop_after_delay, wait_fixed from .helpers import ( - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, build_connection_string, check_database_users_existence, @@ -44,7 +44,7 @@ async def test_landscape_scalable_bundle_db(ops_test: OpsTest, charm: str) -> No charm, application_name=DATABASE_APP_NAME, num_units=DATABASE_UNITS, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing", "plugin_plpython3u_enable": "True"}, ) diff --git a/tests/integration/test_password_rotation.py b/tests/integration/test_password_rotation.py index 2f7d5be767..c456585134 100644 --- a/tests/integration/test_password_rotation.py +++ b/tests/integration/test_password_rotation.py @@ -10,7 +10,7 @@ from . import markers from .helpers import ( - CHARM_SERIES, + CHARM_BASE, METADATA, check_patroni, db_connect, @@ -37,7 +37,7 @@ async def test_deploy_active(ops_test: OpsTest): charm, application_name=APP_NAME, num_units=3, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing"}, ) await ops_test.model.wait_for_idle(apps=[APP_NAME], status="active", timeout=1500) diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index 07e862403c..d927ec1e3e 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -8,7 +8,7 @@ from pytest_operator.plugin import OpsTest from .helpers import ( - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, db_connect, get_password, @@ -98,7 +98,7 @@ async def test_plugins(ops_test: OpsTest) -> None: await ops_test.model.deploy( charm, num_units=2, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing"}, ) await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=1500) diff --git a/tests/integration/test_subordinates.py b/tests/integration/test_subordinates.py index f9d30dedba..be9be926cc 100644 --- a/tests/integration/test_subordinates.py +++ b/tests/integration/test_subordinates.py @@ -9,7 +9,7 @@ from pytest_operator.plugin import OpsTest from .helpers import ( - CHARM_SERIES, + CHARM_BASE, scale_application, ) @@ -28,13 +28,14 @@ async def test_deploy(ops_test: OpsTest, charm: str, github_secrets): charm, application_name=DATABASE_APP_NAME, num_units=3, - series=CHARM_SERIES, + base=CHARM_BASE, ), ops_test.model.deploy( UBUNTU_PRO_APP_NAME, config={"token": github_secrets["UBUNTU_PRO_TOKEN"]}, channel="latest/edge", num_units=0, + base=CHARM_BASE, ), ops_test.model.deploy( LS_CLIENT, @@ -45,6 +46,7 @@ async def test_deploy(ops_test: OpsTest, charm: str, github_secrets): }, channel="latest/edge", num_units=0, + base=CHARM_BASE, ), ) diff --git a/tests/integration/test_tls.py b/tests/integration/test_tls.py index 814d266267..73164112d4 100644 --- a/tests/integration/test_tls.py +++ b/tests/integration/test_tls.py @@ -12,7 +12,7 @@ change_patroni_setting, ) from .helpers import ( - CHARM_SERIES, + CHARM_BASE, DATABASE_APP_NAME, METADATA, change_primary_start_timeout, @@ -58,7 +58,7 @@ async def test_deploy_active(ops_test: OpsTest): charm, application_name=APP_NAME, num_units=3, - series=CHARM_SERIES, + base=CHARM_BASE, config={"profile": "testing"}, ) # No wait between deploying charms, since we can't guarantee users will wait. Furthermore, @@ -72,7 +72,7 @@ async def test_tls_enabled(ops_test: OpsTest) -> None: async with ops_test.fast_forward(): # Deploy TLS Certificates operator. await ops_test.model.deploy( - tls_certificates_app_name, config=tls_config, channel=tls_channel + tls_certificates_app_name, config=tls_config, channel=tls_channel, base=CHARM_BASE ) # Relate it to the PostgreSQL to enable TLS. From c016b2d78de35504fedc99ca7fc77e9e9b103046 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 22:16:56 +0000 Subject: [PATCH 7/9] Use libjuju 3.5.0.0 in juju 3.6 workflow --- .github/workflows/juju_3_6_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/juju_3_6_ci.yaml b/.github/workflows/juju_3_6_ci.yaml index 06aed972c0..df77d5cbcf 100644 --- a/.github/workflows/juju_3_6_ci.yaml +++ b/.github/workflows/juju_3_6_ci.yaml @@ -31,7 +31,7 @@ jobs: architecture: amd64 cloud: lxd juju-snap-channel: 3.6/beta - libjuju-version-constraint: 3.5.2.0 + libjuju-version-constraint: 3.5.0.0 secrets: # GitHub appears to redact each line of a multi-line secret # Avoid putting `{` or `}` on a line by itself so that it doesn't get redacted in logs From c315e32a113cc731368354624749d4f9f311fc58 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Fri, 6 Sep 2024 18:12:32 +0000 Subject: [PATCH 8/9] Only run juju 3.6 tests on nightly schedule --- .github/workflows/ci.yaml | 24 ++++++++++------ .github/workflows/juju_3_6_ci.yaml | 45 ------------------------------ 2 files changed, 15 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/juju_3_6_ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 47f6c36500..7e4367501b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,15 +7,14 @@ concurrency: cancel-in-progress: true on: -# TODO: uncomment below before merging - # pull_request: - # paths-ignore: - # - '.gitignore' - # - '.jujuignore' - # - 'LICENSE' - # - '**.md' - # - .github/renovate.json5 - # - '.github/workflows/sync_docs.yaml' + pull_request: + paths-ignore: + - '.gitignore' + - '.jujuignore' + - 'LICENSE' + - '**.md' + - .github/renovate.json5 + - '.github/workflows/sync_docs.yaml' schedule: - cron: '53 0 * * *' # Daily at 00:53 UTC # Triggered on push to branch "main" by .github/workflows/release.yaml @@ -60,6 +59,8 @@ 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: @@ -67,6 +68,10 @@ jobs: agent: 3.4.5 # renovate: juju-agent-pin-minor allure_on_amd64: true architecture: arm64 + - juju: + snap_channel: 3.6/beta + allure_on_amd64: false + architecture: arm64 name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }} needs: - lint @@ -78,6 +83,7 @@ jobs: architecture: ${{ matrix.architecture }} cloud: lxd 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: diff --git a/.github/workflows/juju_3_6_ci.yaml b/.github/workflows/juju_3_6_ci.yaml deleted file mode 100644 index df77d5cbcf..0000000000 --- a/.github/workflows/juju_3_6_ci.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2024 Canonical Ltd. -# See LICENSE file for licensing details. -name: Juju 3.6 CI tests - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - pull_request: # TODO: remove once PR is approved and confirmed tests passing on 3.6 - -jobs: - lint: - name: Lint - uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v18.0.0 - - build: - name: Build charm - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v18.0.0 - with: - cache: true - - integration-test-3-6: - name: Integration | 3.6 - needs: - - lint - - build - uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v18.0.0 - with: - artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} - architecture: amd64 - cloud: lxd - juju-snap-channel: 3.6/beta - libjuju-version-constraint: 3.5.0.0 - secrets: - # GitHub appears to redact each line of a multi-line secret - # Avoid putting `{` or `}` on a line by itself so that it doesn't get redacted in logs - integration-test: | - { "AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}", - "AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}", - "GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}", - "GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}", - "UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}", - "LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}", - "LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}", } From fb8f96a820be96d42702bb0c8adfa1477e767d3e Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Fri, 6 Sep 2024 18:53:12 +0000 Subject: [PATCH 9/9] Add juju snap channel to the integration CI name --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e4367501b..06e16cd672 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,7 +72,7 @@ jobs: snap_channel: 3.6/beta allure_on_amd64: false architecture: arm64 - name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }} + name: Integration | ${{ matrix.juju.agent || matrix.juju.snap_channel }} | ${{ matrix.architecture }} needs: - lint - unit-test