From 9cd683ba9114a52618a08e968a1f094fe86e0792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Wed, 7 Aug 2024 15:32:58 +0200 Subject: [PATCH] Try to mitigate flakiness in driver test If the echo command takes more than 0.1 sec, this could yield flakiness, so change the logic to avoid that pitfall. --- tests/integration_tests/scheduler/test_generic_driver.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/integration_tests/scheduler/test_generic_driver.py b/tests/integration_tests/scheduler/test_generic_driver.py index bbe16c12630..74998aa9fc2 100644 --- a/tests/integration_tests/scheduler/test_generic_driver.py +++ b/tests/integration_tests/scheduler/test_generic_driver.py @@ -123,27 +123,26 @@ async def finished(iens, returncode): @pytest.mark.flaky(reruns=5) async def test_repeated_submit_same_iens(driver: Driver, tmp_path): """Submits are allowed to be repeated for the same iens, and are to be - handled according to FIFO, but this cannot be guaranteed as it depends + handled according to FIFO, but this order cannot be guaranteed as it depends on the host operating system.""" os.chdir(tmp_path) await driver.submit( 0, "sh", "-c", - f"echo started > {tmp_path}/submit1; echo submit1 > {tmp_path}/submissionrace", + f"echo submit1 > {tmp_path}/submissionrace; touch {tmp_path}/submit1", name="submit1", ) await driver.submit( 0, "sh", "-c", - f"echo started > {tmp_path}/submit2; echo submit2 > {tmp_path}/submissionrace", + f"echo submit2 > {tmp_path}/submissionrace; touch {tmp_path}/submit2", name="submit2", ) # Wait until both submissions have done their thing: while not Path("submit1").exists() or not Path("submit2").exists(): await asyncio.sleep(0.1) - await asyncio.sleep(0.1) assert Path("submissionrace").read_text(encoding="utf-8") == "submit2\n"