-
Notifications
You must be signed in to change notification settings - Fork 24
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
NETOBSERV-1201: Make empty CR work out of the box #398
Conversation
@jotak: This pull request references NETOBSERV-1201 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -68,3 +70,10 @@ func MaxLabelLength(in string) string { | |||
} | |||
return in[:maxLabelLength] | |||
} | |||
|
|||
func UnstructuredDuration(in *metav1.Duration) string { |
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.
pls add ut coverage for this api, I have one for u :)
func TestUnstructuredDuration(t *testing.T) {
t.Run("nil input", func(t *testing.T) {
var d *metav1.Duration
got := UnstructuredDuration(d)
want := ""
if got != want {
t.Errorf("got %q, want %q", got, want)
}
})
t.Run("valid input", func(t *testing.T) {
d := &metav1.Duration{Duration: time.Minute}
want := "1m0s"
got := UnstructuredDuration(d)
if got != want {
t.Errorf("got %q, want %q", got, want)
}
})
}
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! done
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.
/LGTM
just suggested adding UT coverage and u need to fix rebase issues
Fixing a couple of default values that weren't working as expected: - metav1.Duration fields need to be pointers so their default is actually used - deploymentModel shouldn't be required as it default to DIRECT - Agent type default wasn't working due to missing omitempty - Add a test to make sure empty spec works
Codecov Report
@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 53.67% 53.69% +0.02%
==========================================
Files 44 44
Lines 5559 5596 +37
==========================================
+ Hits 2984 3005 +21
- Misses 2359 2375 +16
Partials 216 216
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/lgtm |
Merging for dequeuing - I don't think specific tests are needed here, apart from usual regression tests |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jotak 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 |
/ok-to-test |
Fixing a couple of default values that weren't working as expected: