Wait for drained jobs instead of sleeping in the breaker isolation test
Some checks failed
build-docs / build (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / lint-frontend (push) Has been cancelled
Tests / URI paths (macos-latest, py3.13) (push) Has been cancelled
Tests / URI paths (macos-latest, py3.14) (push) Has been cancelled
Tests / URI paths (ubuntu-latest, py3.13) (push) Has been cancelled
Tests / URI paths (ubuntu-latest, py3.14) (push) Has been cancelled
Tests / URI paths (windows-latest, py3.13) (push) Has been cancelled
Tests / URI paths (windows-latest, py3.14) (push) Has been cancelled
build-docs / deploy (push) Has been cancelled
Tests / test (push) Has been cancelled
Some checks failed
build-docs / build (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / lint-frontend (push) Has been cancelled
Tests / URI paths (macos-latest, py3.13) (push) Has been cancelled
Tests / URI paths (macos-latest, py3.14) (push) Has been cancelled
Tests / URI paths (ubuntu-latest, py3.13) (push) Has been cancelled
Tests / URI paths (ubuntu-latest, py3.14) (push) Has been cancelled
Tests / URI paths (windows-latest, py3.13) (push) Has been cancelled
Tests / URI paths (windows-latest, py3.14) (push) Has been cancelled
build-docs / deploy (push) Has been cancelled
Tests / test (push) Has been cancelled
test_breaker_isolates_sources snapshotted job status after a fixed 0.2s sleep and failed on a loaded runner while two good jobs were still in flight. Poll for the drained jobs under a 5s deadline. Assert the paused source's jobs are unattempted: the queued-uri assertion alone passes with source isolation disabled, since a retried job returns to QUEUED.
This commit is contained in:
parent
5cecd7b50e
commit
d2af1a2e62
1 changed files with 9 additions and 2 deletions
|
|
@ -1054,16 +1054,23 @@ async def test_breaker_isolates_sources(client, jobs, sync):
|
|||
for _ in range(10):
|
||||
pool._breaker_for("bad").record_failure()
|
||||
|
||||
async def _good_jobs_drained():
|
||||
while True:
|
||||
done = await jobs.list_jobs(status=JobStatus.SUCCEEDED, limit=50)
|
||||
if len(done) == 3:
|
||||
return done
|
||||
await asyncio.sleep(0.02)
|
||||
|
||||
await pool.start()
|
||||
try:
|
||||
await asyncio.sleep(0.2)
|
||||
succeeded = await jobs.list_jobs(status=JobStatus.SUCCEEDED, limit=50)
|
||||
succeeded = await asyncio.wait_for(_good_jobs_drained(), timeout=5.0)
|
||||
queued = await jobs.list_jobs(status=JobStatus.QUEUED, limit=50)
|
||||
finally:
|
||||
await pool.stop()
|
||||
|
||||
assert {j.uri for j in succeeded} == {"g0", "g1", "g2"}
|
||||
assert {j.uri for j in queued} == {"b0", "b1", "b2"}
|
||||
assert [j.attempts for j in queued] == [0, 0, 0]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Reference in a new issue