gomnitrix commented on code in PR #3045:
URL: https://github.com/apache/iggy/pull/3045#discussion_r3047569221
##########
core/connectors/sinks/iceberg_sink/src/props.rs:
##########
@@ -30,14 +30,49 @@ pub fn init_props(config: &IcebergSinkConfig) ->
Result<HashMap<String, String>,
fn get_props_s3(config: &IcebergSinkConfig) -> Result<HashMap<String, String>,
Error> {
let mut props: HashMap<String, String> = HashMap::new();
props.insert("s3.region".to_string(), config.store_region.clone());
- props.insert(
- "s3.access-key-id".to_string(),
- config.store_access_key_id.clone(),
- );
- props.insert(
- "s3.secret-access-key".to_string(),
- config.store_secret_access_key.clone(),
- );
+ if let Some(access_key_id) = &config.store_access_key_id {
+ props.insert("s3.access-key-id".to_string(), access_key_id.clone());
+ }
+ if let Some(secret_access_key) = &config.store_secret_access_key {
+ props.insert(
+ "s3.secret-access-key".to_string(),
+ secret_access_key.clone(),
+ );
+ }
props.insert("s3.endpoint".to_string(), config.store_url.clone());
Ok(props)
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::{IcebergSinkConfig, IcebergSinkStoreClass, IcebergSinkTypes};
+
+ #[test]
+ fn test_get_props_s3() {
Review Comment:
Updated the unit tests to cover the partial credential scenarios. Since
adding the new cases made the test a bit long and bloated, I also split it up.
Thanks!
--
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]