Repository navigation
test(migrate): wait up to 30 s for the import job in test_routes - #516
Conversation
The test polled the background import 200 times with 20 ms sleeps, about 4 seconds. On a busy Windows runner the import was still running when the budget ran out. Poll against a 30-second deadline instead and drop the flaky marker. Closes #422
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Poll for import completion tests/migrate/test_memory_import.py |
The test polls while the job is running and the 30-second deadline has not passed. It also removes the flaky-test marker. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other · Severity of issue fixed: Low
Suggested labels: area: memory, no changelog
Merge Risk: 
Minimal · up to 6555f
-
The test change safely extends polling for slow imports and preserves failure reporting on timeout.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title clearly and concisely describes the main change: updating test_routes to wait up to 30 seconds for the import job. Linked Issues check Issue #422asks for the wait in tests/migrate/test_memory_import.py::test_routes to use a deadline (for example 30 s) or the job's completion event, and says the result itself was correct. The diff re…Out of Scope Changes check The whole-PR diff against the merge base 91053cc touches one file, tests/migrate/test_memory_import.py, with +2/-5 lines. Every hunk serves #422: the deadline-based polling loop, the explanatory comme…Full details: Linked Issues check
-
Explanation
Issue
#422asks for the wait in tests/migrate/test_memory_import.py::test_routes to use a deadline (for example 30 s) or the job's completion event, and says the result itself was correct. The diff replaces the fixedfor _ in range(200)loop with atime.monotonic()deadline of 30 seconds. The loop polls GET /api/import/memory/job every 20 ms while status isrunningand the deadline has not passed. The final assertion (now["id"] == job["id"] and now["status"] == "done" and now["facts"] == 3) is unchanged, so the result check still applies. The@pytest.mark.flaky(reruns=2)marker that#422describes as a temporary workaround is removed.import timeis already present at the head. The walrus assignment in thewhilecondition setsnowon the first evaluation, so the assertion after the loop always has a value. I did not run the test. The PR reports three local passes and Ruff clean, which I did not verify.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff against the merge base 91053cc touches one file, tests/migrate/test_memory_import.py, with +2/-5 lines. Every hunk serves
#422: the deadline-based polling loop, the explanatory comment that cites#422, and removal of the flaky marker that#422says was a temporary workaround. No production code, fixtures, or other tests changed. The PR description states no changelog entry, which fits a test-only change.
-
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the clock with care,
The import job still runs somewhere.
It waits until the task is through,
Or thirty seconds have passed on cue.
No flaky tag remains to spare.
Comment @coderabbitai help to get the list of available commands.
Closes #422.
tests/migrate/test_memory_import.py::test_routespolled the background ChatGPT import 200 times with 20 ms sleeps, a budget of about 4 seconds. On a busy Windows runner running tests in parallel the import was stillrunningwhen the budget ran out. The result itself was always right.Change
@pytest.mark.flaky(reruns=2)marker, so a real failure isn't hidden behind reruns.Checked
Test-only change, so no changelog entry.
Summary by CodeRabbit