Skip to content
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

Merged
merged 1 commit into from
Jul 12, 2018
Merged

Conversation

liztio
Copy link
Contributor

@liztio liztio commented Jul 12, 2018

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:

Copy link
Contributor

@chuckha chuckha left a 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)
Copy link
Contributor

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

Copy link
Contributor Author

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 😓

Copy link
Contributor

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.

Copy link
Contributor

@chuckha chuckha Jul 12, 2018

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

Copy link
Contributor

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...

Copy link
Contributor

@timothysc timothysc left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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...

@timothysc timothysc merged commit 786ff49 into vmware-tanzu:master Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

systemd-logs pods in CrashLoopBackoff because they can't connect to sonobuoy-master
3 participants