|
19 | 19 |
|
20 | 20 | use crate::connectors::create_test_messages; |
21 | 21 | use crate::connectors::fixtures::{ |
22 | | - DEFAULT_NAMESPACE, DEFAULT_TABLE, IcebergOps, IcebergPreCreatedFixture, |
| 22 | + DEFAULT_NAMESPACE, DEFAULT_TABLE, IcebergEnvAuthFixture, IcebergOps, IcebergPreCreatedFixture, |
23 | 23 | }; |
24 | 24 | use bytes::Bytes; |
25 | 25 | use iggy::prelude::{IggyMessage, Partitioning}; |
@@ -207,3 +207,50 @@ async fn iceberg_sink_handles_bulk_messages( |
207 | 207 | assert_eq!(sinks.len(), 1); |
208 | 208 | assert!(sinks[0].last_error.is_none()); |
209 | 209 | } |
| 210 | + |
| 211 | +#[iggy_harness( |
| 212 | + server(connectors_runtime(config_path = "tests/connectors/iceberg/sink_default_credentials.toml")), |
| 213 | + seed = seeds::connector_stream |
| 214 | +)] |
| 215 | +async fn iceberg_sink_uses_default_credential_chain( |
| 216 | + harness: &TestHarness, |
| 217 | + fixture: IcebergEnvAuthFixture, |
| 218 | +) { |
| 219 | + let client = harness.root_client().await.unwrap(); |
| 220 | + let stream_id: iggy_common::Identifier = seeds::names::STREAM.try_into().unwrap(); |
| 221 | + let topic_id: iggy_common::Identifier = seeds::names::TOPIC.try_into().unwrap(); |
| 222 | + let test_messages = crate::connectors::create_test_messages(5); |
| 223 | + let mut messages: Vec<IggyMessage> = test_messages |
| 224 | + .iter() |
| 225 | + .enumerate() |
| 226 | + .map(|(i, msg)| { |
| 227 | + let payload = serde_json::to_vec(msg).unwrap(); |
| 228 | + IggyMessage::builder() |
| 229 | + .id((i + 1) as u128) |
| 230 | + .payload(bytes::Bytes::from(payload)) |
| 231 | + .build() |
| 232 | + .unwrap() |
| 233 | + }) |
| 234 | + .collect(); |
| 235 | + client |
| 236 | + .send_messages( |
| 237 | + &stream_id, |
| 238 | + &topic_id, |
| 239 | + &Partitioning::partition_id(0), |
| 240 | + &mut messages, |
| 241 | + ) |
| 242 | + .await |
| 243 | + .expect("Failed to send fake messages"); |
| 244 | + let snapshot_count = fixture |
| 245 | + .wait_for_snapshots( |
| 246 | + DEFAULT_NAMESPACE, |
| 247 | + DEFAULT_TABLE, |
| 248 | + 1, |
| 249 | + SNAPSHOT_POLL_ATTEMPTS, |
| 250 | + SNAPSHOT_POLL_INTERVAL_MS, |
| 251 | + ) |
| 252 | + .await |
| 253 | + .expect("Data should be written to Iceberg table"); |
| 254 | + assert!(snapshot_count >= 1); |
| 255 | + drop(fixture); |
| 256 | +} |
0 commit comments