From 84ad3a5c2cd86f556f0a89a0072c8ba8cce3b306 Mon Sep 17 00:00:00 2001 From: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com> Date: Wed, 18 Nov 2026 05:21:39 +0000 Subject: [PATCH] test(storage-sqlite): skip a file that goes between the listing and the read SQLite deletes the WAL and its index when the last connection closes, and pool.close() can return before that. In 30 local runs, both files were still there right after close() returned in 1 run. The secure-delete test lists the catalog directory and then reads each file, so a file that went in between failed the test with NotFound. The store checkpoints and truncates the WAL after each overwrite, so a WAL that goes holds no page. The helper now skips a file that is gone, and it still fails on any other read error. --- .../src/management_store/secret_rows.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/storage-sqlite/src/management_store/secret_rows.rs b/crates/storage-sqlite/src/management_store/secret_rows.rs index 2227ee9ae..67ff8f4c2 100644 --- a/crates/storage-sqlite/src/management_store/secret_rows.rs +++ b/crates/storage-sqlite/src/management_store/secret_rows.rs @@ -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)> { 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() }