-
Notifications
You must be signed in to change notification settings - Fork 75
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
[ENG-332] [OATHPIT] Throw GitHub into the Oath Pit #389
Merged
felliott
merged 5 commits into
CenterForOpenScience:feature/oathpit
from
cslzchen:feature/oathpit-github
Dec 5, 2019
Merged
[ENG-332] [OATHPIT] Throw GitHub into the Oath Pit #389
felliott
merged 5 commits into
CenterForOpenScience:feature/oathpit
from
cslzchen:feature/oathpit-github
Dec 5, 2019
Conversation
This file contains 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
aiohttpretty requires the `str` type on both header name and value, which calls .encode() on both when building raw headers. Exceptions would be thrown if int header values were provided.
aiohttp3 is more strict on response content-type, where .json() would fail if the content-type were not provided or were incorrect. However, the updated aiohttpretty still has the unpleasant bug that .register_uri() ignores headers provided by .register_json_uri() when multiple URL registrations are used. The fix is to explicitly add the required header when calling .register_json_uri().
In aiohttp3, release() not only releases the response but also closes the connection. This causes exception_from_response() to encounter a connection already closed failure when trying to release or consume the response. The fix: 1) Don't release the response before calling _rl_handle_forbidden_error() and 2) let _rl_handle_forbidden_error() and exception_from_response() take care of it.
It doesn't make sense to use register_json_uri() for multi-URL registration since the extra help this method provides does not take any effects. Simply use `register_uri()` for this case.
cslzchen
force-pushed
the
feature/oathpit-github
branch
from
December 3, 2019 14:52
8515782
to
8f6104d
Compare
cslzchen
commented
Dec 4, 2019
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.
PR ready for CR 🔥 🦃 ❄️
LGTM, merged! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ticket
https://openscience.atlassian.net/browse/ENG-332
Purpose
Enable and update the GitHub provider for
aiohttp3
.Changes
Code
aiohttp3
,release()
not only releases the response but also closes the connection. This causesexception_from_response()
to encounter a connection already closed failure when trying to release or consume the response. The fix: 1) Don't release the response beforecalling _rl_handle_forbidden_error()
and 2) Let_rl_handle_forbidden_error()
andexception_from_response()
take care of it.Tests
Fixed mock response header value type in tests:
int
->str
.aiohttpretty
requires thestr
type on both header name and value, which calls.encode()
on both when building raw headers. Exceptions would be thrown if int header values were provided.Fixed missing Content-Type header when registering multiple URLs in tests.
aiohttp3
is more strict on response content type, where.json()
would fail if the content type were not provided or were incorrect. However, the updatedaiohttpretty
still has the unpleasant limitation that.register_uri()
ignores headers (and the body) provided by.register_json_uri()
when multiple URL registrations are used. The fix is to explicitly add the required header to theresponses
param when calling.register_json_uri()
.Side effects
No
CR / QA Notes
Here is a list of actions that I tested locally multiple times. Consider a PASS if no extra comment is provided.
Getting metadata for a file / folder
Downloading
DAZ
Uploading
waterbutler.core.exceptions.ProviderError: 422, {"documentation_url": "https://developer.github.com/v3", "message": "Update is not a fast forward"}
and sometimes withwaterbutler.core.exceptions.ProviderError: 422, {"documentation_url": "https://developer.github.com/v3", "message": "Reference cannot be updated"}
.Delete
waterbutler.core.exceptions.MetadataError: 404, {"documentation_url": "https://developer.github.com/v3/git/commits/#get-a-commit", "message": "Not Found"}
Folder creation / Upload to folder / Folder deletion
Rename files and folders
Verifying non-root folder access for id-based folders: N / A
Intra move/copy:
Inter move/copy (light testing only)
Comments persist with moves (light testing only)
If enabled, test revisions
Project root is storage root vs. a subfolder: N / A
Updating a file
Deployment Notes
TBD