Skip to content

Commit

Permalink
fix flakey sharding tests by using an accurate wait (#414)
Browse files Browse the repository at this point in the history
## Issue
Sharding tests are flakey for status checking

## Solution
Wait for the model to settle before performing status checking
  • Loading branch information
MiaAltieri authored May 14, 2024
1 parent 79c7675 commit a74da74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/integration/sharding_tests/test_sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
timeout=TIMEOUT,
),
ops_test.model.wait_for_idle(
apps=[SHARD_ONE_APP_NAME, SHARD_TWO_APP_NAME],
apps=[SHARD_ONE_APP_NAME, SHARD_TWO_APP_NAME, SHARD_THREE_APP_NAME],
status="blocked",
idle_period=20,
timeout=TIMEOUT,
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/sharding_tests/test_sharding_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async def test_cannot_use_db_relation(ops_test: OpsTest) -> None:

await ops_test.model.wait_for_idle(
apps=SHARDING_COMPONENTS,
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand Down Expand Up @@ -172,6 +173,7 @@ async def test_cannot_use_legacy_db_relation(ops_test: OpsTest) -> None:

await ops_test.model.wait_for_idle(
apps=SHARDING_COMPONENTS,
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand Down Expand Up @@ -211,6 +213,7 @@ async def test_replication_config_server_relation(ops_test: OpsTest):

await ops_test.model.wait_for_idle(
apps=[REPLICATION_APP_NAME],
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand Down Expand Up @@ -240,6 +243,7 @@ async def test_replication_shard_relation(ops_test: OpsTest):

await ops_test.model.wait_for_idle(
apps=[REPLICATION_APP_NAME],
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand Down Expand Up @@ -277,6 +281,7 @@ async def test_replication_mongos_relation(ops_test: OpsTest) -> None:
await ops_test.model.wait_for_idle(
apps=[REPLICATION_APP_NAME],
idle_period=20,
status="blocked",
raise_on_blocked=False,
timeout=TIMEOUT,
)
Expand Down Expand Up @@ -313,6 +318,7 @@ async def test_shard_mongos_relation(ops_test: OpsTest) -> None:

await ops_test.model.wait_for_idle(
apps=[SHARD_ONE_APP_NAME],
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand All @@ -332,6 +338,7 @@ async def test_shard_mongos_relation(ops_test: OpsTest) -> None:

await ops_test.model.wait_for_idle(
apps=[SHARD_ONE_APP_NAME],
status="blocked",
idle_period=20,
raise_on_blocked=False,
timeout=TIMEOUT,
Expand All @@ -351,6 +358,7 @@ async def test_shard_s3_relation(ops_test: OpsTest) -> None:
await ops_test.model.wait_for_idle(
apps=[SHARD_ONE_APP_NAME],
idle_period=20,
status="blocked",
raise_on_blocked=False,
timeout=TIMEOUT,
)
Expand Down

0 comments on commit a74da74

Please sign in to comment.