Skip to content

Commit 422981a

Browse files
committed
test: expect point reads
1 parent 6832088 commit 422981a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/expect_point_read_hits.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use lsm_tree::{get_tmp_folder, AbstractTree, Config, SequenceNumberCounter};
2+
use test_log::test;
3+
4+
#[test]
5+
fn tree_builds_filters() -> lsm_tree::Result<()> {
6+
let folder = get_tmp_folder();
7+
8+
let tree = Config::new(&folder, SequenceNumberCounter::default())
9+
.expect_point_read_hits(false)
10+
.open()?;
11+
12+
tree.insert("a", "a", 0);
13+
14+
tree.flush_active_memtable(0)?;
15+
assert!(tree.filter_size() > 0);
16+
17+
tree.major_compact(u64::MAX, 0)?;
18+
assert!(tree.filter_size() > 0);
19+
20+
Ok(())
21+
}
22+
23+
#[test]
24+
fn tree_expect_point_read_hits() -> lsm_tree::Result<()> {
25+
let folder = get_tmp_folder();
26+
27+
let tree = Config::new(&folder, SequenceNumberCounter::default())
28+
.expect_point_read_hits(true)
29+
.open()?;
30+
31+
tree.insert("a", "a", 0);
32+
33+
tree.flush_active_memtable(0)?;
34+
assert!(tree.filter_size() > 0);
35+
36+
tree.major_compact(u64::MAX, 0)?;
37+
assert!(tree.filter_size() == 0);
38+
39+
Ok(())
40+
}

0 commit comments

Comments
 (0)