This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-3478-061925453a91c2e505dece727c8873eb408b8f37 in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
commit 8b59642650d1da12270a8a570e0ae7acfa86a9c6 Author: blackmwk <[email protected]> AuthorDate: Fri Oct 16 17:40:33 2026 +0000 test(glue): cover KMS property forwarding (#3478) Record the full map received by the KMS factory and check initialization error propagation. Label missing and empty warehouse cases and document the crate-private Glue properties. Follow-up to apache/iceberg-rust#3102. Generated-by: Codex --- crates/catalog/glue/src/catalog.rs | 68 +++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/crates/catalog/glue/src/catalog.rs b/crates/catalog/glue/src/catalog.rs index 06e8b8400..99fb2a51e 100644 --- a/crates/catalog/glue/src/catalog.rs +++ b/crates/catalog/glue/src/catalog.rs @@ -118,6 +118,7 @@ impl CatalogBuilder for GlueCatalogBuilder { } } +/// Glue catalog properties parsed from the `load` property map. #[derive(Debug, Properties)] pub(crate) struct GlueCatalogProperties { #[property(key = GLUE_CATALOG_PROP_URI, default = None)] @@ -928,6 +929,8 @@ impl Catalog for GlueCatalog { #[cfg(test)] mod tests { + use std::sync::Mutex; + use super::*; #[test] @@ -964,17 +967,72 @@ mod tests { #[tokio::test] async fn test_load_rejects_missing_or_empty_warehouse() { - for props in [ - HashMap::new(), - HashMap::from([(GLUE_CATALOG_PROP_WAREHOUSE.to_string(), String::new())]), + for (case, props) in [ + ("missing", HashMap::new()), + ( + "empty", + HashMap::from([(GLUE_CATALOG_PROP_WAREHOUSE.to_string(), String::new())]), + ), ] { let error = GlueCatalogBuilder::default() .load("glue", props) .await .unwrap_err(); - assert_eq!(error.kind(), ErrorKind::DataInvalid); - assert_eq!(error.message(), "Catalog warehouse is required"); + assert_eq!( + (error.kind(), error.message()), + (ErrorKind::DataInvalid, "Catalog warehouse is required"), + "{case}" + ); } } + + #[tokio::test] + async fn test_load_forwards_all_properties_to_kms_factory() { + #[derive(Debug, Default)] + struct RecordingKmsClientFactory(Mutex<HashMap<String, String>>); + + #[async_trait] + impl KmsClientFactory for RecordingKmsClientFactory { + async fn create_kms_client( + &self, + properties: &HashMap<String, String>, + ) -> Result<Arc<dyn KeyManagementClient>> { + *self.0.lock().unwrap() = properties.clone(); + Err(Error::new( + ErrorKind::Unexpected, + "KMS initialization failed", + )) + } + } + + let properties = HashMap::from([ + ( + GLUE_CATALOG_PROP_URI.to_string(), + "http://localhost".to_string(), + ), + ( + GLUE_CATALOG_PROP_CATALOG_ID.to_string(), + "catalog".to_string(), + ), + ( + GLUE_CATALOG_PROP_WAREHOUSE.to_string(), + "s3://warehouse".to_string(), + ), + (AWS_REGION_NAME.to_string(), "us-east-1".to_string()), + ("custom.property".to_string(), "value".to_string()), + ]); + let factory = Arc::new(RecordingKmsClientFactory::default()); + let error = GlueCatalogBuilder::default() + .with_kms_client_factory(factory.clone()) + .load("glue", properties.clone()) + .await + .unwrap_err(); + + assert_eq!(*factory.0.lock().unwrap(), properties); + assert_eq!( + (error.kind(), error.message()), + (ErrorKind::Unexpected, "KMS initialization failed") + ); + } }
