Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirp committed Apr 16, 2024
1 parent 66b022e commit c518590
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/relations/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,6 @@ def _on_relation_changed(self, change_event: RelationChangedEvent):
change_event.defer()
return

dbs = self.charm.get_relation_databases()
if str(change_event.relation.id) not in dbs:
pass
logger.debug("relation not fully initialised - database mapping not yet set")
change_event.defer()
return

self.charm.render_pgb_config(reload_pgbouncer=True)
self.update_databags(
change_event.relation,
Expand Down
11 changes: 6 additions & 5 deletions tests/integration/relations/test_db_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
PG,
PGB,
deploy_postgres_bundle,
get_backend_user_pass,
)
from ..helpers.postgresql_helpers import (
check_database_users_existence,
Expand All @@ -32,12 +33,13 @@
@pytest.mark.group(1)
async def test_landscape_scalable_bundle_db(ops_test: OpsTest, pgb_charm_jammy: str) -> None:
"""Deploy Landscape Scalable Bundle to test the 'db-admin' relation."""
await deploy_postgres_bundle(
backend_relation = await deploy_postgres_bundle(
ops_test,
pgb_charm_jammy,
db_units=DATABASE_UNITS,
pgb_series="jammy",
pg_config={"profile": "testing", "plugin_plpython3u_enable": "True"},
pgb_config={"max_db_connections": "500"},
)

# Deploy and test the Landscape Scalable bundle (using this PostgreSQL charm).
Expand All @@ -49,6 +51,7 @@ async def test_landscape_scalable_bundle_db(ops_test: OpsTest, pgb_charm_jammy:
relation_name=RELATION_NAME,
timeout=3000,
)
pgb_user, pgb_pass = await get_backend_user_pass(ops_test, backend_relation)
await check_databases_creation(
ops_test,
[
Expand All @@ -59,12 +62,10 @@ async def test_landscape_scalable_bundle_db(ops_test: OpsTest, pgb_charm_jammy:
"landscape-standalone-resource-1",
"landscape-standalone-session",
],
pgb_user,
pgb_pass,
)

landscape_users = [f"relation-{relation_id}"]

await check_database_users_existence(ops_test, landscape_users, [])

# Create the admin user on Landscape through configs.
await ops_test.model.applications["landscape-server"].set_config({
"admin_email": "[email protected]",
Expand Down

0 comments on commit c518590

Please sign in to comment.