From 83cb6f6e3b1e7b27e5fc053fd80dd31c968f3469 Mon Sep 17 00:00:00 2001 From: Ahmar Suhail Date: Mon, 17 Jul 2023 10:42:00 +0000 Subject: [PATCH] adds domain env variable Signed-off-by: Ahmar Suhail --- mountpoint-s3-client/tests/common/mod.rs | 4 ++++ mountpoint-s3-client/tests/endpoint.rs | 15 ++++----------- mountpoint-s3/tests/fuse_tests/fork_test.rs | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/mountpoint-s3-client/tests/common/mod.rs b/mountpoint-s3-client/tests/common/mod.rs index 94d165850..4b8936c02 100644 --- a/mountpoint-s3-client/tests/common/mod.rs +++ b/mountpoint-s3-client/tests/common/mod.rs @@ -48,6 +48,10 @@ pub fn get_secondary_test_region() -> String { std::env::var("S3_SECONDARY_REGION").unwrap_or(String::from("ap-southeast-2")) } +pub fn get_test_domain() -> String { + std::env::var("S3_DOMAIN").unwrap_or(String::from("com")) + } + pub async fn get_test_sdk_client() -> s3::Client { let config = aws_config::from_env() .region(Region::new(get_test_region())) diff --git a/mountpoint-s3-client/tests/endpoint.rs b/mountpoint-s3-client/tests/endpoint.rs index 081b8e3f6..7bf368dc6 100644 --- a/mountpoint-s3-client/tests/endpoint.rs +++ b/mountpoint-s3-client/tests/endpoint.rs @@ -50,7 +50,7 @@ async fn test_addressing_style_region(addressing_style: AddressingStyle) { #[tokio::test] async fn test_addressing_style_uri(addressing_style: AddressingStyle) { run_test(|region| { - let domain = get_test_domain(region); + let domain = get_test_domain(); let uri = format!("https://s3.{region}.amazonaws.{domain}"); Endpoint::from_uri(&uri, addressing_style).unwrap() }) @@ -63,7 +63,7 @@ async fn test_addressing_style_uri(addressing_style: AddressingStyle) { #[tokio::test] async fn test_addressing_style_uri_dualstack(addressing_style: AddressingStyle) { run_test(|region| { - let domain = get_test_domain(region); + let domain = get_test_domain(); let uri = format!("https://s3.dualstack.{region}.amazonaws.{domain}"); Endpoint::from_uri(&uri, addressing_style).unwrap() }) @@ -76,7 +76,7 @@ async fn test_addressing_style_uri_dualstack(addressing_style: AddressingStyle) #[tokio::test] async fn test_addressing_style_uri_fips(addressing_style: AddressingStyle) { run_test(|region| { - let domain = get_test_domain(region); + let domain = get_test_domain(); let uri = format!("https://s3-fips.{region}.amazonaws.{domain}"); Endpoint::from_uri(&uri, addressing_style).unwrap() }) @@ -88,16 +88,9 @@ async fn test_addressing_style_uri_fips(addressing_style: AddressingStyle) { #[tokio::test] async fn test_addressing_style_uri_fips_dualstack(addressing_style: AddressingStyle) { run_test(|region| { - let domain = get_test_domain(region); + let domain = get_test_domain(); let uri = format!("https://s3-fips.dualstack.{region}.amazonaws.{domain}"); Endpoint::from_uri(&uri, addressing_style).unwrap() }) .await; } - -fn get_test_domain(region: &str) -> String { - match region { - "cn-north-1" | "cn-northwest-1" => "com.cn".to_string(), - _ => "com".to_string(), - } -} diff --git a/mountpoint-s3/tests/fuse_tests/fork_test.rs b/mountpoint-s3/tests/fuse_tests/fork_test.rs index 8379aba45..d73a6d9f9 100644 --- a/mountpoint-s3/tests/fuse_tests/fork_test.rs +++ b/mountpoint-s3/tests/fuse_tests/fork_test.rs @@ -24,7 +24,6 @@ fn run_in_background() -> Result<(), Box> { .arg(mount_point.path()) .arg(format!("--prefix={prefix}")) .arg("--auto-unmount") - .arg(format!("--region={region}")) .spawn() .expect("unable to spawn child");