event-publisher, export, rss, media-server, object-storage, nats(config).
Kept inline (private fn, no public path): nats src/subject.rs
tests::{review_logged_subject,review_updated_subject,movie_discovered_subject,
consumer_subject_filter_appends_wildcard} - event_to_subject/consumer_subject_filter private.
object-storage build_local_store tests rewritten via StorageConfig::from_config.
45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
use object_storage::StorageConfig;
|
|
|
|
fn local_section(dir: &std::path::Path) -> config::StorageConfig {
|
|
config::StorageConfig {
|
|
backend: "local".into(),
|
|
path: dir.to_str().unwrap().into(),
|
|
..Default::default()
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn local_store_creates_dir_and_succeeds() {
|
|
let dir = std::env::temp_dir().join(format!("image_test_{}", uuid::Uuid::new_v4()));
|
|
let result = StorageConfig::from_config(&local_section(&dir));
|
|
assert!(result.is_ok(), "expected Ok, got: {:?}", result.err());
|
|
assert!(dir.exists(), "directory should have been created");
|
|
}
|
|
|
|
#[test]
|
|
fn local_store_succeeds_if_dir_already_exists() {
|
|
let dir = std::env::temp_dir().join(format!("image_test_{}", uuid::Uuid::new_v4()));
|
|
std::fs::create_dir_all(&dir).unwrap();
|
|
let result = StorageConfig::from_config(&local_section(&dir));
|
|
assert!(result.is_ok());
|
|
}
|
|
|
|
#[test]
|
|
fn s3_backend_requires_endpoint() {
|
|
let section = config::StorageConfig {
|
|
backend: "s3".into(),
|
|
..Default::default()
|
|
};
|
|
let err = StorageConfig::from_config(§ion).err().unwrap();
|
|
assert!(err.to_string().contains("MINIO_ENDPOINT required"));
|
|
}
|
|
|
|
#[test]
|
|
fn unknown_backend_is_error() {
|
|
let section = config::StorageConfig {
|
|
backend: "ftp".into(),
|
|
..Default::default()
|
|
};
|
|
assert!(StorageConfig::from_config(§ion).is_err());
|
|
}
|