From 837662644efdf9b946ddaf8d6f62f3a0ac730d31 Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Thu, 9 Nov 2023 16:49:18 +0200 Subject: [PATCH] Skipping fixtures and bump in timeouts --- tests/integration/conftest.py | 14 ++++++++++++++ tests/integration/ha_tests/test_replication.py | 2 +- tests/integration/ha_tests/test_restore_cluster.py | 2 +- tests/integration/ha_tests/test_self_healing.py | 2 +- tests/integration/ha_tests/test_upgrade.py | 2 +- tests/integration/test_charm.py | 2 +- tests/integration/test_db.py | 5 ++--- tests/integration/test_db_admin.py | 2 +- tests/integration/test_password_rotation.py | 2 +- tests/integration/test_plugins.py | 2 +- 10 files changed, 24 insertions(+), 11 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 87bd24fb9b..9379120ae9 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -10,3 +10,17 @@ async def charm(ops_test: OpsTest): """Build the charm-under-test.""" # Build charm from local source folder. yield await ops_test.build_charm(".") + + +@pytest.fixture(scope="module") +def juju2(ops_test): + """Skip test if it is not on juju2.""" + if hasattr(ops_test.model, "list_secrets"): + pytest.skip("Test can't run on Juju3") + + +@pytest.fixture(scope="module") +def juju3(ops_test): + """Skip test if it is not on juju3.""" + if not hasattr(ops_test.model, "list_secrets"): + pytest.skip("Test can't run on Juju2") diff --git a/tests/integration/ha_tests/test_replication.py b/tests/integration/ha_tests/test_replication.py index 262f876e2b..abb7d04025 100644 --- a/tests/integration/ha_tests/test_replication.py +++ b/tests/integration/ha_tests/test_replication.py @@ -49,7 +49,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None: if wait_for_apps: async with ops_test.fast_forward(): - await ops_test.model.wait_for_idle(status="active", timeout=1000) + await ops_test.model.wait_for_idle(status="active", timeout=1500) @pytest.mark.group(1) diff --git a/tests/integration/ha_tests/test_restore_cluster.py b/tests/integration/ha_tests/test_restore_cluster.py index 0eb55246f5..1d11d4d5e5 100644 --- a/tests/integration/ha_tests/test_restore_cluster.py +++ b/tests/integration/ha_tests/test_restore_cluster.py @@ -55,7 +55,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None: config={"profile": "testing"}, ) - await ops_test.model.wait_for_idle(status="active", timeout=1000) + await ops_test.model.wait_for_idle(status="active", timeout=1500) # TODO have a better way to bootstrap clusters with existing storage primary = await get_primary( diff --git a/tests/integration/ha_tests/test_self_healing.py b/tests/integration/ha_tests/test_self_healing.py index 4327ac9a9c..ba2f5c485d 100644 --- a/tests/integration/ha_tests/test_self_healing.py +++ b/tests/integration/ha_tests/test_self_healing.py @@ -91,7 +91,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None: if wait_for_apps: async with ops_test.fast_forward(): - await ops_test.model.wait_for_idle(status="active", timeout=1000) + await ops_test.model.wait_for_idle(status="active", timeout=1500) @pytest.mark.group(1) diff --git a/tests/integration/ha_tests/test_upgrade.py b/tests/integration/ha_tests/test_upgrade.py index 6f10dfd0b8..d8b916087b 100644 --- a/tests/integration/ha_tests/test_upgrade.py +++ b/tests/integration/ha_tests/test_upgrade.py @@ -48,7 +48,7 @@ async def test_deploy_latest(ops_test: OpsTest) -> None: logger.info("Wait for applications to become active") async with ops_test.fast_forward(): await ops_test.model.wait_for_idle( - apps=[DATABASE_APP_NAME, APPLICATION_NAME], status="active", timeout=1000 + apps=[DATABASE_APP_NAME, APPLICATION_NAME], status="active", timeout=1500 ) assert len(ops_test.model.applications[DATABASE_APP_NAME].units) == 3 diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index cb222546dc..2ddc6152a0 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -52,7 +52,7 @@ async def test_deploy(ops_test: OpsTest, charm: str): # Reducing the update status frequency to speed up the triggering of deferred events. await ops_test.model.set_config({"update-status-hook-interval": "10s"}) - await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=1000) + await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=1500) assert ops_test.model.applications[DATABASE_APP_NAME].units[0].workload_status == "active" diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index aebed37039..8f5b39db41 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -48,7 +48,7 @@ async def test_mailman3_core_db(ops_test: OpsTest, charm: str) -> None: await ops_test.model.wait_for_idle( apps=[DATABASE_APP_NAME], status="active", - timeout=1000, + timeout=1500, wait_for_exact_units=DATABASE_UNITS, ) @@ -322,8 +322,7 @@ async def test_weebl_db(ops_test: OpsTest, charm: str) -> None: @pytest.mark.group(1) -@pytest.mark.juju2 -async def test_canonical_livepatch_onprem_bundle_db(ops_test: OpsTest) -> None: +async def test_canonical_livepatch_onprem_bundle_db(ops_test: OpsTest, juju2) -> None: # Deploy and test the Livepatch onprem bundle (using this PostgreSQL charm # and an overlay to make the Ubuntu Advantage charm work with PostgreSQL). # We intentionally wait for the `✘ sync_token not set` status message as we diff --git a/tests/integration/test_db_admin.py b/tests/integration/test_db_admin.py index 1fa4c1d21c..77ff93b59a 100644 --- a/tests/integration/test_db_admin.py +++ b/tests/integration/test_db_admin.py @@ -119,7 +119,7 @@ async def test_landscape_scalable_bundle_db(ops_test: OpsTest, charm: str) -> No # rebooting the unit machine in the middle of a hook (what is needed when the issue from # https://bugs.launchpad.net/juju/+bug/1999758 happens). await ops_test.model.wait_for_idle( - apps=[DATABASE_APP_NAME], status="active", timeout=600, raise_on_error=False + apps=[DATABASE_APP_NAME], status="active", timeout=1500, raise_on_error=False ) await ensure_correct_relation_data(ops_test, DATABASE_UNITS, LANDSCAPE_APP_NAME, RELATION_NAME) diff --git a/tests/integration/test_password_rotation.py b/tests/integration/test_password_rotation.py index 0cc19fcae0..c4286a1a10 100644 --- a/tests/integration/test_password_rotation.py +++ b/tests/integration/test_password_rotation.py @@ -32,7 +32,7 @@ async def test_deploy_active(ops_test: OpsTest): series=CHARM_SERIES, config={"profile": "testing"}, ) - await ops_test.model.wait_for_idle(apps=[APP_NAME], status="active", timeout=1000) + await ops_test.model.wait_for_idle(apps=[APP_NAME], status="active", timeout=1500) @pytest.mark.group(1) diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index e616e9b351..282e400b6d 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -39,7 +39,7 @@ async def test_plugins(ops_test: OpsTest) -> None: series=CHARM_SERIES, config={"profile": "testing"}, ) - await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active") + await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=1500) # Check that the available plugins are disabled. primary = await get_primary(ops_test, f"{DATABASE_APP_NAME}/0")