From bc8c9184d02e3afe11cf1ea8e2d2ea6c87dd52c8 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 20 Dec 2022 11:28:45 -0800 Subject: [PATCH] fix rust test --- rust/src/storage/utils.rs | 3 +++ rust/src/test_utils.rs | 12 ++++++------ rust/src/writer/json.rs | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/rust/src/storage/utils.rs b/rust/src/storage/utils.rs index b352149608..c80a114087 100644 --- a/rust/src/storage/utils.rs +++ b/rust/src/storage/utils.rs @@ -15,12 +15,15 @@ pub async fn copy_table( from_options: Option>, to: impl AsRef, to_options: Option>, + allow_http: bool, ) -> Result<(), DeltaTableError> { let from_store = DeltaTableBuilder::from_uri(from) .with_storage_options(from_options.unwrap_or_default()) + .with_allow_http(allow_http) .build_storage()?; let to_store = DeltaTableBuilder::from_uri(to) .with_storage_options(to_options.unwrap_or_default()) + .with_allow_http(allow_http) .build_storage()?; sync_stores(from_store, to_store).await } diff --git a/rust/src/test_utils.rs b/rust/src/test_utils.rs index 24daae0e84..c2624baf0c 100644 --- a/rust/src/test_utils.rs +++ b/rust/src/test_utils.rs @@ -46,7 +46,7 @@ impl IntegrationContext { account_path.as_path().to_str().unwrap(), ); } - integration.crate_bucket(&bucket)?; + integration.create_bucket(&bucket)?; let store_uri = match integration { StorageIntegration::Amazon => format!("s3://{}", &bucket), StorageIntegration::Microsoft => format!("az://{}", &bucket), @@ -109,12 +109,12 @@ impl IntegrationContext { options.content_only = true; let dest_path = self.tmp_dir.path().join(name.as_ref()); std::fs::create_dir_all(&dest_path)?; - copy(&table.as_path(), &dest_path, &options)?; + copy(table.as_path(), &dest_path, &options)?; } _ => { let from = table.as_path().as_str().to_owned(); let to = format!("{}/{}", self.root_uri(), name.as_ref()); - copy_table(from, None, to, None).await?; + copy_table(from, None, to, None, true).await?; } }; Ok(()) @@ -125,7 +125,7 @@ impl Drop for IntegrationContext { fn drop(&mut self) { match self.integration { StorageIntegration::Amazon => { - s3_cli::delete_bucket(&self.root_uri()).unwrap(); + s3_cli::delete_bucket(self.root_uri()).unwrap(); s3_cli::delete_lock_table().unwrap(); } StorageIntegration::Microsoft => { @@ -157,14 +157,14 @@ impl StorageIntegration { } } - fn crate_bucket(&self, name: impl AsRef) -> std::io::Result<()> { + fn create_bucket(&self, name: impl AsRef) -> std::io::Result<()> { match self { Self::Microsoft => { az_cli::create_container(name)?; Ok(()) } Self::Amazon => { - s3_cli::create_bucket(&format!("s3://{}", name.as_ref()))?; + s3_cli::create_bucket(format!("s3://{}", name.as_ref()))?; set_env_if_not_set( "DYNAMO_LOCK_PARTITION_KEY_VALUE", format!("s3://{}", name.as_ref()), diff --git a/rust/src/writer/json.rs b/rust/src/writer/json.rs index 7fa86d8515..c9fee9db77 100644 --- a/rust/src/writer/json.rs +++ b/rust/src/writer/json.rs @@ -183,7 +183,7 @@ impl JsonWriter { partition_columns: Option>, storage_options: Option>, ) -> Result { - let storage = DeltaTableBuilder::from_uri(&table_uri) + let storage = DeltaTableBuilder::from_uri(table_uri) .with_storage_options(storage_options.unwrap_or_default()) .build_storage()?;