test(s3): cover missing bucket cors configuration#105
Draft
Conversation
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
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.
Summary
Add focused
rc-s3coverage for bucket CORS operations when the backend reports that no CORS configuration exists. This keeps the scope on a recent CORS code path without changing runtime behavior.Problem
Recent bucket CORS support added logic to treat missing bucket CORS state as an empty configuration on reads and as a successful no-op on deletes. That behavior was implemented, but there was no direct unit coverage proving the S3 client maps the
NoSuchCORSConfiguration404 path correctly.Root Cause
The existing tests only covered the helper predicates that classify missing CORS responses. They did not exercise the public
get_bucket_corsanddelete_bucket_corsmethods with an actual mocked SDK response, so a regression in the method-level handling could slip through.Fix
Add two
rc-s3unit tests that feed mocked 404NoSuchCORSConfigurationresponses into the client. One verifiesget_bucket_corsreturns an empty rule list, and the other verifiesdelete_bucket_corssucceeds.Validation
cargo test -p rc-s3 get_bucket_cors_missing_configuration_returns_empty_rulescargo test -p rc-s3 delete_bucket_cors_missing_configuration_is_successfulcargo fmt --all --checkcargo clippy --workspace -- -D warningscargo test --workspace