Skip to content

Apache DataFusion SQL Query Engine

fix: unit test for object_storage (#16824)

Chen Chongchen8a3ea8739c36
diff --git a/datafusion-cli/src/object_storage.rs b/datafusion-cli/src/object_storage.rs
index e7311030d5..de33e11fe0 100644
--- a/datafusion-cli/src/object_storage.rs
+++ b/datafusion-cli/src/object_storage.rs
@@ -580,6 +580,9 @@ mod tests {
#[tokio::test]
async fn s3_object_store_builder_default() -> Result<()> {
let location = "s3://bucket/path/FAKE/file.parquet";
+ // Set it to a non-existent file to avoid reading the default configuration file
+ std::env::set_var("AWS_CONFIG_FILE", "data/aws.config");
+ std::env::set_var("AWS_SHARED_CREDENTIALS_FILE", "data/aws.credentials");
// No options
let table_url = ListingTableUrl::parse(location)?;
@@ -732,6 +735,8 @@ mod tests {
async fn s3_object_store_builder_resolves_region_when_none_provided() -> Result<()> {
let expected_region = "eu-central-1";
let location = "s3://test-bucket/path/file.parquet";
+ // Set it to a non-existent file to avoid reading the default configuration file
+ std::env::set_var("AWS_CONFIG_FILE", "data/aws.config");
let table_url = ListingTableUrl::parse(location)?;
let aws_options = AwsOptions {