Skip to content

Commit

Permalink
adds domain env variable
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmar Suhail <ahmarsu@amazon.co.uk>
  • Loading branch information
ahmarsuhail committed Jul 17, 2023
1 parent 091e106 commit 83cb6f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 4 additions & 0 deletions mountpoint-s3-client/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
15 changes: 4 additions & 11 deletions mountpoint-s3-client/tests/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand All @@ -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()
})
Expand All @@ -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()
})
Expand All @@ -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(),
}
}
1 change: 0 additions & 1 deletion mountpoint-s3/tests/fuse_tests/fork_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn run_in_background() -> Result<(), Box<dyn std::error::Error>> {
.arg(mount_point.path())
.arg(format!("--prefix={prefix}"))
.arg("--auto-unmount")
.arg(format!("--region={region}"))
.spawn()
.expect("unable to spawn child");

Expand Down

0 comments on commit 83cb6f6

Please sign in to comment.