aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/bucket.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-04 11:34:43 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-04 11:34:43 +0100
commit570e5e5bbb7a3eac41350db9433e28ed289b97f4 (patch)
treea7fc299ba180098be5a3bef28a39256870ce697b /src/garage/tests/bucket.rs
parent6e44369cbc810b8912ca0f7f5fd293e87f10c851 (diff)
parent4eb8ca3a528dae2848141f5cc3eb607eb7d40114 (diff)
downloadgarage-570e5e5bbb7a3eac41350db9433e28ed289b97f4.tar.gz
garage-570e5e5bbb7a3eac41350db9433e28ed289b97f4.zip
Merge branch 'main' into next
Diffstat (limited to 'src/garage/tests/bucket.rs')
-rw-r--r--src/garage/tests/bucket.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/garage/tests/bucket.rs b/src/garage/tests/bucket.rs
index b32af068..9c363013 100644
--- a/src/garage/tests/bucket.rs
+++ b/src/garage/tests/bucket.rs
@@ -1,4 +1,5 @@
use crate::common;
+use crate::common::ext::CommandExt;
use aws_sdk_s3::model::BucketLocationConstraint;
use aws_sdk_s3::output::DeleteBucketOutput;
@@ -8,6 +9,27 @@ async fn test_bucket_all() {
let bucket_name = "hello";
{
+ // Check bucket cannot be created if not authorized
+ ctx.garage
+ .command()
+ .args(["key", "deny"])
+ .args(["--create-bucket", &ctx.garage.key.id])
+ .quiet()
+ .expect_success_output("Could not deny key to create buckets");
+
+ // Try create bucket, should fail
+ let r = ctx.client.create_bucket().bucket(bucket_name).send().await;
+ assert!(r.is_err());
+ }
+ {
+ // Now allow key to create bucket
+ ctx.garage
+ .command()
+ .args(["key", "allow"])
+ .args(["--create-bucket", &ctx.garage.key.id])
+ .quiet()
+ .expect_success_output("Could not deny key to create buckets");
+
// Create bucket
//@TODO check with an invalid bucket name + with an already existing bucket
let r = ctx