From 592ee286c0c5a57ebf8eb8438ff5f435e0a31112 Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Mon, 10 Nov 2025 16:17:12 +0100 Subject: [PATCH] Update flaky event test --- tests/integration/test_infrahub_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_infrahub_client.py b/tests/integration/test_infrahub_client.py index 7b95773b..8c972d0a 100644 --- a/tests/integration/test_infrahub_client.py +++ b/tests/integration/test_infrahub_client.py @@ -187,7 +187,13 @@ async def test_task_query(self, client: InfrahubClient, base_dataset, set_pagina # Query Tasks using Parallel mode tasks_parallel = await client.task.filter(filter=TaskFilter(state=[TaskState.COMPLETED]), parallel=True) assert tasks_parallel - assert len(tasks_parallel) == len(tasks) + task_parallel_ids = [task.id for task in tasks_parallel] + + # Additional tasks might have been completed between the two queries + # validate that we get at least as many tasks as in the first query + # and that all task IDs from the first query are present in the second one + assert len(tasks_parallel) >= len(tasks) + assert set(task_ids).issubset(set(task_parallel_ids)) # Query Tasks by ID tasks_parallel_filtered = await client.task.filter(filter=TaskFilter(ids=task_ids[:2]), parallel=True)