-
Notifications
You must be signed in to change notification settings - Fork 442
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
[GSOC] Add validator for feasible space distribution #2404
[GSOC] Add validator for feasible space distribution #2404
Conversation
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.
As we discussed in today sync, we need to implement the unit testing.
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.
@shashank-iitbhu Could you add a valid distribution so that we can verify the valid case?
Parameters: []experimentsv1beta1.ParameterSpec{ |
Added a test case for valid distribution. |
parameters: func() []experimentsv1beta1.ParameterSpec { | ||
ps := newFakeInstance().Spec.Parameters | ||
ps[0].FeasibleSpace = experimentsv1beta1.FeasibleSpace{ | ||
Max: "5", | ||
Min: "1", | ||
Distribution: experimentsv1beta1.DistributionUniform, | ||
} | ||
return ps | ||
}(), |
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.
parameters: func() []experimentsv1beta1.ParameterSpec { | |
ps := newFakeInstance().Spec.Parameters | |
ps[0].FeasibleSpace = experimentsv1beta1.FeasibleSpace{ | |
Max: "5", | |
Min: "1", | |
Distribution: experimentsv1beta1.DistributionUniform, | |
} | |
return ps | |
}(), | |
parameters: newFakeInstance(), |
We already set the valid parameters in the newFakeInstance
function, right?
return ps | ||
}(), | ||
wantErr: nil, | ||
testDescription: "Valid distribution case", |
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.
testDescription: "Valid distribution case", | |
testDescription: "Valid parameters case", |
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.
done
@shashank-iitbhu Could you address lint errors? |
Signed-off-by: Shashank Mittal <[email protected]> validation logic fixed added unit test added unit test for valid distribution requested changes made Update pkg/webhook/v1beta1/experiment/validator/validator.go Co-authored-by: Yuki Iwai <[email protected]> fmt
d891256
to
328559f
Compare
"k8s.io/apimachinery/pkg/util/validation/field" | ||
|
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.
Could you consolidate this dependency group into the Line 29-35 group?
After you remove the line 28, you run make update
.
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.
done
Signed-off-by: Shashank Mittal <[email protected]>
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.
Thanks!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenzen-y The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2374
Checklist: