Skip to content
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

S3 200 errors implementation #3276

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

alexgromero
Copy link
Contributor

The S3 service may occasionally respond with an HTTP 200 OK status code while including errors in the response body. This PR addresses this handling to ensure accurate error reporting.

@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.14%. Comparing base (0e229ae) to head (d21ce1b).
Report is 115 commits behind head on develop.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3276      +/-   ##
===========================================
- Coverage    93.17%   93.14%   -0.04%     
===========================================
  Files           66       66              
  Lines        14339    14358      +19     
===========================================
+ Hits         13361    13374      +13     
- Misses         978      984       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

botocore/handlers.py Outdated Show resolved Hide resolved
tests/functional/test_credentials.py Outdated Show resolved Hide resolved
tests/functional/test_s3.py Show resolved Hide resolved
tests/functional/test_s3.py Outdated Show resolved Hide resolved
tests/unit/test_handlers.py Outdated Show resolved Hide resolved
botocore/endpoint.py Outdated Show resolved Hide resolved
botocore/model.py Outdated Show resolved Hide resolved
Copy link
Contributor

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some high level comments of what may make this a bit simpler. We should be able to drop the empty body requirement after our discussion.

botocore/handlers.py Outdated Show resolved Hide resolved
botocore/model.py Outdated Show resolved Hide resolved
botocore/endpoint.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
botocore/model.py Outdated Show resolved Hide resolved
tests/functional/test_s3.py Show resolved Hide resolved
tests/functional/test_s3.py Outdated Show resolved Hide resolved
Copy link
Contributor

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Have a few minor notes on comments and unit tests. We want to try to be succinct with comments/logging as long messages are often ignored.

botocore/handlers.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
botocore/handlers.py Outdated Show resolved Hide resolved
def test_500_status_code_set_for_200_response(
operation_model_for_200_error, response_dict_for_200_error
):
handlers._handle_200_error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we aren't invoking private functions outside of their respective modules. Do we have specific cases we're testing in these unit tests that aren't already verified with the functional tests?

Comment on lines +1993 to +1996
def test_500_response_can_be_none():
# A 500 response can raise an exception, which means the response
# object is None. We need to handle this case.
handlers._retry_200_error(None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, we should always be asserting something in our tests to ensure accidental no-op regressions don't sneak in. If we wanted to validate that None is a valid, we should be testing what the behavior of the function is when that's passed. In this case, we know it will return None if it's working as expected.

Read the above comment about testing private functions though before making any changes.

alexgromero and others added 4 commits October 17, 2024 13:31
Co-authored-by: Nate Prewitt <[email protected]>
Co-authored-by: Nate Prewitt <[email protected]>
Co-authored-by: Nate Prewitt <[email protected]>
Co-authored-by: Nate Prewitt <[email protected]>
Co-authored-by: Nate Prewitt <[email protected]>
botocore/handlers.py Outdated Show resolved Hide resolved
Co-authored-by: Nate Prewitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants