From 582d0d37d9fb318897787cf5a1fcbbe679e0bcc9 Mon Sep 17 00:00:00 2001 From: Prajwol Gyawali Date: Sun, 17 May 2026 16:20:28 +0545 Subject: [PATCH] test(storage): drop redundant persistence-across-reopen tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These exercised sled's own file-lock and durability across reopen, which sled already covers. They were also flaky on Linux due to a sled 0.34 race on tempdir cleanup — papered over in the test body with explicit `drop` and `flush` calls. End-to-end persistence is now covered at the level we actually care about (runner reload across stop/start) by the new asm-runner restart test, so these unit tests carry their flakiness for no incremental coverage. --- crates/storage/src/export_entries.rs | 26 -------------------------- crates/storage/src/mmr.rs | 25 ------------------------- 2 files changed, 51 deletions(-) diff --git a/crates/storage/src/export_entries.rs b/crates/storage/src/export_entries.rs index fb66da9b..b48bee64 100644 --- a/crates/storage/src/export_entries.rs +++ b/crates/storage/src/export_entries.rs @@ -242,32 +242,6 @@ mod tests { assert_eq!(store.get(1, idx1).unwrap().unwrap(), (11, hash(0xa1))); } - #[test] - fn persistence_across_reopen() { - let dir = tempfile::tempdir().unwrap(); - - { - let db = sled::open(dir.path()).unwrap(); - let store = ExportEntriesDb::open(&db).unwrap(); - store.append(2, 5, hash(0x42)).unwrap(); - store.append(2, 6, hash(0x43)).unwrap(); - // Drop tree handles before the db so its file lock is released - // synchronously (sled 0.34 can otherwise race on reopen on Linux). - drop(store); - db.flush().unwrap(); - drop(db); - } - - { - let db = sled::open(dir.path()).unwrap(); - let store = ExportEntriesDb::open(&db).unwrap(); - assert_eq!(store.num_entries(2).unwrap(), 2); - assert_eq!(store.get(2, 0).unwrap().unwrap(), (5, hash(0x42))); - assert_eq!(store.get(2, 1).unwrap().unwrap(), (6, hash(0x43))); - assert_eq!(store.find_index(2, &hash(0x43)).unwrap(), Some((1, 6))); - } - } - fn rebuild_compact_mmr(store: &ExportEntriesDb, container_id: u8, size: u64) -> Mmr64B32 { let mut compact = Mmr64B32::new_empty(); for i in 0..size { diff --git a/crates/storage/src/mmr.rs b/crates/storage/src/mmr.rs index 731bf164..6a7fdcf3 100644 --- a/crates/storage/src/mmr.rs +++ b/crates/storage/src/mmr.rs @@ -245,29 +245,4 @@ mod tests { let proof = mmr_db.generate_proof(2, 4).unwrap(); assert!(compact_at_4.verify(&proof, &make_leaf(2).0)); } - - #[test] - fn persistence_across_reopen() { - let dir = tempfile::tempdir().unwrap(); - - { - let db = sled::open(dir.path()).unwrap(); - let mmr = MmrDb::open(&db).unwrap(); - mmr.append_leaf(make_leaf(0x42)).unwrap(); - mmr.append_leaf(make_leaf(0x43)).unwrap(); - // Drop tree handles before the db so its file lock is released - // synchronously (sled 0.34 can otherwise race on reopen on Linux). - drop(mmr); - db.flush().unwrap(); - drop(db); - } - - { - let db = sled::open(dir.path()).unwrap(); - let mmr = MmrDb::open(&db).unwrap(); - assert_eq!(mmr.leaf_count().unwrap(), 2); - assert_eq!(mmr.get_leaf(0).unwrap().unwrap(), make_leaf(0x42)); - assert_eq!(mmr.get_leaf(1).unwrap().unwrap(), make_leaf(0x43)); - } - } }