Skip to content

Commit

Permalink
use full domain
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 bdd631d commit 41a99ba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mountpoint-s3-client/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn get_secondary_test_region() -> String {
}

pub fn get_test_domain() -> String {
std::env::var("S3_DOMAIN").unwrap_or(String::from("com"))
std::env::var("S3_DOMAIN").unwrap_or(String::from("amazonaws.com"))
}

pub async fn get_test_sdk_client() -> s3::Client {
Expand Down
8 changes: 4 additions & 4 deletions mountpoint-s3-client/tests/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn test_addressing_style_region(addressing_style: AddressingStyle) {
async fn test_addressing_style_uri(addressing_style: AddressingStyle) {
run_test(|region| {
let domain = get_test_domain();
let uri = format!("https://s3.{region}.amazonaws.{domain}");
let uri = format!("https://s3.{region}.{domain}");
Endpoint::from_uri(&uri, addressing_style).unwrap()
})
.await;
Expand All @@ -64,7 +64,7 @@ async fn test_addressing_style_uri(addressing_style: AddressingStyle) {
async fn test_addressing_style_uri_dualstack(addressing_style: AddressingStyle) {
run_test(|region| {
let domain = get_test_domain();
let uri = format!("https://s3.dualstack.{region}.amazonaws.{domain}");
let uri = format!("https://s3.dualstack.{region}.{domain}");
Endpoint::from_uri(&uri, addressing_style).unwrap()
})
.await;
Expand All @@ -77,7 +77,7 @@ async fn test_addressing_style_uri_dualstack(addressing_style: AddressingStyle)
async fn test_addressing_style_uri_fips(addressing_style: AddressingStyle) {
run_test(|region| {
let domain = get_test_domain();
let uri = format!("https://s3-fips.{region}.amazonaws.{domain}");
let uri = format!("https://s3-fips.{region}.{domain}");
Endpoint::from_uri(&uri, addressing_style).unwrap()
})
.await;
Expand All @@ -89,7 +89,7 @@ async fn test_addressing_style_uri_fips(addressing_style: AddressingStyle) {
async fn test_addressing_style_uri_fips_dualstack(addressing_style: AddressingStyle) {
run_test(|region| {
let domain = get_test_domain();
let uri = format!("https://s3-fips.dualstack.{region}.amazonaws.{domain}");
let uri = format!("https://s3-fips.dualstack.{region}.{domain}");
Endpoint::from_uri(&uri, addressing_style).unwrap()
})
.await;
Expand Down
37 changes: 37 additions & 0 deletions mountpoint-s3/tests/fuse_tests/fork_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,43 @@ fn run_in_background() -> Result<(), Box<dyn std::error::Error>> {
let region = get_test_region();
let mount_point = assert_fs::TempDir::new()?;

let mut cmd = Command::cargo_bin("mount-s3")?;
let mut child = cmd
.arg(&bucket)
.arg(mount_point.path())
.arg(format!("--prefix={prefix}"))
.arg("--auto-unmount")
.arg(format!("--region={region}"))
.spawn()
.expect("unable to spawn child");

let st = std::time::Instant::now();

let exit_status = loop {
if st.elapsed() > MAX_WAIT_DURATION {
panic!("wait for result timeout")
}
match child.try_wait().expect("unable to wait for result") {
Some(result) => break result,
None => std::thread::sleep(std::time::Duration::from_millis(100)),
}
};

// verify mount status and mount entry
assert!(exit_status.success());
assert!(mount_exists("mountpoint-s3", mount_point.path().to_str().unwrap()));

test_read_files(&bucket, &prefix, &region, &mount_point.to_path_buf());

Ok(())
}

#[test]
fn run_in_background_automatic_region_resolution() -> Result<(), Box<dyn std::error::Error>> {
let (bucket, prefix) = get_test_bucket_and_prefix("test_run_in_background");
let region = get_test_region();
let mount_point = assert_fs::TempDir::new()?;

let mut cmd = Command::cargo_bin("mount-s3")?;
let mut child = cmd
.arg(&bucket)
Expand Down

0 comments on commit 41a99ba

Please sign in to comment.