aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/s3/objects.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests/s3/objects.rs')
-rw-r--r--src/garage/tests/s3/objects.rs48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/garage/tests/s3/objects.rs b/src/garage/tests/s3/objects.rs
index 27697d45..ad5f63f1 100644
--- a/src/garage/tests/s3/objects.rs
+++ b/src/garage/tests/s3/objects.rs
@@ -50,9 +50,9 @@ async fn test_putobject() {
// assert_eq!(o.version_id.unwrap(), _version);
assert_eq!(o.content_type.unwrap(), content_type);
assert!(o.last_modified.is_some());
- assert_eq!(o.content_length, 0);
- assert_eq!(o.parts_count, 0);
- assert_eq!(o.tag_count, 0);
+ assert_eq!(o.content_length.unwrap(), 0);
+ assert_eq!(o.parts_count, None);
+ assert_eq!(o.tag_count, None);
}
{
@@ -86,9 +86,9 @@ async fn test_putobject() {
assert_bytes_eq!(o.body, b"hi");
assert_eq!(o.e_tag.unwrap(), etag);
assert!(o.last_modified.is_some());
- assert_eq!(o.content_length, 2);
- assert_eq!(o.parts_count, 0);
- assert_eq!(o.tag_count, 0);
+ assert_eq!(o.content_length.unwrap(), 2);
+ assert_eq!(o.parts_count, None);
+ assert_eq!(o.tag_count, None);
}
{
@@ -119,9 +119,9 @@ async fn test_putobject() {
assert_bytes_eq!(o.body, b"");
assert_eq!(o.e_tag.unwrap(), etag);
assert!(o.last_modified.is_some());
- assert_eq!(o.content_length, 0);
- assert_eq!(o.parts_count, 0);
- assert_eq!(o.tag_count, 0);
+ assert_eq!(o.content_length.unwrap(), 0);
+ assert_eq!(o.parts_count, None);
+ assert_eq!(o.tag_count, None);
}
}
@@ -185,6 +185,30 @@ async fn test_getobject() {
assert_eq!(o.content_range.unwrap().as_str(), "bytes 57-61/62");
assert_bytes_eq!(o.body, &BODY[57..]);
}
+ {
+ let exp = aws_sdk_s3::primitives::DateTime::from_secs(10000000000);
+ let o = ctx
+ .client
+ .get_object()
+ .bucket(&bucket)
+ .key(STD_KEY)
+ .response_content_type("application/x-dummy-test")
+ .response_cache_control("ccdummy")
+ .response_content_disposition("cddummy")
+ .response_content_encoding("cedummy")
+ .response_content_language("cldummy")
+ .response_expires(exp)
+ .send()
+ .await
+ .unwrap();
+ assert_eq!(o.content_type.unwrap().as_str(), "application/x-dummy-test");
+ assert_eq!(o.cache_control.unwrap().as_str(), "ccdummy");
+ assert_eq!(o.content_disposition.unwrap().as_str(), "cddummy");
+ assert_eq!(o.content_encoding.unwrap().as_str(), "cedummy");
+ assert_eq!(o.content_language.unwrap().as_str(), "cldummy");
+ assert_eq!(o.expires.unwrap(), exp);
+ assert_bytes_eq!(o.body, &BODY[..]);
+ }
}
#[tokio::test]
@@ -205,7 +229,7 @@ async fn test_deleteobject() {
.await
.unwrap();
if i > 0 {
- to_del = to_del.objects(ObjectIdentifier::builder().key(k).build());
+ to_del = to_del.objects(ObjectIdentifier::builder().key(k).build().unwrap());
}
}
@@ -223,7 +247,7 @@ async fn test_deleteobject() {
.unwrap();
if i > 0 {
- to_del = to_del.objects(ObjectIdentifier::builder().key(k).build());
+ to_del = to_del.objects(ObjectIdentifier::builder().key(k).build().unwrap());
}
}
@@ -247,7 +271,7 @@ async fn test_deleteobject() {
.client
.delete_objects()
.bucket(&bucket)
- .delete(to_del.build())
+ .delete(to_del.build().unwrap())
.send()
.await
.unwrap();