Skip to content
Merged
Changes from all commits
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
13 changes: 9 additions & 4 deletions crates/storage-sqlite/src/management_store/secret_rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,19 @@ mod tests {
}

/// The bytes of every file in `dir`: the database, its WAL and its
/// shared-memory index.
/// shared-memory index. It skips a file that goes between the listing
/// and the read: SQLite deletes the WAL and its index when the last
/// connection closes.
fn files(dir: &Path) -> Vec<(String, Vec<u8>)> {
std::fs::read_dir(dir)
.expect("list the directory")
.map(|entry| {
.filter_map(|entry| {
let path = entry.expect("an entry").path();
let bytes = std::fs::read(&path).expect("read a file");
(path.display().to_string(), bytes)
match std::fs::read(&path) {
Ok(bytes) => Some((path.display().to_string(), bytes)),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => None,
Err(e) => panic!("read {}: {e}", path.display()),
}
})
.collect()
}
Expand Down
Loading