kriti-sc commented on code in PR #2889:
URL: https://github.com/apache/iggy/pull/2889#discussion_r2970187590


##########
core/integration/tests/connectors/fixtures/delta/fixture.rs:
##########
@@ -0,0 +1,316 @@
+/*
+ * 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.
+ */
+
+use async_trait::async_trait;
+use deltalake::kernel::{DataType, PrimitiveType, StructField};
+use deltalake::operations::create::CreateBuilder;
+use integration::harness::{TestBinaryError, TestFixture};
+use std::collections::HashMap;
+use std::path::PathBuf;
+use tempfile::TempDir;
+use testcontainers_modules::testcontainers::core::{IntoContainerPort, WaitFor};
+use testcontainers_modules::testcontainers::runners::AsyncRunner;
+use testcontainers_modules::testcontainers::{ContainerAsync, GenericImage, 
ImageExt};
+use tracing::info;
+use uuid::Uuid;
+
+const ENV_SINK_TABLE_URI: &str = 
"IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_TABLE_URI";
+const ENV_SINK_PATH: &str = "IGGY_CONNECTORS_SINK_DELTA_PATH";
+const ENV_SINK_STORAGE_BACKEND_TYPE: &str =
+    "IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_STORAGE_BACKEND_TYPE";
+const ENV_SINK_AWS_S3_ACCESS_KEY: &str =
+    "IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_AWS_S3_ACCESS_KEY";
+const ENV_SINK_AWS_S3_SECRET_KEY: &str =
+    "IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_AWS_S3_SECRET_KEY";
+const ENV_SINK_AWS_S3_REGION: &str = 
"IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_AWS_S3_REGION";
+const ENV_SINK_AWS_S3_ENDPOINT_URL: &str =
+    "IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_AWS_S3_ENDPOINT_URL";
+const ENV_SINK_AWS_S3_ALLOW_HTTP: &str =
+    "IGGY_CONNECTORS_SINK_DELTA_PLUGIN_CONFIG_AWS_S3_ALLOW_HTTP";
+
+const MINIO_IMAGE: &str = "minio/minio";
+const MINIO_TAG: &str = "RELEASE.2025-09-07T16-13-09Z";
+const MINIO_PORT: u16 = 9000;
+const MINIO_CONSOLE_PORT: u16 = 9001;
+const MINIO_ACCESS_KEY: &str = "admin";
+const MINIO_SECRET_KEY: &str = "password";
+const MINIO_BUCKET: &str = "delta-warehouse";
+
+pub struct DeltaFixture {
+    _temp_dir: TempDir,
+    table_path: PathBuf,
+}
+
+impl DeltaFixture {
+    pub async fn wait_for_delta_log(
+        &self,
+        min_versions: usize,
+        max_attempts: usize,
+        interval_ms: u64,
+    ) -> Result<usize, TestBinaryError> {
+        let delta_log_dir = self.table_path.join("_delta_log");
+
+        for _ in 0..max_attempts {
+            let count = Self::count_delta_versions(&delta_log_dir);
+            if count >= min_versions {
+                info!("Found {count} delta log versions (required: 
{min_versions})");
+                return Ok(count);
+            }
+            
tokio::time::sleep(std::time::Duration::from_millis(interval_ms)).await;
+        }
+
+        let final_count = Self::count_delta_versions(&delta_log_dir);
+        Err(TestBinaryError::InvalidState {
+            message: format!(
+                "Expected at least {min_versions} delta log versions, found 
{final_count} after {max_attempts} attempts"
+            ),
+        })
+    }
+
+    async fn create_table(table_uri: &str) -> Result<(), TestBinaryError> {
+        let columns = vec![
+            StructField::new("id", DataType::Primitive(PrimitiveType::Long), 
true),
+            StructField::new("name", 
DataType::Primitive(PrimitiveType::String), true),
+            StructField::new("count", 
DataType::Primitive(PrimitiveType::Integer), true),
+            StructField::new("amount", 
DataType::Primitive(PrimitiveType::Double), true),
+            StructField::new("active", 
DataType::Primitive(PrimitiveType::Boolean), true),
+            StructField::new("timestamp", 
DataType::Primitive(PrimitiveType::Long), true),

Review Comment:
   Agree on fixing the schema type. Timestamp better reflects real usage. 
   
   Disagree on the second part. Catching specific bugs like the TimestampNtz 
gap or null coercion is the unit test's responsibility. My rubric with the 
integration test is to verify the happy path end-to-end.



-- 
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]

Reply via email to