aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/common/mod.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-05-19 12:52:14 +0200
committerAlex Auvolat <alex@adnab.me>2023-05-22 10:45:06 +0200
commite2ce5970c6c1ee26e5aabf6b5dba8d641416fb53 (patch)
treef2aa150a5c11924c442e871b3cd5aa8c42c92886 /src/garage/tests/common/mod.rs
parent644e8722641c826603f7ee3c2c7b58f31ab88c23 (diff)
downloadgarage-e2ce5970c6c1ee26e5aabf6b5dba8d641416fb53.tar.gz
garage-e2ce5970c6c1ee26e5aabf6b5dba8d641416fb53.zip
Add basic k2v_client integration tests
Diffstat (limited to 'src/garage/tests/common/mod.rs')
-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 {