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)); - } - } }