Fix: drain scheduler mocks during fixture teardown - #1611
Conversation
60ea68a to
11bbeb2
Compare
📝 WalkthroughWalkthroughThe test mock worker now supports persistent drain mode. Scheduler fixtures activate this mode before shutdown. A group-scheduler test verifies that teardown completes active and queued dispatches. ChangesScheduler teardown draining
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
11bbeb2 to
7a52171
Compare
|
Addressed the two review Considers (review of #1611 — the inline thread and CI were already clean):
Both are comment-only; behavior unchanged. Rebased onto current main; full scheduler suite green locally (39 tests × 30 iterations). |
Failed assertions can leave mock workers running while Scheduler::stop() waits for every worker to become idle. Put the mocks into a teardown-only auto-complete mode so both current and subsequently dispatched work drains before the scheduler joins.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/ut/cpp/hierarchical/test_scheduler.cpp`:
- Around line 931-933: Update the test teardown around the existing
worker_a/worker_b/worker_c drain calls to also drain the registered SUB workers,
including sub_worker_a and sub_worker_b, before invoking sched.stop(). Preserve
the current drain ordering for the next-level workers while ensuring all SUB
dispatch has completed before scheduler shutdown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ccca593-5c67-41df-b5fd-a18f3f478c1b
📒 Files selected for processing (1)
tests/ut/cpp/hierarchical/test_scheduler.cpp
Summary
MockMailboxWorkerWhy
An assertion can skip the manual
complete()calls in a scheduler test. The existing fixture then callsScheduler::stop(), which waits forever for mock workers that can no longer be completed. A persistent drain mode handles an arbitrary amount of queued teardown work without a fixed retry count.Review context
#1565 (comment)
Testing
test_scheduler: 27/27 passed