Skip to content

Commit

Permalink
Try to mitigate flakiness in driver test
Browse files Browse the repository at this point in the history
If the echo command takes more than 0.1 sec, this could yield flakiness, so change the
logic to avoid that pitfall.
  • Loading branch information
berland committed Aug 8, 2024
1 parent e589a50 commit 9cd683b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/integration_tests/scheduler/test_generic_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down

0 comments on commit 9cd683b

Please sign in to comment.