Use more complete snapshot tests for the index scheduler

This commit is contained in:
Loïc Lecrenier 2022-10-10 15:51:28 +02:00 committed by Clément Renault
parent 4c55c30027
commit 13a72f8757
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
13 changed files with 273 additions and 194 deletions

View file

@ -58,6 +58,16 @@ impl FileStore {
Ok((uuid, update_file))
}
/// Creates a new temporary update file with the given Uuid.
/// A call to `persist` is needed to persist the file in the database.
pub fn new_update_woth_uuid(&self, uuid: u128) -> Result<(Uuid, File)> {
let file = NamedTempFile::new_in(&self.path)?;
let uuid = Uuid::from_u128(uuid);
let path = self.path.join(uuid.to_string());
let update_file = File { file, path };
Ok((uuid, update_file))
}
/// Returns the file corresponding to the requested uuid.
pub fn get_update(&self, uuid: Uuid) -> Result<StdFile> {