Skip to content

[MISC] Charm test #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,12 @@ async def test_persist_data_through_primary_deletion(ops_test: OpsTest):
await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=2000)

# Testing write occurred to every postgres instance by reading from them
for unit in ops_test.model.applications[DATABASE_APP_NAME].units:
host = unit.public_address
logger.info("connecting to the database host: %s", host)
with db_connect(host, password) as connection, connection.cursor() as cursor:
# Ensure we can read from "primarydeletiontest" table
cursor.execute("SELECT * FROM primarydeletiontest;")
connection.close()
for attempt in Retrying(stop=stop_after_attempt(5), wait=wait_fixed(5), reraise=True):
with attempt:
for unit in ops_test.model.applications[DATABASE_APP_NAME].units:
host = unit.public_address
logger.info("connecting to the database host: %s", host)
with db_connect(host, password) as connection, connection.cursor() as cursor:
# Ensure we can read from "primarydeletiontest" table
cursor.execute("SELECT * FROM primarydeletiontest;")
connection.close()
Loading