test(s3): cover delete bucket NotFound fallback#168
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a focused regression test for crates/s3/src/client.rs::delete_bucket to ensure S3-compatible backends that return the NotFound error code (instead of NoSuchBucket) are still classified as Error::NotFound, preserving the intended CLI behavior and guarding the recent error-mapping changes.
Changes:
- Added a new
#[tokio::test]coveringDeleteBucketresponses withx-amz-error-code: NotFound. - Asserts the error is mapped to
Error::NotFound("Bucket not found: <bucket>"), matching the existing missing-bucket behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Related issue
This PR does not resolve a user-facing bug by itself. It closes a remaining test gap around the recent
delete_bucketerror-classification changes landed in #163 and #166.Background
crates/s3/src/client.rs::delete_bucketnow has explicit classification for missing buckets, non-empty buckets, and generic backend failures. The existing tests already coveredNoSuchBucket,BucketNotEmpty, and a genericInternalErrorpath.A nearby backend variant was still untested: some S3-compatible services return
NotFoundinstead ofNoSuchBucketfor the same missing-bucket condition. The implementation already handles that code path, but the regression suite did not prove it.Root cause
The recent focused test additions around
delete_bucketstopped one branch short of the siblingNotFoundmapping path, leaving the same user-visible behavior dependent on unverified backend wording.Solution
Add one focused unit test that simulates a
404 NotFounddelete-bucket response and asserts that rc still maps it toError::NotFound("Bucket not found: <bucket>").This keeps the scope limited to the changed helper and strengthens the recent error-mapping work without changing runtime behavior.
Validation
cargo test -p rc-s3 delete_bucket_maps_ --libmake pre-commit