diff options
Diffstat (limited to 'src/garage/tests/common/mod.rs')
-rw-r--r-- | src/garage/tests/common/mod.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/garage/tests/common/mod.rs b/src/garage/tests/common/mod.rs index eca3e42b..54efd1ea 100644 --- a/src/garage/tests/common/mod.rs +++ b/src/garage/tests/common/mod.rs @@ -1,5 +1,7 @@ -use aws_sdk_s3::{Client, Region}; +use aws_sdk_s3::config::Region; +use aws_sdk_s3::Client; use ext::*; +use k2v_client::K2vClient; #[macro_use] pub mod macros; @@ -31,7 +33,7 @@ impl Context { fn new() -> Self { let garage = garage::instance(); let key = garage.key(None); - let client = client::build_client(garage, &key); + let client = client::build_client(&key); let custom_request = CustomRequester::new_s3(garage, &key); let k2v_request = CustomRequester::new_k2v(garage, &key); @@ -68,6 +70,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 { |