Skip to content

Commit

Permalink
fix rust test
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 committed Dec 20, 2022
1 parent 9d13b4f commit bc8c918
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions rust/src/storage/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ pub async fn copy_table(
from_options: Option<HashMap<String, String>>,
to: impl AsRef<str>,
to_options: Option<HashMap<String, String>>,
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
}
Expand Down
12 changes: 6 additions & 6 deletions rust/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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(())
Expand All @@ -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 => {
Expand Down Expand Up @@ -157,14 +157,14 @@ impl StorageIntegration {
}
}

fn crate_bucket(&self, name: impl AsRef<str>) -> std::io::Result<()> {
fn create_bucket(&self, name: impl AsRef<str>) -> 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()),
Expand Down
2 changes: 1 addition & 1 deletion rust/src/writer/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl JsonWriter {
partition_columns: Option<Vec<String>>,
storage_options: Option<HashMap<String, String>>,
) -> Result<Self, DeltaTableError> {
let storage = DeltaTableBuilder::from_uri(&table_uri)
let storage = DeltaTableBuilder::from_uri(table_uri)
.with_storage_options(storage_options.unwrap_or_default())
.build_storage()?;

Expand Down

0 comments on commit bc8c918

Please sign in to comment.