From 2c9ecff9423ad50560b9c7215da085b660e1a44a Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Thu, 29 Aug 2024 21:25:19 +0000 Subject: [PATCH] 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.