Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions crates/s3/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,31 @@ mod tests {
}
}

#[tokio::test]
async fn delete_bucket_maps_not_found_code_to_not_found() {
let response = http::Response::builder()
.status(404)
.header("x-amz-error-code", "NotFound")
.body(SdkBody::from(
r#"<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>NotFound</Code>
<Message>The specified bucket does not exist.</Message>
</Error>"#,
))
.expect("build not found bucket response");
let (client, _request_receiver) = test_s3_client(Some(response));

let result = client.delete_bucket("missing-bucket").await;

match result {
Err(Error::NotFound(message)) => {
assert_eq!(message, "Bucket not found: missing-bucket")
}
other => panic!("Expected NotFound for NotFound delete bucket error, got: {other:?}"),
}
}

#[tokio::test]
async fn delete_bucket_maps_other_failures_to_network() {
let response = http::Response::builder()
Expand Down