aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests/common')
-rw-r--r--src/garage/tests/common/client.rs11
-rw-r--r--src/garage/tests/common/mod.rs10
2 files changed, 14 insertions, 7 deletions
diff --git a/src/garage/tests/common/client.rs b/src/garage/tests/common/client.rs
index e9d4849a..ef4daa5d 100644
--- a/src/garage/tests/common/client.rs
+++ b/src/garage/tests/common/client.rs
@@ -1,15 +1,16 @@
-use aws_sdk_s3::{Client, Config, Credentials, Endpoint};
+use aws_sdk_s3::config::Credentials;
+use aws_sdk_s3::{Client, Config};
-use super::garage::{Instance, Key};
+use super::garage::Key;
+use crate::common::garage::DEFAULT_PORT;
-pub fn build_client(instance: &Instance, key: &Key) -> Client {
+pub fn build_client(key: &Key) -> Client {
let credentials = Credentials::new(&key.id, &key.secret, None, None, "garage-integ-test");
- let endpoint = Endpoint::immutable(instance.s3_uri());
let config = Config::builder()
+ .endpoint_url(format!("http://127.0.0.1:{}", DEFAULT_PORT))
.region(super::REGION)
.credentials_provider(credentials)
- .endpoint_resolver(endpoint)
.build();
Client::from_conf(config)
diff --git a/src/garage/tests/common/mod.rs b/src/garage/tests/common/mod.rs
index 0b8c6755..1273bad1 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::*;
+#[cfg(feature = "k2v")]
use k2v_client::K2vClient;
#[macro_use]
@@ -20,6 +22,7 @@ pub struct Context {
pub key: garage::Key,
pub client: Client,
pub custom_request: CustomRequester,
+ #[cfg(feature = "k2v")]
pub k2v: K2VContext,
}
@@ -32,8 +35,9 @@ 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);
+ #[cfg(feature = "k2v")]
let k2v_request = CustomRequester::new_k2v(garage, &key);
Context {
@@ -41,6 +45,7 @@ impl Context {
client,
key,
custom_request,
+ #[cfg(feature = "k2v")]
k2v: K2VContext {
request: k2v_request,
},
@@ -71,6 +76,7 @@ impl Context {
}
/// Build a K2vClient for a given bucket
+ #[cfg(feature = "k2v")]
pub fn k2v_client(&self, bucket: &str) -> K2vClient {
let config = k2v_client::K2vClientConfig {
region: REGION.to_string(),