From 1ad00e89e0a248cfe2614943daf5af9e5728ac45 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Tue, 2 Jul 2024 09:11:46 -0300 Subject: [PATCH 1/9] Enforce Juju versions Signed-off-by: Marcelo Henrique Neppel --- metadata.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metadata.yaml b/metadata.yaml index 850712c8b7..520bc8e551 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -65,3 +65,13 @@ storage: assumes: - juju + - any-of: + - all-of: + - juju >= 2.9.49 + - juju < 3 + - all-of: + - juju >= 3.4.3 + - juju < 3.5 + - all-of: + - juju >= 3.5.2 + - juju < 4 From 886d630e278b5e9167a9d779f256b7899315a3e9 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Tue, 2 Jul 2024 09:26:47 -0300 Subject: [PATCH 2/9] Upgrade to Juju 3.4.3 Signed-off-by: Marcelo Henrique Neppel --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6e5e974ca6..f73cd0f008 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,13 +56,13 @@ jobs: - agent: 2.9.49 # renovate: latest juju 2 libjuju: ==2.9.49.0 # renovate: latest libjuju 2 allure_on_amd64: false - - agent: 3.1.8 # renovate: latest juju 3 + - agent: 3.4.3 # renovate: latest juju 3 allure_on_amd64: true architecture: - amd64 include: - juju: - agent: 3.1.8 # renovate: latest juju 3 + agent: 3.4.3 # renovate: latest juju 3 allure_on_amd64: true architecture: arm64 name: Integration test charm | ${{ matrix.juju.agent }} | ${{ matrix.architecture }} From b1650f8318eecae3621e0f53bfaa56cc33d6fe9f Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Tue, 2 Jul 2024 12:34:42 -0300 Subject: [PATCH 3/9] Fix test_mailman3_core_db Signed-off-by: Marcelo Henrique Neppel --- tests/integration/helpers.py | 3 +++ tests/integration/test_db.py | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 27b9367ede..ae36eaf9a9 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -293,6 +293,7 @@ async def deploy_and_relate_application_with_postgresql( config: dict = None, channel: str = "stable", relation: str = "db", + series: str = None, ) -> int: """Helper function to deploy and relate application with PostgreSQL. @@ -305,6 +306,7 @@ async def deploy_and_relate_application_with_postgresql( channel: The channel to use for the charm. relation: Name of the PostgreSQL relation to relate the application to. + series: Series of the charm to deploy. Returns: the id of the created relation. @@ -316,6 +318,7 @@ async def deploy_and_relate_application_with_postgresql( application_name=application_name, num_units=number_of_units, config=config, + series=series, ) await ops_test.model.wait_for_idle( apps=[application_name], diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index 5ea134700f..c65ba5b883 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -70,6 +70,7 @@ async def test_mailman3_core_db(ops_test: OpsTest, charm: str) -> None: MAILMAN3_CORE_APP_NAME, APPLICATION_UNITS, config, + series=CHARM_SERIES, ) await check_databases_creation(ops_test, ["mailman3"]) From ed397ee35eaf3dcc2889f2e206501c7cefe75a5c Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Wed, 3 Jul 2024 10:06:40 -0300 Subject: [PATCH 4/9] Run sentry test only on Juju 2 Signed-off-by: Marcelo Henrique Neppel --- tests/integration/test_db.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index c65ba5b883..8ca8fba3ac 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -193,6 +193,7 @@ async def test_relation_data_is_updated_correctly_when_scaling(ops_test: OpsTest psycopg2.connect(primary_connection_string) +@markers.juju2 @pytest.mark.group(1) @markers.amd64_only # sentry snap not available for arm64 async def test_sentry_db_blocked(ops_test: OpsTest, charm: str) -> None: From c4525af17a89fe6ff8db10f3eeeccb101112d181 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Wed, 3 Jul 2024 11:53:19 -0300 Subject: [PATCH 5/9] Change mailman3-core series to focal Signed-off-by: Marcelo Henrique Neppel --- tests/integration/test_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index 8ca8fba3ac..39aed894c6 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -70,7 +70,7 @@ async def test_mailman3_core_db(ops_test: OpsTest, charm: str) -> None: MAILMAN3_CORE_APP_NAME, APPLICATION_UNITS, config, - series=CHARM_SERIES, + series="focal", ) await check_databases_creation(ops_test, ["mailman3"]) From 85025d0c1ef5c5ebe820544193571cec3d55f6d6 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Mon, 8 Jul 2024 17:07:38 -0300 Subject: [PATCH 6/9] Change constraint to Juju 3.5.1 Signed-off-by: Marcelo Henrique Neppel --- metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.yaml b/metadata.yaml index 520bc8e551..94cb47ec89 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -73,5 +73,5 @@ assumes: - juju >= 3.4.3 - juju < 3.5 - all-of: - - juju >= 3.5.2 + - juju >= 3.5.1 - juju < 4 From 9f7106c3a3ec0ac146c599e3a5746f9b8e50b09a Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Thu, 11 Jul 2024 18:08:11 -0300 Subject: [PATCH 7/9] Add test to replace Sentry extensions block test on Juju 3 Signed-off-by: Marcelo Henrique Neppel --- tests/integration/test_db.py | 50 +++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index 39aed894c6..cc238ee47a 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -35,6 +35,9 @@ DATABASE_UNITS = 2 RELATION_NAME = "db" +EXTENSIONS_BLOCKING_MESSAGE = ( + "extensions requested through relation, enable them through config options" +) ROLES_BLOCKING_MESSAGE = ( "roles requested through relation, use postgresql_client interface instead" ) @@ -232,10 +235,7 @@ async def test_sentry_db_blocked(ops_test: OpsTest, charm: str) -> None: except JujuUnitError: pass - assert ( - leader_unit.workload_status_message - == "extensions requested through relation, enable them through config options" - ) + assert leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE # Verify that the charm unblocks when the extensions are enabled after being blocked # due to disabled extensions. @@ -333,6 +333,48 @@ async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None: ) +@markers.juju3 # As the Sentry test already checks Juju 2. +@pytest.mark.group(1) +async def test_extensions_blocking(ops_test: OpsTest, charm: str) -> None: + await asyncio.gather( + ops_test.model.applications[APPLICATION_NAME].set_config({"legacy_roles": "False"}), + ops_test.model.applications[f"{APPLICATION_NAME}2"].set_config({"legacy_roles": "False"}), + ) + await ops_test.model.wait_for_idle( + apps=[APPLICATION_NAME, f"{APPLICATION_NAME}2"], + status="active", + timeout=1000, + ) + + await asyncio.gather( + ops_test.model.relate(f"{DATABASE_APP_NAME}:db", f"{APPLICATION_NAME}:db"), + ops_test.model.relate(f"{DATABASE_APP_NAME}:db", f"{APPLICATION_NAME}2:db"), + ) + + leader_unit = await get_leader_unit(ops_test, DATABASE_APP_NAME) + await ops_test.model.block_until( + lambda: leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE, timeout=1000 + ) + + assert leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE + + logger.info("Verify that the charm remains blocked if there are other blocking relations") + await ops_test.model.applications[DATABASE_APP_NAME].destroy_relation( + f"{DATABASE_APP_NAME}:db", f"{APPLICATION_NAME}:db" + ) + + await ops_test.model.block_until( + lambda: leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE, timeout=1000 + ) + + assert leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE + + logger.info("Verify that active status is restored when all blocking relations are gone") + await ops_test.model.applications[DATABASE_APP_NAME].destroy_relation( + f"{DATABASE_APP_NAME}:db", f"{APPLICATION_NAME}2:db" + ) + + @markers.juju2 @pytest.mark.group(1) @markers.amd64_only # canonical-livepatch-server charm (in bundle) not available for arm64 From 39f42ba7d71bf829706a9ad8345ad1bec616cea4 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Thu, 11 Jul 2024 18:10:14 -0300 Subject: [PATCH 8/9] Upgrade CI to use Juju 3.4.4 Signed-off-by: Marcelo Henrique Neppel --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c37bab01f..e4036ed684 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,13 +56,13 @@ jobs: - agent: 2.9.49 # renovate: latest juju 2 libjuju: ==2.9.49.0 # renovate: latest libjuju 2 allure_on_amd64: false - - agent: 3.4.3 # renovate: latest juju 3 + - agent: 3.4.4 # renovate: latest juju 3 allure_on_amd64: true architecture: - amd64 include: - juju: - agent: 3.4.3 # renovate: latest juju 3 + agent: 3.4.4 # renovate: latest juju 3 allure_on_amd64: true architecture: arm64 name: Integration test charm | ${{ matrix.juju.agent }} | ${{ matrix.architecture }} From 708238ff91954f7529c3cbc898b068ceda888be3 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Tue, 16 Jul 2024 17:15:30 -0300 Subject: [PATCH 9/9] Pin LXD channel Signed-off-by: Marcelo Henrique Neppel --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d7b2a99b72..ff678a6ae8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -75,6 +75,7 @@ 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' }}