diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 8f49b5a..6ae7cc5 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -2,12 +2,11 @@ # See LICENSE file for licensing details. """Trino charm integration test config.""" -import asyncio import logging import pytest import pytest_asyncio -from helpers import APP_NAME, METADATA, NGINX_NAME, WORKER_NAME, POSTGRES_NAME +from helpers import APP_NAME, METADATA, NGINX_NAME, WORKER_NAME from pytest_operator.plugin import OpsTest logger = logging.getLogger(__name__) @@ -17,16 +16,6 @@ @pytest_asyncio.fixture(name="deploy", scope="module") async def deploy(ops_test: OpsTest): """Deploy the app.""" - asyncio.gather( - ops_test.model.deploy(POSTGRES_NAME, channel="14", trust=True), - ) - async with ops_test.fast_forward(): - await ops_test.model.wait_for_idle( - apps=[POSTGRES_NAME], - status="active", - raise_on_blocked=False, - timeout=2000, - ) charm = await ops_test.build_charm(".") resources = { "trino-image": METADATA["resources"]["trino-image"]["upstream-source"] @@ -52,29 +41,28 @@ async def deploy(ops_test: OpsTest): await ops_test.model.deploy(NGINX_NAME, trust=True) - async with ops_test.fast_forward(): - await ops_test.model.wait_for_idle( - apps=[APP_NAME, WORKER_NAME], - status="active", - raise_on_blocked=False, - timeout=600, - ) - await ops_test.model.wait_for_idle( - apps=[NGINX_NAME], - status="waiting", - raise_on_blocked=False, - timeout=600, - ) + await ops_test.model.wait_for_idle( + apps=[APP_NAME, WORKER_NAME], + status="active", + raise_on_blocked=False, + timeout=600, + ) + await ops_test.model.wait_for_idle( + apps=[NGINX_NAME], + status="waiting", + raise_on_blocked=False, + timeout=600, + ) - await ops_test.model.integrate(APP_NAME, NGINX_NAME) + await ops_test.model.integrate(APP_NAME, NGINX_NAME) - await ops_test.model.wait_for_idle( - apps=[APP_NAME], - status="active", - raise_on_blocked=False, - timeout=300, - ) - assert ( - ops_test.model.applications[APP_NAME].units[0].workload_status - == "active" - ) + await ops_test.model.wait_for_idle( + apps=[APP_NAME], + status="active", + raise_on_blocked=False, + timeout=300, + ) + assert ( + ops_test.model.applications[APP_NAME].units[0].workload_status + == "active" + ) diff --git a/tests/integration/test_policy.py b/tests/integration/test_policy.py index b1033a8..4e5a186 100644 --- a/tests/integration/test_policy.py +++ b/tests/integration/test_policy.py @@ -34,17 +34,26 @@ class TestPolicyManager: async def test_policy_enforcement(self, ops_test: OpsTest): """Add Ranger relation and apply group configuration.""" # Deploy and prepare Ranger admin. + await ps_test.model.deploy(POSTGRES_NAME, channel="14", trust=True) await ops_test.model.deploy(RANGER_NAME, channel="edge") await ops_test.model.deploy(LDAP_NAME, channel="edge") - await ops_test.model.integrate(RANGER_NAME, POSTGRES_NAME) - await ops_test.model.wait_for_idle( - apps=[POSTGRES_NAME, RANGER_NAME], - status="active", - raise_on_blocked=False, - raise_on_error=False, - timeout=2000, - ) + async with ops_test.fast_forward(): + await ops_test.model.wait_for_idle( + apps=[POSTGRES_NAME, RANGER_NAME, LDAP_NAME], + status="active", + raise_on_blocked=False, + timeout=2000, + ) + await ops_test.model.integrate(RANGER_NAME, POSTGRES_NAME) + + await ops_test.model.wait_for_idle( + apps=[POSTGRES_NAME, RANGER_NAME], + status="active", + raise_on_blocked=False, + raise_on_error=False, + timeout=2000, + ) # Deploy and prepare Ranger usersync. await ops_test.model.wait_for_idle( @@ -70,7 +79,6 @@ async def test_policy_enforcement(self, ops_test: OpsTest): await ops_test.model.integrate(USERSYNC_NAME, LDAP_NAME) # Integrate Trino and Ranger. - logging.info("integrating trino and ranger") await ops_test.model.integrate(RANGER_NAME, APP_NAME) await ops_test.model.wait_for_idle( apps=[APP_NAME, RANGER_NAME, USERSYNC_NAME, LDAP_NAME],