PR218: make archive scale test exercise staging
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
07d9678209
commit
5413c8bb3a
|
|
@ -1069,6 +1069,7 @@ mod tests {
|
|||
main[28..32].copy_from_slice(&2u32.to_be_bytes());
|
||||
main[44..48].copy_from_slice(&4u32.to_be_bytes());
|
||||
main[56..60].copy_from_slice(&1u32.to_be_bytes());
|
||||
main[100] = 0x0d;
|
||||
let page = &mut main[512..];
|
||||
page[0] = 0x0d;
|
||||
page[3..5].copy_from_slice(&1u16.to_be_bytes());
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@ fn error(message: impl Into<String>) -> crate::EngineError {
|
|||
crate::EngineError::BadParams { cmd: COMMAND.into(), msg: message.into() }
|
||||
}
|
||||
|
||||
fn stage_archive(archive_dir: Option<&Path>, data: &mut CatalogImport) -> crate::Result<Option<PathBuf>> {
|
||||
let archive_path = archive_dir.map(|dir| crate::lightroom_archive::store_best_effort(dir, data).map_err(error)).transpose()?.flatten();
|
||||
if archive_dir.is_some() && archive_path.is_none() {
|
||||
data.warnings.push("Lightroom source archive exceeded 32 MiB; archive skipped".into());
|
||||
}
|
||||
Ok(archive_path)
|
||||
}
|
||||
|
||||
/// Memory identity of the library which owns a prepared completion.
|
||||
///
|
||||
/// Each successful open/close refreshes session identity, including reopening the same path.
|
||||
|
|
@ -199,11 +207,7 @@ impl LightroomJob {
|
|||
normal.rollback();
|
||||
return Err(error("Lightroom import cancelled"));
|
||||
}
|
||||
let archive_path =
|
||||
self.archive_dir.as_ref().map(|dir| crate::lightroom_archive::store_best_effort(dir, &data).map_err(error)).transpose()?.flatten();
|
||||
if self.archive_dir.is_some() && archive_path.is_none() {
|
||||
data.warnings.push("Lightroom source archive exceeded 32 MiB; archive skipped".into());
|
||||
}
|
||||
let archive_path = stage_archive(self.archive_dir.as_deref(), &mut data)?;
|
||||
let index_path = self.archive_dir.as_ref().map(|dir| dir.join("lightroom-index.json"));
|
||||
let index = lightroom_catalog::load_index(index_path.as_deref())?;
|
||||
Ok(PreparedLightroom {
|
||||
|
|
@ -397,9 +401,8 @@ mod tests {
|
|||
}
|
||||
})
|
||||
.collect();
|
||||
let archive_path = crate::lightroom_archive::store_best_effort(&archive_dir, &data).unwrap();
|
||||
let archive_path = stage_archive(Some(&archive_dir), &mut data).unwrap();
|
||||
assert!(archive_path.is_none());
|
||||
data.warnings.push("Lightroom source archive exceeded 32 MiB; archive skipped".into());
|
||||
let mut session = crate::Session::new();
|
||||
let token = LightroomLibraryToken::capture(&session);
|
||||
let prepared = PreparedLightroom {
|
||||
|
|
|
|||
Loading…
Reference in New Issue