-
Notifications
You must be signed in to change notification settings - Fork 344
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
Use pester for callback requests #483
Conversation
Signed-off-by: liz <[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.
one fix and then feel free to merge
if err != nil || resp.StatusCode != http.StatusOK { | ||
errlog.LogError(errors.Wrapf(err, "could not send error message to master URL (%v)", url)) | ||
if err == nil && resp.StatusCode != http.StatusOK { | ||
err = fmt.Errorf("unexpected status code %d", resp.StatusCode) |
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.
this should be errors.Wrap for consistency and bonus the fmt
import goes away
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.
if err is nil, errors.Wrap() returns nil. Passing nil to errlog.LogError() causes a segfault.
that was a fun bug to track down 😓
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.
wow what
oh well, in that case, i'd return at this point to avoid the import anyway, but if you want to merge that's fine too. up to you, thanks for the fix.
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.
or fix the nil handling in the error log, that would be ok too
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.
I'm fine with it...
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.
Minor question/comment, otherwise lgtm
responseCodes: []int{500, 200}, | ||
} | ||
|
||
server := httptest.NewTLSServer(testServer) |
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.
Can this be moved outside of the for loop?
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.
no, because the test-server's state needs to be reinitialised for every loop.
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.
oh, I guess I can just set the handler
if err != nil || resp.StatusCode != http.StatusOK { | ||
errlog.LogError(errors.Wrapf(err, "could not send error message to master URL (%v)", url)) | ||
if err == nil && resp.StatusCode != http.StatusOK { | ||
err = fmt.Errorf("unexpected status code %d", resp.StatusCode) |
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.
I'm fine with it...
Signed-off-by: liz [email protected]
What this PR does / why we need it:
PesterClient wasn't being used for success retries, only for failure
Which issue(s) this PR fixes
Special notes for your reviewer:
Release note: