Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Aug 8, 2024
1 parent 7fd794b commit 01b3920
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/open_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ use std::sync::Arc;
use test_log::test;

#[test]
fn open_file_limit() {
let folder = tempfile::tempdir_in(".test").unwrap();
fn open_file_limit() -> lsm_tree::Result<()> {
std::fs::create_dir_all(".test")?;
let folder = tempfile::tempdir_in(".test")?;

let tree = Config::new(folder)
.block_size(1_024)
.block_cache(Arc::new(BlockCache::with_capacity_bytes(0)))
.open()
.unwrap();
.open()?;

for _ in 0..2_048 {
let key = 0u64.to_be_bytes();
tree.insert(key, key, 0);
tree.flush_active_memtable().unwrap();
tree.flush_active_memtable()?;
}

for _ in 0..5 {
assert!(tree.first_key_value().unwrap().is_some());
assert!(tree.first_key_value()?.is_some());
}

Ok(())
}

0 comments on commit 01b3920

Please sign in to comment.