-
Notifications
You must be signed in to change notification settings - Fork 883
chore: Add comprehensive unit tests for Config API #2893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: kapil27 <knema@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Pull Request Test Coverage Report for Build 18553777112Details
💛 - Coveralls |
Signed-off-by: kapil27 <knema@redhat.com>
andreyvelich
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // TestValidate provides comprehensive validation testing following Kueue patterns |
| } | ||
|
|
||
| // TestValidate_PortBoundaries tests webhook port edge cases | ||
| func TestValidate_PortBoundaries(t *testing.T) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
| func TestLoad_Defaults(t *testing.T) { | |
| func TestLoadDefaults(t *testing.T) { |
| } | ||
| } | ||
|
|
||
| func TestValidate_ComprehensiveValidation(t *testing.T) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
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: