test: add unit tests for the scheduler Registry #3164
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chenyi015 for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
<details open>
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":["chenyi015"]} -->
🎉 Welcome to the Kubeflow Spark Operator! 🎉
Thanks for opening your first PR! We're happy to have you as part of our community 🚀
Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏
Please rewrite the tests using Ginkgo/Gomega as that would be the default going forward.
Rewrote the tests using Ginkgo/Gomega.
/ok-to-test
Hi @magic-peach thanks for the contribution, Please add a case where the factory returns an error. GetScheduler should return that error to the caller. Right now every fake factory always succeeds, so that path is untested and Optionally you can also pass a non-nil config into GetScheduler and check the factory actually receives it. Today every call uses nil.
tariq-hasan
magic-peach
Purpose of this PR
internal/scheduler's Registry backs the actual scheduler wiring in cmd/operator/controller/start.go (Register is called there for each of the volcano, yunikorn, and kubescheduler factories) and had no test coverage, including the duplicate-registration error path.
Proposed changes:
Change Category
Rationale
Test-only change, no behavior modified.
Checklist
Additional Notes
No existing issue tracks this; found while reading the scheduler registry.