aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests')
-rw-r--r--src/garage/tests/streaming_signature.rs84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/garage/tests/streaming_signature.rs b/src/garage/tests/streaming_signature.rs
index 66f985ac..c68f7dfc 100644
--- a/src/garage/tests/streaming_signature.rs
+++ b/src/garage/tests/streaming_signature.rs
@@ -99,3 +99,87 @@ async fn test_putobject_streaming() {
assert_eq!(o.tag_count, 0);
}
}
+
+#[tokio::test]
+async fn test_create_bucket_streaming() {
+ let ctx = common::context();
+ let bucket = "createbucket-streaming";
+
+ {
+ // create bucket
+ let _ = ctx
+ .custom_request
+ .builder(bucket.to_owned())
+ .method(Method::PUT)
+ .body_signature(BodySignature::Streaming(10))
+ .send()
+ .await
+ .unwrap();
+
+ // test if the bucket exists and works properly
+ let etag = "\"d41d8cd98f00b204e9800998ecf8427e\"";
+ let content_type = "text/csv";
+ let _ = ctx
+ .client
+ .put_object()
+ .bucket(bucket)
+ .key(STD_KEY)
+ .content_type(content_type)
+ .send()
+ .await
+ .unwrap();
+
+ let o = ctx
+ .client
+ .get_object()
+ .bucket(bucket)
+ .key(STD_KEY)
+ .send()
+ .await
+ .unwrap();
+
+ assert_eq!(o.e_tag.unwrap(), etag);
+ }
+}
+
+#[tokio::test]
+async fn test_put_website_streaming() {
+ let ctx = common::context();
+ let bucket = ctx.create_bucket("putwebsite-streaming");
+
+ {
+ let website_config = r#"<?xml version="1.0" encoding="UTF-8"?>
+<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
+ <ErrorDocument>
+ <Key>err/error.html</Key>
+ </ErrorDocument>
+ <IndexDocument>
+ <Suffix>home.html</Suffix>
+ </IndexDocument>
+</WebsiteConfiguration>"#;
+
+ let mut query = HashMap::new();
+ query.insert("website".to_owned(), None);
+ let _ = ctx
+ .custom_request
+ .builder(bucket.clone())
+ .method(Method::PUT)
+ .query_params(query)
+ .body(website_config.as_bytes().to_vec())
+ .body_signature(BodySignature::Streaming(10))
+ .send()
+ .await
+ .unwrap();
+
+ let o = ctx
+ .client
+ .get_bucket_website()
+ .bucket(&bucket)
+ .send()
+ .await
+ .unwrap();
+
+ assert_eq!(o.index_document.unwrap().suffix.unwrap(), "home.html");
+ assert_eq!(o.error_document.unwrap().key.unwrap(), "err/error.html");
+ }
+}