Skip to content

Commit

Permalink
add await asyncio.sleep(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Jun 13, 2023
1 parent 65476f3 commit e32e29e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/integration/test_backlog_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async def test_01(kapitsj_mock: Mock, server: Callable[[], RestClient]) -> None:
rc = server()

for _ in range(N_JOBS):
await asyncio.sleep(0) # allow backlog runner to do its thing
await rc.request("POST", "/scan", POST_SCAN_BODY)

for i in range(N_JOBS):
Expand All @@ -128,12 +129,15 @@ async def test_10(
rc = server()

for i in range(N_JOBS):
await asyncio.sleep(0) # allow backlog runner to do its thing
resp = await rc.request("POST", "/scan", POST_SCAN_BODY)
entries = (await rc.request("GET", "/scans/backlog"))["entries"]
print_it(entries)
assert len(entries) == i + 1

print_it(await rc.request("DELETE", f"/scan/{resp['scan_id']}"))
await asyncio.sleep(0) # allow backlog runner to do its thing

print_it(await rc.request("GET", "/scans/backlog"))

await asyncio.sleep(skydriver.config.ENV.SCAN_BACKLOG_RUNNER_DELAY * N_JOBS * 1.01)
Expand Down

0 comments on commit e32e29e

Please sign in to comment.