From e29a684e7c8431aa602adbdfc610a276ffc22042 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Tue, 30 Jan 2024 13:39:44 +0200 Subject: [PATCH] tests: Handle DB purges in progress --- test_main.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test_main.py b/test_main.py index 64754637..8ad3630e 100644 --- a/test_main.py +++ b/test_main.py @@ -328,18 +328,17 @@ def filter_test_data(data): # Wait and check for the purge deadline = datetime.now(timezone.utc) + timedelta(minutes=5) while datetime.now(timezone.utc) < deadline: + time.sleep(5) dump = filter_test_data(client.dump()) - # If data has changed - if not all( - len(dump.get(n, [])) == 2 + # If everything was purged + # NOTE: For some reason we're hitting incomplete purges sometimes + if all( + len(dump.get(n, [])) == 1 for n in kcidb.io.SCHEMA.graph if n ): - assert dump == data_after break - time.sleep(5) - else: - assert False, "Operational database purge timed out" + assert dump == data_after # Make sure we were getting the operational DB dump op_client = kcidb.db.Client(os.environ["KCIDB_OPERATIONAL_DATABASE"])