-
Notifications
You must be signed in to change notification settings - Fork 455
Use httpbin.org instead of example.com for /http tests #1161
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
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.
Looks good with an assertion swap.
If httpbin.org is not reliable, another alternative may be needed. Perhaps a local HTTP server in Python?
ASSERT_WITH_MSG (res.status == 200, | ||
"unexpected status code %d\n" | ||
"RESPONSE BODY BEGIN\n" | ||
"%s" | ||
"RESPONSE BODY END\n", | ||
res.status, | ||
res.body_len > 0 ? res.body : ""); | ||
ASSERT_OR_PRINT (r, error); |
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.
ASSERT_WITH_MSG (res.status == 200, | |
"unexpected status code %d\n" | |
"RESPONSE BODY BEGIN\n" | |
"%s" | |
"RESPONSE BODY END\n", | |
res.status, | |
res.body_len > 0 ? res.body : ""); | |
ASSERT_OR_PRINT (r, error); | |
ASSERT_OR_PRINT (r, error); | |
ASSERT_WITH_MSG (res.status == 200, | |
"unexpected status code %d\n" | |
"RESPONSE BODY BEGIN\n" | |
"%s" | |
"RESPONSE BODY END\n", | |
res.status, | |
res.body_len > 0 ? res.body : ""); |
Suggest checking for an error first. An error in socket connection may result in res.status
being 0
. The error
may have more useful information.
ASSERT_WITH_MSG (res.status == 200, | ||
"unexpected status code %d\n" | ||
"RESPONSE BODY BEGIN\n" | ||
"%s" | ||
"RESPONSE BODY END\n", | ||
res.status, | ||
res.body_len > 0 ? res.body : ""); | ||
ASSERT_OR_PRINT (r, error); |
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.
ASSERT_WITH_MSG (res.status == 200, | |
"unexpected status code %d\n" | |
"RESPONSE BODY BEGIN\n" | |
"%s" | |
"RESPONSE BODY END\n", | |
res.status, | |
res.body_len > 0 ? res.body : ""); | |
ASSERT_OR_PRINT (r, error); | |
ASSERT_OR_PRINT (r, error); | |
ASSERT_WITH_MSG (res.status == 200, | |
"unexpected status code %d\n" | |
"RESPONSE BODY BEGIN\n" | |
"%s" | |
"RESPONSE BODY END\n", | |
res.status, | |
res.body_len > 0 ? res.body : ""); |
Resolves CDRIVER-4538. Verified by this patch.
The
/http
test has been split into/http/get
and/http/post
and useshttpbin.org
instead ofexample.org
.As a drive-by fix, this PR also resolves CDRIVER-4537 by ensure calls to
abort()
in the test suite are preceeded by bothfflush (stdout)
andfflush (stderr)
to improve the quality of test output on failures.