-
Notifications
You must be signed in to change notification settings - Fork 340
fix(auth): Make auth client respect app options httpTimeout #536
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we add the following assertion?
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 problem I see with that is it would force any test not using the default to pass that argument. I aligned with the other
want
args, if it's specified, check it, otherwise don't. That said, it's your code base so I defer to you. Lmk if you want me to change 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.
It doesn't. It can default to
None
, in which case we assert against_http_client.DEFAULT_TIMEOUT
.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.
That's what I'm saying, if someone added a test using
user_mgt_app_with_timeout
, but didn't pass a timeout to this function (presumably because they didn't care about asserting the value), it would fail.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.
In the implementation we already default the client to
_http_client.DEFAULT_TIMEOUT
. In what scenario do we expect that assertion to not hold?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 an app is used with a non-default timeout, but someone is either unaware of the
want_timeout
parameter or explicitly does not wish to make an assertion around it. Just biasing towards explicit > implicit per BDFL. Implementing the suggested behavior would implicitly check timeout. It also adds assertions to existing tests, whereas the original implementation results in no change to existing tests/assertions.For a concrete example, if I removed the
TEST_TIMEOUT
fromtest_get_user_with_timeout
, the test would fail, but, IMO, it would not be readily obvious just inspecting the test function why (nowhere did I make an assertion or ask an assertion to be made around timeout, so why is that happening?).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.
That was my intended goal. Ideally, the
_check_request()
helper function should make assertions about the traits that are common to all requests made by the auth client. We probably should have had the timeout assertion there to begin with. Thewant_body
shouldn't be an optional argument. It's always specified.Anyway, all these changes can probably be lumped into a separate PR. For now I'm happy with where this stands.