Skip to content

Conversation

@kapil27
Copy link
Contributor

@kapil27 kapil27 commented Oct 16, 2025

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
Fixes #2885

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: kapil27 <knema@redhat.com>
@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 electronic-waste 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

@coveralls
Copy link

coveralls commented Oct 16, 2025

Pull Request Test Coverage Report for Build 18553777112

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+4.1%) to 56.237%

Totals Coverage Status
Change from base Build 18529281041: 4.1%
Covered Lines: 1348
Relevant Lines: 2397

💛 - Coveralls

Signed-off-by: kapil27 <knema@redhat.com>
Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Sorry for the late review @kapil27!
I left a few comments.
/assign @kubeflow/kubeflow-trainer-team

configapi "github.com/kubeflow/trainer/v2/pkg/apis/config/v1alpha1"
)

// TestValidate provides comprehensive validation testing following Kueue patterns
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// TestValidate provides comprehensive validation testing following Kueue patterns

}

// TestValidate_PortBoundaries tests webhook port edge cases
func TestValidate_PortBoundaries(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this test?

}

// TestValidate_ClientConnectionEdgeCases tests QPS and Burst edge cases
func TestValidate_ClientConnectionEdgeCases(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Please be consistent with Kueue: https://github.com/kubernetes-sigs/kueue/blob/main/pkg/config/validation_test.go#L939

Use this name: TestValidateClientConnection, and use this test structure:

testCases := map[string]struct {
		cfg     *configapi.Configuration
		wantErr field.ErrorList
	}{

return scheme
}

func TestLoad_Defaults(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Please use CamelCase naming everywhere.

Suggested change
func TestLoad_Defaults(t *testing.T) {
func TestLoadDefaults(t *testing.T) {

}
}

func TestValidate_ComprehensiveValidation(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have this validation tests in the config_test.go ?


func setupScheme() *runtime.Scheme {
scheme := runtime.NewScheme()
_ = clientgoscheme.AddToScheme(scheme)
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need clientGoScheme? Please also Fatal the error like here: https://github.com/kubernetes-sigs/kueue/blob/main/pkg/config/config_test.go#L95-L99

}
}

func TestLoad_FromFile(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Please refactor these tests by following the Kueue approach: https://github.com/kubernetes-sigs/kueue/blob/main/pkg/config/config_test.go#L94

JobSet has similar tests for TestLoad(): https://github.com/kubernetes-sigs/jobset/blob/main/pkg/config/config_test.go

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.

Add unit tests for Trainer Config API

3 participants