From f6142ec6498d5106bb16006d2e43d5f50b37494e Mon Sep 17 00:00:00 2001 From: Amber Charitos Date: Tue, 26 Mar 2024 08:29:03 +0000 Subject: [PATCH] Build trino later, start with postgresql and ranger integration --- tests/integration/test_policy.py | 49 +++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/tests/integration/test_policy.py b/tests/integration/test_policy.py index 274217b..afca622 100644 --- a/tests/integration/test_policy.py +++ b/tests/integration/test_policy.py @@ -31,44 +31,43 @@ @pytest_asyncio.fixture(name="deploy-policy", scope="module") async def deploy(ops_test: OpsTest): """Deploy the app.""" - charm = await ops_test.build_charm(".") - resources = { - "trino-image": METADATA["resources"]["trino-image"]["upstream-source"] - } - await ops_test.model.deploy(RANGER_NAME, channel="edge") + # Prepare policy manager + await ops_test.model.deploy(RANGER_NAME, channel="stable") await ops_test.model.deploy(POSTGRES_NAME, channel="14", trust=True) await ops_test.model.wait_for_idle( apps=[POSTGRES_NAME], status="active", raise_on_blocked=False, - timeout=1000, - ) - - await ops_test.model.deploy( - charm, - resources=resources, - application_name=APP_NAME, - num_units=1, + timeout=2000, ) - await ops_test.model.wait_for_idle( apps=[RANGER_NAME], status="blocked", raise_on_blocked=False, - timeout=1000, + timeout=2000, ) + logger.info("Integrating PostgreSQL and Ranger") + logger.info(ops_test.model.applications) await ops_test.model.integrate(RANGER_NAME, POSTGRES_NAME) await ops_test.model.set_config({"update-status-hook-interval": "1m"}) + await ops_test.model.wait_for_idle( apps=[RANGER_NAME, POSTGRES_NAME], status="active", raise_on_blocked=False, - timeout=1500, + timeout=2000, ) + await ops_test.model.deploy(LDAP_NAME, channel="edge") + await ops_test.model.wait_for_idle( + apps=[LDAP_NAME], + status="active", + raise_on_blocked=False, + timeout=1500, + ) action = ( await ops_test.model.applications[LDAP_NAME] .units[0] @@ -102,7 +101,23 @@ class TestPolicyManager: async def test_policy_enforcement(self, ops_test: OpsTest): """Test policy enforcement.""" - # Integrate Trino and Ranger. + charm = await ops_test.build_charm(".") + resources = { + "trino-image": METADATA["resources"]["trino-image"][ + "upstream-source" + ] + } + logger.info("Deploying Trino") + trino_config = {"ranger-service-name": "trino-service"} + await ops_test.model.deploy( + charm, + resources=resources, + application_name=APP_NAME, + num_units=1, + config=trino_config, + ) + + logger.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],