test(scheduler): add unit tests for the batch scheduler registry #3232
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 275 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3232"
general
weight: 0.35
vjanelle
Purpose of this PR
internal/schedulerhad no test files — 0% statement coverage. The registry is the indirection every batch scheduler goes through (volcano,yunikorn,kube-scheduler), but its error paths were only exercised incidentally via the concrete implementations in the subpackages.Adds
internal/scheduler/registry_test.go. Coverage goes from 0% to 100%. No production code changes.Part of #3202.
Proposed changes:
GetRegistry,Register,GetSchedulerandGetRegisteredSchedulerNames, including duplicate registration, unknown scheduler lookup, factory error propagation andConfigpass-through.Change Category
<!-- Test-only change; none of the categories below apply. -->
Rationale
Tests use isolated
Registryinstances rather than the package-level singleton, so they cannot interact through ordering. The one test that exercises the singleton restores it viat.Cleanup.Checklist
Additional Notes
---
Asks for reviewers @nabuskey @vjanelle @tariq-hasan
1. Data race, not fixed here.
GetRegisteredSchedulerNames(registry.go:69) iteratesr.factorieswithout takingr.mu, whileRegisterandGetSchedulerboth lock it. I did not add a test for it — it would fail under-raceand the fix belongs in its own PR. Should I open a separate issue?2. Scope check on #3202. This is one of the low-coverage packages listed there. Happy to keep going package by package in small PRs like this one, or to hold until the sub-issues are agreed — let me know which you'd prefer.