Skip to content

Conversation

@Denyme24
Copy link

What this PR does / why we need it:

It adds comprehensive unit tests for the config package, which previously had zero test coverage. The config package is critical as it handles loading configuration files, applying defaults, and setting up controller-runtime options for the trainer controller manager.

Test Coverage Includes

  • Configuration loading from YAML files with proper error handling
  • Default value application when a config file is not provided
  • Validation of configuration values (webhook ports, QPS/burst limits, concurrency settings)
  • Controller-runtime options setup (metrics, webhooks, health probes, leader election)
  • Edge cases and error scenarios

Additional Fix

While writing the tests, I discovered and fixed a missing default value for Webhook.Host in defaults.go, which could have led to nil pointer issues at runtime.

Coverage

  • 98.2% of config package statements

Fixes #3081

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: Denyme24 <namanraj24@outlook.com>
Copilot AI review requested due to automatic review settings January 15, 2026 08:18
@google-oss-prow
Copy link

[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 terrytangyuan 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 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

@github-actions
Copy link

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.
  • Our team will review your PR soon! cc @kubeflow/kubeflow-trainer-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive unit tests for the config package, which previously had zero test coverage. The config package is critical for loading configuration files, applying defaults, and setting up controller-runtime options.

Changes:

  • Added 653 lines of unit tests covering configuration loading, validation, defaults application, and controller-runtime options setup
  • Fixed a potential nil pointer dereference by adding a default value for Webhook.Host in defaults.go
  • Achieved 98.2% test coverage for the config package

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/config/config_test.go New comprehensive test suite covering all config package functions including file loading, validation, defaults, and integration tests
pkg/apis/config/v1alpha1/defaults.go Added default value for Webhook.Host to prevent nil pointer dereference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andreyvelich
Copy link
Member

Thanks for this @Denyme24, we already have open PR to add unit tests for Trainer config: #2893
@kapil27 Are you still working on #2893 to address the review changes?

@kapil27
Copy link
Contributor

kapil27 commented Jan 15, 2026

Yes @andreyvelich , I will address those comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] : Add unit tests for configuration loading and controller options

3 participants