Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test(storage-opendal): check OpenDalStorageFactory propagates the IO …
…timeout

Every `OpenDalStorageFactory::build` arm could fall back to the default
`OpenDalClientConfig` without any test failing. Build each enabled backend with
a 45000 ms timeout and read it back from the serialized storage.

Co-authored-by: Copilot App <[email protected]>
  • Loading branch information
kevinjqliu and Copilot committed Oct 4, 2026
commit b56cbb4c49ff2cd00d632ec2f5a2bce9dd8249f2
35 changes: 35 additions & 0 deletions crates/storage/opendal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,41 @@ mod tests {
assert!(err.to_string().contains(OPENDAL_IO_TIMEOUT_MS));
}

#[test]
fn test_factory_propagates_io_timeout() {
let config = StorageConfig::new().with_prop(OPENDAL_IO_TIMEOUT_MS, "45000");
let factories = [
#[cfg(feature = "opendal-memory")]
OpenDalStorageFactory::Memory,
#[cfg(feature = "opendal-fs")]
OpenDalStorageFactory::Fs,
#[cfg(feature = "opendal-s3")]
OpenDalStorageFactory::S3 {
customized_credential_load: None,
},
#[cfg(feature = "opendal-gcs")]
OpenDalStorageFactory::Gcs,
#[cfg(feature = "opendal-oss")]
OpenDalStorageFactory::Oss,
#[cfg(feature = "opendal-azdls")]
OpenDalStorageFactory::Azdls,
#[cfg(feature = "opendal-hf")]
OpenDalStorageFactory::Hf,
];
for factory in factories {
// `build` returns `dyn Storage`, so read the config back from its serialized form.
let storage = factory.build(&config).unwrap();
let json = serde_json::to_value(&*storage).unwrap();
let client_config = json
.as_object()
.unwrap()
.values()
.find_map(|variant| variant.get("client_config"))
.unwrap_or_else(|| panic!("{json}"));
assert_eq!(client_config["io_timeout_ms"], 45_000, "{factory:?}");
}
}

#[cfg(feature = "opendal-memory")]
#[tokio::test(start_paused = true)]
async fn test_io_timeout_reaches_timeout_layer() {
Expand Down
Loading