CTTY commented on code in PR #3288: URL: https://github.com/apache/iceberg-rust/pull/3288#discussion_r4450806367
########## crates/storage/common/tests/common/mod.rs: ########## @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Shared test harness and helpers for storage integration suites. + +#![allow(dead_code)] + +pub mod backends; + +use iceberg_test_utils::set_up; +#[allow(unused_imports)] Review Comment: Same for this, should we just remove unused imports? ########## crates/storage/common/tests/common/mod.rs: ########## @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Shared test harness and helpers for storage integration suites. + +#![allow(dead_code)] Review Comment: do we still need this? Maybe we can just clean up anything that's dead. Or we can mark specific functions that are dead for now and will be used later ########## crates/test_utils/src/storage/harness.rs: ########## @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Storage harness and path utilities for shared integration testing. + +use std::sync::Arc; + +use iceberg::io::FileIO; +use tempfile::TempDir; + +use crate::normalize_test_name; + +/// Test harness holding an initialized `FileIO` instance and a base test directory/prefix. +pub struct StorageHarness { + pub file_io: FileIO, + pub base_path: String, + pub label: &'static str, + pub _tempdir: Option<Arc<TempDir>>, +} + +impl StorageHarness { + /// Create a new storage harness for a given `FileIO` instance. + pub fn new(file_io: FileIO, base_path: impl Into<String>, label: &'static str) -> Self { + Self { + file_io, + base_path: base_path.into(), + label, + _tempdir: None, + } + } + + /// Attach a temporary directory to be held for the lifetime of this harness. + pub fn with_tempdir(mut self, tempdir: TempDir) -> Self { + self._tempdir = Some(Arc::new(tempdir)); + self + } + + /// Generate a unique, normalized path under this harness's `base_path`. + pub fn unique_path(&self, test_name: &str) -> String { Review Comment: Should we have a per-harness random prefix added for `unique_path`? Currently it's not really unique: 2 runs may interfere with each other's data. Or is that expected? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
