Blockstore test cleanup (#19656)

* Use auto-deleting macro for ledger path
This commit is contained in:
steviez
2021-09-10 07:33:08 -05:00
committed by GitHub
parent 311b5789af
commit 2dee098b91
8 changed files with 3795 additions and 3954 deletions

View File

@ -1,7 +1,7 @@
use solana_entry::entry;
use solana_ledger::{
blockstore::{self, Blockstore},
get_tmp_ledger_path,
get_tmp_ledger_path_auto_delete,
};
use solana_sdk::hash::Hash;
use std::sync::Arc;
@ -9,8 +9,8 @@ use std::thread::Builder;
#[test]
fn test_multiple_threads_insert_shred() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&blockstore_path).unwrap());
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Arc::new(Blockstore::open(ledger_path.path()).unwrap());
for _ in 0..100 {
let num_threads = 10;
@ -44,8 +44,4 @@ fn test_multiple_threads_insert_shred() {
// Delete slots for next iteration
blockstore.purge_and_compact_slots(0, num_threads + 1);
}
// Cleanup
drop(blockstore);
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
}