hengfeiyang commented on code in PR #734:
URL:
https://github.com/apache/arrow-rs-object-store/pull/734#discussion_r3318775202
##########
src/aws/client.rs:
##########
@@ -1153,6 +1169,55 @@ mod tests {
mock.shutdown().await;
}
+ #[tokio::test]
+ async fn test_single_object_delete_request() {
+ let mock = MockServer::new().await;
+ mock.push_fn(|req| {
+ // A single-object delete must use `DELETE /key`, not the bulk
+ // `POST /?delete` (DeleteObjects) API.
+ assert_eq!(req.method(), Method::DELETE);
+ assert_eq!(req.uri().path(), "/test-bucket/test");
+ assert!(req.uri().query().is_none());
+ Response::builder().status(204).body(String::new()).unwrap()
+ });
+
+ let config = default_headers_config(&mock);
+ let client = S3Client::new(config,
HttpClient::new(reqwest::Client::new()));
+ let result = client.delete_request(&Path::from("test")).await;
+
+ assert!(result.is_ok());
+ mock.shutdown().await;
+ }
+
+ #[tokio::test]
+ async fn test_disable_bulk_delete_uses_single_object_delete() {
Review Comment:
Done in 655a486 — added `test_default_bulk_delete_uses_post_delete`, which
asserts the default `delete_stream` path issues `POST /?delete` (bulk
DeleteObjects), as a counterpart to
`test_disable_bulk_delete_uses_single_object_delete`.
While doing this I noticed that assertions placed inside `MockServer`'s
response closure are silently swallowed (the closure panic resets the
connection but the S3 retry path can still produce an Ok result), so the old
assertion pattern was not actually catching mismatches. The new tests capture
the request method/path/query into shared state and assert in the main test
body, so violations genuinely fail the test.
`test_single_object_delete_request` was switched to the same pattern.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]