aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/common
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-05-22 09:03:08 +0000
committerAlex <alex@adnab.me>2023-05-22 09:03:08 +0000
commit9d833bb7efc2c166036db38da89b0b5ac8f466fe (patch)
tree827c751387fcd4424c4e9af467b23cf5514619e7 /src/garage/tests/common
parent03efc191c1697140d24c431e88bd4964c77823e5 (diff)
parentc3d3b837ebeb98e8639659183ae801b3a280de99 (diff)
downloadgarage-9d833bb7efc2c166036db38da89b0b5ac8f466fe.tar.gz
garage-9d833bb7efc2c166036db38da89b0b5ac8f466fe.zip
Merge pull request 'K2V-client improvements' (#577) from k2v-client-aws-sigv4 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/577
Diffstat (limited to 'src/garage/tests/common')
-rw-r--r--src/garage/tests/common/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/garage/tests/common/mod.rs b/src/garage/tests/common/mod.rs
index eca3e42b..0b8c6755 100644
--- a/src/garage/tests/common/mod.rs
+++ b/src/garage/tests/common/mod.rs
@@ -1,5 +1,6 @@
use aws_sdk_s3::{Client, Region};
use ext::*;
+use k2v_client::K2vClient;
#[macro_use]
pub mod macros;
@@ -68,6 +69,19 @@ impl Context {
bucket_name
}
+
+ /// Build a K2vClient for a given bucket
+ pub fn k2v_client(&self, bucket: &str) -> K2vClient {
+ let config = k2v_client::K2vClientConfig {
+ region: REGION.to_string(),
+ endpoint: self.garage.k2v_uri().to_string(),
+ aws_access_key_id: self.key.id.clone(),
+ aws_secret_access_key: self.key.secret.clone(),
+ bucket: bucket.to_string(),
+ user_agent: None,
+ };
+ K2vClient::new(config).expect("Could not create K2V client")
+ }
}
pub fn context() -> Context {