Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 committed Sep 8, 2023
1 parent aaee04f commit 48d7d08
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/storage/hummock_sdk/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ impl<T: AsRef<[u8]>> TableKey<T> {

impl EstimateSize for TableKey<Bytes> {
fn estimated_heap_size(&self) -> usize {
self.0.estimated_size()
self.0.estimated_heap_size()
}
}

Expand Down
38 changes: 19 additions & 19 deletions src/storage/hummock_test/src/sync_point_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
let val1 = Bytes::from(b"1"[..].repeat(1 << 10)); // 1024 Byte value

local.init_for_test(100).await.unwrap();
let mut start_key = b"\0\0aaa".to_vec();
let mut start_key = b"aaa".to_vec();
for _ in 0..10 {
local
.insert(
Expand All @@ -323,21 +323,21 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
}
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0ggg"),
gen_key_from_bytes(VirtualNode::ZERO, b"ggg"),
val0.clone(),
None,
)
.unwrap();
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0hhh"),
gen_key_from_bytes(VirtualNode::ZERO, b"hhh"),
val0.clone(),
None,
)
.unwrap();
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0kkk"),
gen_key_from_bytes(VirtualNode::ZERO, b"kkk"),
val0.clone(),
None,
)
Expand All @@ -354,22 +354,22 @@ async fn test_syncpoints_get_in_delete_range_boundary() {

local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0aaa"),
gen_key_from_bytes(VirtualNode::ZERO, b"aaa"),
val1.clone(),
None,
)
.unwrap();
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0bbb"),
gen_key_from_bytes(VirtualNode::ZERO, b"bbb"),
val1.clone(),
None,
)
.unwrap();
local
.flush(vec![(
Bound::Included(Bytes::from(b"\0\0ggg".as_slice())),
Bound::Excluded(Bytes::from(b"\0\0hhh".as_slice())),
Bound::Included(Bytes::from(b"ggg".as_slice())),
Bound::Excluded(Bytes::from(b"hhh".as_slice())),
)])
.await
.unwrap();
Expand All @@ -384,22 +384,22 @@ async fn test_syncpoints_get_in_delete_range_boundary() {

local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0hhh"),
gen_key_from_bytes(VirtualNode::ZERO, b"hhh"),
val1.clone(),
None,
)
.unwrap();
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0iii"),
gen_key_from_bytes(VirtualNode::ZERO, b"iii"),
val1.clone(),
None,
)
.unwrap();
local
.flush(vec![(
Bound::Included(Bytes::from(b"\0\0jjj".as_slice())),
Bound::Excluded(Bytes::from(b"\0\0kkk".as_slice())),
Bound::Included(Bytes::from(b"jjj".as_slice())),
Bound::Excluded(Bytes::from(b"kkk".as_slice())),
)])
.await
.unwrap();
Expand All @@ -415,14 +415,14 @@ async fn test_syncpoints_get_in_delete_range_boundary() {

local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0lll"),
gen_key_from_bytes(VirtualNode::ZERO, b"lll"),
val1.clone(),
None,
)
.unwrap();
local
.insert(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0mmm"),
gen_key_from_bytes(VirtualNode::ZERO, b"mmm"),
val1.clone(),
None,
)
Expand Down Expand Up @@ -463,7 +463,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
};
let get_result = storage
.get(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0hhh"),
gen_key_from_bytes(VirtualNode::ZERO, b"hhh"),
120,
read_options.clone(),
)
Expand All @@ -472,7 +472,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
assert_eq!(get_result.unwrap(), val1);
let get_result = storage
.get(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0ggg"),
gen_key_from_bytes(VirtualNode::ZERO, b"ggg"),
120,
read_options.clone(),
)
Expand All @@ -481,7 +481,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
assert!(get_result.is_none());
let get_result = storage
.get(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0aaa"),
gen_key_from_bytes(VirtualNode::ZERO, b"aaa"),
120,
read_options.clone(),
)
Expand All @@ -490,7 +490,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
assert_eq!(get_result.unwrap(), val1);
let get_result = storage
.get(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0aab"),
gen_key_from_bytes(VirtualNode::ZERO, b"aab"),
120,
read_options.clone(),
)
Expand All @@ -507,7 +507,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() {
});
let get_result = storage
.get(
gen_key_from_bytes(VirtualNode::ZERO, b"\0\0kkk"),
gen_key_from_bytes(VirtualNode::ZERO, b"kkk"),
120,
read_options.clone(),
)
Expand Down
1 change: 1 addition & 0 deletions src/storage/src/mem_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ mod tests {
mem_table
.insert(TableKey("key1".into()), "value1".into())
.unwrap();

assert_eq!(
mem_table.kv_size.size(),
std::mem::size_of::<Bytes>()
Expand Down

0 comments on commit 48d7d08

Please sign in to comment.