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
Make TestPinger more robust. #6844
Make TestPinger more robust. #6844
Conversation
Instead of trying to prop up servers to ping, just mock out the requests library. Fixes pantsbuild#6830
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 is a great improvement! Much better than simply upping the timeout again.
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.
The failure on https://travis-ci.org/pantsbuild/pants/jobs/461886789 is weird, and I'm not sure what system is flaking out there or I would make an issue. This looks fantastic.
There is no need to understand a flake to file a bug. Filed #6847 |
Huh - this appears to fail perfectly under CI's python 2.7 and works perfectly under my local python 2.7. Digging... |
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 think that any solution relying on time.sleep
will suffer the same issues as the original implementation when the CI machines are under heavy load, but its certainly worth a try!
|
||
def callback(_): | ||
if latency < timeout: | ||
time.sleep(latency) |
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 believe this will result in the same errors as the original. The flake in these tests was always due to time.sleep
behaving unpredictably on CI machines under heavy load.
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 - that makes sense. This is only needed for 1 of the test methods - let me see what I can do to eliminate this outright.
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.
Fixed - PTAL
OK - the error is beacuse of an api difference in responses for declarative mocking vs mocking with callbacks: getsentry/responses#235 ... I am not sure how this passes on python3! That said - I can fix by using the current undocumented API. |
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 to me! Added suggestions for a typo
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.
These changes look great! Thanks Tansy for catching the underlying issue and John for reworking this.
Instead of trying to prop up servers to ping, just mock out the
requests library.
Fixes #6830