Skip to content

Commit

Permalink
Build trino later, start with postgresql and ranger integration
Browse files Browse the repository at this point in the history
  • Loading branch information
AmberCharitos committed Mar 26, 2024
1 parent e04f60c commit f6142ec
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions tests/integration/test_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit f6142ec

Please sign in to comment.