aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests')
-rw-r--r--src/garage/tests/common/client.rs2
-rw-r--r--src/garage/tests/s3/multipart.rs30
-rw-r--r--src/garage/tests/s3/objects.rs24
-rw-r--r--src/garage/tests/s3/streaming_signature.rs16
-rw-r--r--src/garage/tests/s3/website.rs29
5 files changed, 56 insertions, 45 deletions
diff --git a/src/garage/tests/common/client.rs b/src/garage/tests/common/client.rs
index ef4daa5d..ffa4cae8 100644
--- a/src/garage/tests/common/client.rs
+++ b/src/garage/tests/common/client.rs
@@ -1,3 +1,4 @@
+use aws_sdk_s3::config::BehaviorVersion;
use aws_sdk_s3::config::Credentials;
use aws_sdk_s3::{Client, Config};
@@ -11,6 +12,7 @@ pub fn build_client(key: &Key) -> Client {
.endpoint_url(format!("http://127.0.0.1:{}", DEFAULT_PORT))
.region(super::REGION)
.credentials_provider(credentials)
+ .behavior_version(BehaviorVersion::v2023_11_09())
.build();
Client::from_conf(config)
diff --git a/src/garage/tests/s3/multipart.rs b/src/garage/tests/s3/multipart.rs
index 09ae5e5b..51c9df74 100644
--- a/src/garage/tests/s3/multipart.rs
+++ b/src/garage/tests/s3/multipart.rs
@@ -154,7 +154,7 @@ async fn test_multipart_upload() {
.await
.unwrap();
- assert_eq!(r.content_length, (SZ_5MB * 3) as i64);
+ assert_eq!(r.content_length.unwrap(), (SZ_5MB * 3) as i64);
}
{
@@ -183,7 +183,7 @@ async fn test_multipart_upload() {
.unwrap();
eprintln!("get_object with part_number = {}", part_number);
- assert_eq!(o.content_length, SZ_5MB as i64);
+ assert_eq!(o.content_length.unwrap(), SZ_5MB as i64);
assert_bytes_eq!(o.body, data);
}
}
@@ -249,14 +249,14 @@ async fn test_uploadlistpart() {
let ps = r.parts.unwrap();
assert_eq!(ps.len(), 1);
- assert_eq!(ps[0].part_number, 2);
+ assert_eq!(ps[0].part_number.unwrap(), 2);
let fp = &ps[0];
assert!(fp.last_modified.is_some());
assert_eq!(
fp.e_tag.as_ref().unwrap(),
"\"3366bb9dcf710d6801b5926467d02e19\""
);
- assert_eq!(fp.size, SZ_5MB as i64);
+ assert_eq!(fp.size.unwrap(), SZ_5MB as i64);
}
let p2 = ctx
@@ -286,23 +286,23 @@ async fn test_uploadlistpart() {
let ps = r.parts.unwrap();
assert_eq!(ps.len(), 2);
- assert_eq!(ps[0].part_number, 1);
+ assert_eq!(ps[0].part_number.unwrap(), 1);
let fp = &ps[0];
assert!(fp.last_modified.is_some());
assert_eq!(
fp.e_tag.as_ref().unwrap(),
"\"3c484266f9315485694556e6c693bfa2\""
);
- assert_eq!(fp.size, SZ_5MB as i64);
+ assert_eq!(fp.size.unwrap(), SZ_5MB as i64);
- assert_eq!(ps[1].part_number, 2);
+ assert_eq!(ps[1].part_number.unwrap(), 2);
let sp = &ps[1];
assert!(sp.last_modified.is_some());
assert_eq!(
sp.e_tag.as_ref().unwrap(),
"\"3366bb9dcf710d6801b5926467d02e19\""
);
- assert_eq!(sp.size, SZ_5MB as i64);
+ assert_eq!(sp.size.unwrap(), SZ_5MB as i64);
}
{
@@ -320,14 +320,14 @@ async fn test_uploadlistpart() {
assert!(r.part_number_marker.is_none());
assert_eq!(r.next_part_number_marker.as_deref(), Some("1"));
- assert_eq!(r.max_parts, 1_i32);
- assert!(r.is_truncated);
+ assert_eq!(r.max_parts.unwrap(), 1_i32);
+ assert!(r.is_truncated.unwrap());
assert_eq!(r.key.unwrap(), "a");
assert_eq!(r.upload_id.unwrap().as_str(), uid.as_str());
let parts = r.parts.unwrap();
assert_eq!(parts.len(), 1);
let fp = &parts[0];
- assert_eq!(fp.part_number, 1);
+ assert_eq!(fp.part_number.unwrap(), 1);
assert_eq!(
fp.e_tag.as_ref().unwrap(),
"\"3c484266f9315485694556e6c693bfa2\""
@@ -349,19 +349,19 @@ async fn test_uploadlistpart() {
r2.part_number_marker.as_ref().unwrap(),
r.next_part_number_marker.as_ref().unwrap()
);
- assert_eq!(r2.max_parts, 1_i32);
+ assert_eq!(r2.max_parts.unwrap(), 1_i32);
assert_eq!(r2.key.unwrap(), "a");
assert_eq!(r2.upload_id.unwrap().as_str(), uid.as_str());
let parts = r2.parts.unwrap();
assert_eq!(parts.len(), 1);
let fp = &parts[0];
- assert_eq!(fp.part_number, 2);
+ assert_eq!(fp.part_number.unwrap(), 2);
assert_eq!(
fp.e_tag.as_ref().unwrap(),
"\"3366bb9dcf710d6801b5926467d02e19\""
);
//assert!(r2.is_truncated); // WHY? (this was the test before)
- assert!(!r2.is_truncated);
+ assert!(!r2.is_truncated.unwrap());
}
let cmp = CompletedMultipartUpload::builder()
@@ -411,7 +411,7 @@ async fn test_uploadlistpart() {
.await
.unwrap();
- assert_eq!(r.content_length, (SZ_5MB * 2) as i64);
+ assert_eq!(r.content_length.unwrap(), (SZ_5MB * 2) as i64);
}
}
diff --git a/src/garage/tests/s3/objects.rs b/src/garage/tests/s3/objects.rs
index 27697d45..ca35b435 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);
}
}
@@ -205,7 +205,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 +223,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 +247,7 @@ async fn test_deleteobject() {
.client
.delete_objects()
.bucket(&bucket)
- .delete(to_del.build())
+ .delete(to_del.build().unwrap())
.send()
.await
.unwrap();
diff --git a/src/garage/tests/s3/streaming_signature.rs b/src/garage/tests/s3/streaming_signature.rs
index b7a1acae..224b9ed5 100644
--- a/src/garage/tests/s3/streaming_signature.rs
+++ b/src/garage/tests/s3/streaming_signature.rs
@@ -57,9 +57,9 @@ async fn test_putobject_streaming() {
// 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);
}
{
@@ -95,9 +95,9 @@ async fn test_putobject_streaming() {
assert_bytes_eq!(o.body, BODY);
assert_eq!(o.e_tag.unwrap(), etag);
assert!(o.last_modified.is_some());
- assert_eq!(o.content_length, 62);
- assert_eq!(o.parts_count, 0);
- assert_eq!(o.tag_count, 0);
+ assert_eq!(o.content_length.unwrap(), 62);
+ assert_eq!(o.parts_count, None);
+ assert_eq!(o.tag_count, None);
}
}
@@ -187,7 +187,7 @@ async fn test_put_website_streaming() {
.await
.unwrap();
- assert_eq!(o.index_document.unwrap().suffix.unwrap(), "home.html");
- assert_eq!(o.error_document.unwrap().key.unwrap(), "err/error.html");
+ assert_eq!(o.index_document.unwrap().suffix, "home.html");
+ assert_eq!(o.error_document.unwrap().key, "err/error.html");
}
}
diff --git a/src/garage/tests/s3/website.rs b/src/garage/tests/s3/website.rs
index eeafb5fa..59c990f8 100644
--- a/src/garage/tests/s3/website.rs
+++ b/src/garage/tests/s3/website.rs
@@ -181,8 +181,18 @@ async fn test_website_s3_api() {
.unwrap();
let conf = WebsiteConfiguration::builder()
- .index_document(IndexDocument::builder().suffix("home.html").build())
- .error_document(ErrorDocument::builder().key("err/error.html").build())
+ .index_document(
+ IndexDocument::builder()
+ .suffix("home.html")
+ .build()
+ .unwrap(),
+ )
+ .error_document(
+ ErrorDocument::builder()
+ .key("err/error.html")
+ .build()
+ .unwrap(),
+ )
.build();
ctx.client
@@ -201,9 +211,11 @@ async fn test_website_s3_api() {
.allowed_methods("GET")
.allowed_methods("PUT")
.allowed_origins("*")
- .build(),
+ .build()
+ .unwrap(),
)
- .build();
+ .build()
+ .unwrap();
ctx.client
.put_bucket_cors()
@@ -222,19 +234,16 @@ async fn test_website_s3_api() {
.await
.unwrap();
- let main_rule = cors_res.cors_rules().unwrap().iter().next().unwrap();
+ let main_rule = cors_res.cors_rules().iter().next().unwrap();
assert_eq!(main_rule.id.as_ref().unwrap(), "main-rule");
assert_eq!(
main_rule.allowed_headers.as_ref().unwrap(),
&vec!["*".to_string()]
);
+ assert_eq!(&main_rule.allowed_origins, &vec!["*".to_string()]);
assert_eq!(
- main_rule.allowed_origins.as_ref().unwrap(),
- &vec!["*".to_string()]
- );
- assert_eq!(
- main_rule.allowed_methods.as_ref().unwrap(),
+ &main_rule.allowed_methods,
&vec!["GET".to_string(), "PUT".to_string()]
);
}