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
This PR adds focused unit coverage for the S3 CORS XML fallback URL builder introduced with recent bucket CORS support.
The recent CORS implementation added a dedicated
cors_urlhelper so the client can fall back to path-style XML requests when the AWS SDK path does not work against RustFS-compatible responses. That helper is part of the new behavior, but it did not have direct tests onmain. Without coverage here, a future change to URL construction or endpoint handling could silently break the fallback path even while the existing parser tests still pass.This change keeps scope tight to that untested path. It extracts a small test-only helper so the unit tests can build an
S3Clientwith a custom endpoint, then adds assertions for the two critical branches incors_url: the normal path-style URL shape (https://example.com/bucket-name?cors=) and the invalid-endpoint error branch for endpoints that cannot support path-style bucket operations.Validation
I first ran the two targeted unit tests for the new coverage:
cargo test -p rc-s3 cors_url_uses_path_style_bucket_and_querycargo test -p rc-s3 cors_url_rejects_endpoints_without_path_segmentsThe automation requested
make pre-commit, but this repository currently has nopre-commitmake target or local pre-commit configuration. To match the repository's documented CI gates, I ran the equivalent checks directly:cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace