mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
add test_open_db_restart
This commit is contained in:
parent
b34917e155
commit
e77cd830c7
@ -70,7 +70,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_open_db_with_genesis() {
|
||||
let temp_dir: tempfile::TempDir = tempdir().unwrap();
|
||||
let temp_dir = tempdir().unwrap();
|
||||
let path = temp_dir.path();
|
||||
|
||||
let genesis_block = create_genesis_block();
|
||||
@ -83,4 +83,20 @@ mod tests {
|
||||
assert_eq!(stored_block.hash, genesis_block.hash);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_open_db_restart() {
|
||||
let temp_dir = tempdir().unwrap();
|
||||
let path = temp_dir.path();
|
||||
|
||||
let genesis_block = create_genesis_block();
|
||||
let _ = NodeBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap();
|
||||
|
||||
// Restart the database
|
||||
let node_store = NodeBlockStore::open_db_restart(path).unwrap();
|
||||
|
||||
// The block should no longer be available since no genesis block is set on restart
|
||||
let result = node_store.get_block_at_id(0);
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user