From 79c76756c76f7d9b81863f12e3333913a74ba690 Mon Sep 17 00:00:00 2001 From: Mia Altieri <32723809+MiaAltieri@users.noreply.github.com> Date: Mon, 6 May 2024 11:15:23 +0200 Subject: [PATCH] [DPE-4263] fix errors for statuses in TLS sharding tests (#412) ## Issue tests for TLS tests are consistently failing due to status checks failing [see this release run](https://github.com/canonical/mongodb-operator/actions/runs/8896004004) ## Solution as it turns out the tests do not wait for the application to go into the blocked state which is why the tests fail. By waiting for blocked we wait for t he status hook to get called and update the messages in the units --- .../sharding_tests/test_sharding_tls.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/integration/sharding_tests/test_sharding_tls.py b/tests/integration/sharding_tests/test_sharding_tls.py index b2264a79e..5bd243a1f 100644 --- a/tests/integration/sharding_tests/test_sharding_tls.py +++ b/tests/integration/sharding_tests/test_sharding_tls.py @@ -124,6 +124,11 @@ async def test_tls_inconsistent_rels(ops_test: OpsTest) -> None: raise_on_blocked=False, ) + async with ops_test.fast_forward(): + await ops_test.model.wait_for_idle( + apps=[SHARD_ONE_APP_NAME], status="blocked", timeout=1000 + ) + shard_unit = ops_test.model.applications[SHARD_ONE_APP_NAME].units[0] assert ( shard_unit.workload_status_message == "Shard requires TLS to be enabled." @@ -155,6 +160,11 @@ async def test_tls_inconsistent_rels(ops_test: OpsTest) -> None: timeout=TIMEOUT, raise_on_blocked=False, ) + async with ops_test.fast_forward(): + await ops_test.model.wait_for_idle( + apps=[SHARD_ONE_APP_NAME], status="blocked", timeout=1000 + ) + shard_unit = ops_test.model.applications[SHARD_ONE_APP_NAME].units[0] assert ( shard_unit.workload_status_message == "Shard has TLS enabled, but config-server does not." @@ -174,6 +184,11 @@ async def test_tls_inconsistent_rels(ops_test: OpsTest) -> None: timeout=TIMEOUT, raise_on_blocked=False, ) + async with ops_test.fast_forward(): + await ops_test.model.wait_for_idle( + apps=[SHARD_ONE_APP_NAME], status="blocked", timeout=1000 + ) + shard_unit = ops_test.model.applications[SHARD_ONE_APP_NAME].units[0] assert ( shard_unit.workload_status_message == "Shard CA and Config-Server CA don't match."