aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrinity-1686a <trinity@deuxfleurs.fr>2022-03-21 21:07:56 +0100
committerGitea <gitea@fake.local>2022-03-23 10:22:37 +0100
commit8db6b845591d20d7b9fa9334fad6fb3b556c4432 (patch)
tree6b1b961e974717663b7638bb1a89925a6d516fee
parent1eb7fdb08fed59a9e78adc24df2d96fda746c560 (diff)
downloadgarage-8db6b845591d20d7b9fa9334fad6fb3b556c4432.tar.gz
garage-8db6b845591d20d7b9fa9334fad6fb3b556c4432.zip
add test for create bucket and put website with streaming signature
-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");
+ }
+}