-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix: check err before use schedule and duration #20043
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20043 +/- ##
=========================================
Coverage ? 55.97%
=========================================
Files ? 322
Lines ? 44759
Branches ? 0
=========================================
Hits ? 25052
Misses ? 17103
Partials ? 2604 ☔ View full report in Codecov by Sentry. |
Hi @daengdaengLee it looks good so far! Can we just verify that this is actually fixed by adding a test case or two to
|
2a656f8
to
ef3619c
Compare
Hello, @blakepettersson. I have added unit tests for the incorrect schedule and duration. Thank you! |
I noticed in the original issue that there are two other places where this is an issue (search for |
ef3619c
to
ad65cb8
Compare
Hello, @blakepettersson. Thanks for the comment. I've handled other things too! Thanks! |
78d7443
to
3cb6731
Compare
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.
Looks great, thanks!
3cb6731
to
d717910
Compare
d717910
to
406527f
Compare
Hello, @blakepettersson. I rebase the PR to the latest master branch. How can I get a review for the PR? Thanks! |
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.
Instead of logging errors in types.go (which is kind of a place for utility functions), could you modify both functions to return an error? That way the consumer can handle the error appropriately, either by logging or by returning the error message to the caller (as in the API Server's Sync
method).
406527f
to
e79bbe3
Compare
Hello, @crenshaw-dev!
Please check and comment if you think differently. |
f9eaa73
to
0c612a9
Compare
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, thank you!
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
0c612a9
to
bf49c83
Compare
/cherry-pick release-2.13 |
* fix: check err before use schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * test: add tests for invalid schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * feat: change to return error when sync window is invalid Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use assert.Error or assert.NoError Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use require instead of assert Signed-off-by: daengdaengLee <gunho1020@gmail.com> --------- Signed-off-by: daengdaengLee <gunho1020@gmail.com>
/cherry-pick release-2.12 |
Cherry-pick failed with |
@daengdaengLee if you'd like to cherry-pick back to 2.10-2.12, looks that those will require manual PRs. |
* fix: check err before use schedule and duration * test: add tests for invalid schedule and duration * feat: change to return error when sync window is invalid * fix: use assert.Error or assert.NoError * fix: use require instead of assert --------- Signed-off-by: daengdaengLee <gunho1020@gmail.com> Co-authored-by: Kunho Lee <gunho1020@gmail.com>
* fix: check err before use schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * test: add tests for invalid schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * feat: change to return error when sync window is invalid Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use assert.Error or assert.NoError Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use require instead of assert Signed-off-by: daengdaengLee <gunho1020@gmail.com> --------- Signed-off-by: daengdaengLee <gunho1020@gmail.com>
* fix: check err before use schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * test: add tests for invalid schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * feat: change to return error when sync window is invalid Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use assert.Error or assert.NoError Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use require instead of assert Signed-off-by: daengdaengLee <gunho1020@gmail.com> --------- Signed-off-by: daengdaengLee <gunho1020@gmail.com> Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
* fix: check err before use schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * test: add tests for invalid schedule and duration Signed-off-by: daengdaengLee <gunho1020@gmail.com> * feat: change to return error when sync window is invalid Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use assert.Error or assert.NoError Signed-off-by: daengdaengLee <gunho1020@gmail.com> * fix: use require instead of assert Signed-off-by: daengdaengLee <gunho1020@gmail.com> --------- Signed-off-by: daengdaengLee <gunho1020@gmail.com> Signed-off-by: Adrian Aneci <aneci@adobe.com>
Fix #19605
I have made some modifications to the related code, though it doesn't fully resolve the issue.I have made some modifications to resolve the issue.
Previously,
schedule
andduration
were used before checkingsErr
anddErr
, which could result in a nil pointer exception if an error occurred. (use values in line 2433, check error in line 2435)I have updated the code to check for errors first and use
continue
if an error is found.If I've misunderstood something, please let me know in the comments. Thank you! :)
Checklist: