Skip to content

Commit

Permalink
Add retries
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirp committed Nov 19, 2024
1 parent c2188c0 commit cb7d120
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pytest
import yaml
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, wait_fixed

from .. import markers
from ..helpers import (
Expand Down Expand Up @@ -208,13 +209,15 @@ async def test_filter_out_degraded_replicas(ops_test: OpsTest):
# Topology observer runs every half a minute
await asyncio.sleep(60)

data = await get_application_relation_data(
ops_test,
APPLICATION_APP_NAME,
FIRST_DATABASE_RELATION_NAME,
"read-only-endpoints",
)
assert len(data.split(",")) == 1
for attempt in Retrying(stop=stop_after_attempt(3), wait=wait_fixed(3), reraise=True):
with attempt:
data = await get_application_relation_data(
ops_test,
APPLICATION_APP_NAME,
FIRST_DATABASE_RELATION_NAME,
"read-only-endpoints",
)
assert data is None

await start_machine(ops_test, machine)
await ops_test.model.wait_for_idle(apps=DATABASE_APP_NAME, status="active", timeout=200)
Expand Down

0 comments on commit cb7d120

Please sign in to comment.