-
Notifications
You must be signed in to change notification settings - Fork 178
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
Catch Timeout on test urls #4248
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4248 +/- ##
==========================================
+ Coverage 77.01% 77.10% +0.09%
==========================================
Files 761 761
Lines 41471 41471
Branches 8763 8763
==========================================
+ Hits 31937 31976 +39
+ Misses 8481 8438 -43
- Partials 1053 1057 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I extracted this fix from #4237 and originally from #4211. #4211 only changes exception handling in the outer Moreover, this would unblock #4246 in case of #4211 being merged first of the two. See my comment in #4246 for more details. |
a27b9d9
to
66b4645
Compare
This patch only updates the inner _test_urls and _legacy_test_urls methods, not the outer test_connection method. It doesn’t even change any printing or logging logic. Therefore, unlike #4211 and #4246, there are no tests of test_connection or integration tests. The error log and standard out tests are the only way how to find out whether the except block fired as intended. That’s why there are log/stdout tests in place. They, however, don’t test the contents of the messages as that’s not the subject of this pull request. That will change after merging with the tests from other related PRs. |
Open for review. @m-horky |
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 don't have objections, I'll just need to see in context of the other PRs.
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.
Are all these tests for the patch of connection.py
in this PR?
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.
Not entirely. As I mentioned in my comment, there are only tests for the _test_urls and _legacy_test_urls. There are no tests for test_connection.
Some notes for tests that may seem over the scope:
- The log and print tests are there to check that the except block executed. They only assert the calls, not the contents.
- The get/post methods are the ones that raise the caught exceptions. Hence the call asserts for those.
The other pull requests contain more tests or make some of the existing ones more precise. The latter applies for the log/stdout messages. I will resolve the merge conflict, by which the new patch in the following PR will be nice and clear. The test names are the same, so this will be easy.
66b4645
to
197e861
Compare
The internal methods used by the --test-connection command only used to catch ConnectionError, including ConnectionTimeout, but not other timeouts such as ReadTimeoutError. As a result, in case of a read timeout, the failure is not fully handled. That means: * an error message containing the failed URL is not logged; * and in case of legacy upload, the URL fallback mechanism is interrupted. Re-used the existing REQUEST_FAILED_EXCEPTIONS list to process all timeouts in the same way. Card IDs: * CCT-859 Signed-off-by: Štěpán Tomsa <[email protected]>
197e861
to
bafcb3d
Compare
There is also #4254 in the family. It neither blocks anything nor is blocked by anything. It only shares some tests. |
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.
ACK
Hi, @xiangce, good to merge! |
All Pull Requests:
Check all that apply:
Complete Description of Additions/Changes:
The internal methods used by the
--test-connection
command only used to catchConnectionError
, includingConnectionTimeout
, but not other timeouts such asReadTimeoutError
. As a result, in case of a read timeout, the failure is not fully handled. That means:Re-used the existing
REQUEST_FAILED_EXCEPTIONS
list to process all timeouts in the same way.Card IDs: