Skip to content

Commit ce06405

Browse files
authored
test(storage): ReadObject builder clone (#3807)
I did not want to `derive(PartialEq)` for `RequestOptions`, or the builder. That might back us into a corner.
1 parent 1980f0d commit ce06405

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/storage/src/storage/read_object.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,23 @@ mod tests {
616616
reader.http_request_builder().await
617617
}
618618

619+
#[tokio::test]
620+
async fn test_clone() {
621+
let inner = test_inner_client(test_builder());
622+
let stub = crate::storage::transport::Storage::new(inner.clone());
623+
let options = {
624+
let mut o = RequestOptions::new();
625+
o.set_resumable_upload_threshold(12345_usize);
626+
o
627+
};
628+
let builder = ReadObject::new(stub, "projects/_/buckets/bucket", "object", options);
629+
630+
let clone = builder.clone();
631+
assert!(Arc::ptr_eq(&clone.stub, &builder.stub));
632+
assert_eq!(clone.request, builder.request);
633+
assert_eq!(clone.options.resumable_upload_threshold(), 12345_usize);
634+
}
635+
619636
// Verify `read_object()` meets normal Send, Sync, requirements.
620637
#[tokio::test]
621638
async fn test_read_is_send_and_static() -> Result {

0 commit comments

Comments
 (0)