Skip to content

Commit

Permalink
Emulator test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Apr 16, 2024
1 parent 1bd76d3 commit f764a7f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
7 changes: 4 additions & 3 deletions object_store/src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ mod tests {
let test_not_exists = config.copy_if_not_exists.is_some();
let test_conditional_put = config.conditional_put.is_some();

put_get_delete_list_opts(&integration).await;
put_get_delete_list(&integration).await;
get_opts(&integration).await;
list_uses_directories_correctly(&integration).await;
list_with_delimiter(&integration).await;
Expand All @@ -413,6 +413,7 @@ mod tests {
multipart(&integration, &integration).await;
signing(&integration).await;
s3_encryption(&integration).await;
put_get_attributes(&integration).await;

// Object tagging is not supported by S3 Express One Zone
if config.session_provider.is_none() {
Expand All @@ -433,12 +434,12 @@ mod tests {
// run integration test with unsigned payload enabled
let builder = AmazonS3Builder::from_env().with_unsigned_payload(true);
let integration = builder.build().unwrap();
put_get_delete_list_opts(&integration).await;
put_get_delete_list(&integration).await;

// run integration test with checksum set to sha256
let builder = AmazonS3Builder::from_env().with_checksum_algorithm(Checksum::SHA256);
let integration = builder.build().unwrap();
put_get_delete_list_opts(&integration).await;
put_get_delete_list(&integration).await;

match &integration.client.config.copy_if_not_exists {
Some(S3CopyIfNotExists::Dynamo(d)) => dynamo::integration_test(&integration, d).await,
Expand Down
9 changes: 7 additions & 2 deletions object_store/src/azure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ mod tests {
crate::test_util::maybe_skip_integration!();
let integration = MicrosoftAzureBuilder::from_env().build().unwrap();

put_get_delete_list_opts(&integration).await;
put_get_delete_list(&integration).await;
get_opts(&integration).await;
list_uses_directories_correctly(&integration).await;
list_with_delimiter(&integration).await;
Expand All @@ -292,7 +292,12 @@ mod tests {
let client = Arc::clone(&integration.client);
async move { client.get_blob_tagging(&p).await }
})
.await
.await;

// Azurite doesn't support attributes properly
if !integration.client.config().is_emulator {
put_get_attributes(&integration).await;
}
}

#[ignore = "Used for manual testing against a real storage account."]
Expand Down
2 changes: 2 additions & 0 deletions object_store/src/gcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ mod test {
// Fake GCS server doesn't currently honor preconditions
get_opts(&integration).await;
put_opts(&integration, true).await;
// Fake GCS server doesn't currently support attributes
put_get_attributes(&integration).await;
}
}

Expand Down
2 changes: 1 addition & 1 deletion object_store/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ mod tests {
.build()
.unwrap();

put_get_delete_list_opts(&integration).await;
put_get_delete_list(&integration).await;
list_uses_directories_correctly(&integration).await;
list_with_delimiter(&integration).await;
rename_and_copy(&integration).await;
Expand Down
10 changes: 4 additions & 6 deletions object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,6 @@ mod tests {
use rand::{thread_rng, Rng};

pub(crate) async fn put_get_delete_list(storage: &DynObjectStore) {
put_get_delete_list_opts(storage).await
}

pub(crate) async fn put_get_delete_list_opts(storage: &DynObjectStore) {
delete_fixtures(storage).await;

let content_list = flatten_list_stream(storage, None).await.unwrap();
Expand Down Expand Up @@ -1682,7 +1678,9 @@ mod tests {
assert_eq!(data.len(), 0);

storage.delete(&path).await.unwrap();
}

pub(crate) async fn put_get_attributes(integration: &dyn ObjectStore) {
// Test handling of attributes
let attributes = Attributes::from_iter([
(Attribute::ContentType, "text/html; charset=utf-8"),
Expand All @@ -1694,9 +1692,9 @@ mod tests {
attributes: attributes.clone(),
..Default::default()
};
match storage.put_opts(&path, "foo".into(), opts).await {
match integration.put_opts(&path, "foo".into(), opts).await {
Ok(_) => {
let r = storage.get(&path).await.unwrap();
let r = integration.get(&path).await.unwrap();
assert_eq!(r.attributes, attributes);
}
Err(Error::NotImplemented) => {}
Expand Down
1 change: 1 addition & 0 deletions object_store/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ mod tests {
stream_get(&integration).await;
put_opts(&integration, true).await;
multipart(&integration, &integration).await;
put_get_attributes(&integration).await;
}

#[tokio::test]
Expand Down

0 comments on commit f764a7f

Please sign in to comment.