emkornfield commented on code in PR #2115:
URL: https://github.com/apache/iceberg-rust/pull/2115#discussion_r2796962664


##########
crates/catalog/s3tables/src/catalog.rs:
##########
@@ -1123,4 +1129,129 @@ mod tests {
             assert_eq!(err.message(), "Catalog name cannot be empty");
         }
     }
+
+    // Helper functions for testing
+
+    /// Creates a mock HTTP response with the given JSON body
+    fn mock_http_response(json_body: &str) -> HttpResponse {
+        HttpResponse::try_from(Response::new(
+            StatusCode::try_from(200).unwrap(),
+            SdkBody::from(json_body),
+        ))
+        .unwrap()
+    }
+
+    /// Creates a test catalog with mocked S3 Tables client that returns the 
given HTTP responses
+    fn create_test_catalog_with_responses(responses: Vec<HttpResponse>) -> 
S3TablesCatalog {
+        // Create mocked S3 Tables client
+        let events: Vec<ReplayEvent> = responses
+            .into_iter()
+            .map(|response| ReplayEvent::new(Request::new(SdkBody::empty()), 
response))
+            .collect();
+
+        let http_client = StaticReplayClient::new(events);
+        let creds = Credentials::new("test", "test", None, None, "test");
+
+        let config = aws_sdk_s3tables::Config::builder()
+            .region(aws_sdk_s3tables::config::Region::new("us-east-1"))
+            .credentials_provider(creds)
+            .http_client(http_client)
+            
.behavior_version(aws_sdk_s3tables::config::BehaviorVersion::latest())
+            .build();
+
+        let s3tables_client = aws_sdk_s3tables::Client::from_conf(config);
+
+        // Create in-memory file IO
+        let file_io = FileIOBuilder::new("memory").build().unwrap();
+
+        // Assemble catalog
+        S3TablesCatalog {
+            config: S3TablesCatalogConfig {
+                name: Some("test".to_string()),
+                table_bucket_arn: 
"arn:aws:s3tables:us-east-1:123456789012:bucket/test".to_string(),
+                endpoint_url: None,
+                client: Some(s3tables_client.clone()),
+                props: HashMap::new(),
+            },
+            s3tables_client,
+            file_io,
+        }
+    }
+
+    /// Creates a simple test table creation with id and name fields
+    fn create_test_table_creation(table_name: &str) -> TableCreation {
+        let schema = Schema::builder()
+            .with_schema_id(0)
+            .with_fields(vec![
+                NestedField::required(1, "id", 
Type::Primitive(PrimitiveType::Int)).into(),
+                NestedField::required(2, "name", 
Type::Primitive(PrimitiveType::String)).into(),
+            ])
+            .build()
+            .unwrap();
+
+        TableCreation::builder()
+            .name(table_name.to_string())
+            .properties(HashMap::new())
+            .schema(schema)
+            .build()
+    }
+
+    #[tokio::test]
+    async fn test_create_table_with_mocked_client() {

Review Comment:
   OK, reverted the test. Thanks for the review @blackmwk 



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

Reply via email to