Skip to content

Commit

Permalink
fix unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm committed Nov 17, 2024
1 parent d6ceb77 commit 263db7f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions rocketmq-store/src/queue/queue_offset_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,28 @@ mod tests {
fn update_queue_offset_updates_existing_value() {
let operator = QueueOffsetOperator::new();
operator.increase_queue_offset("key".into(), 5);
operator.update_queue_offset("key".into(), 10);
operator.update_queue_offset(&CheetahString::from_static_str("key"), 10);
assert_eq!(operator.get_queue_offset("key".into()), 10);
}

#[test]
fn remove_clears_key_from_all_tables() {
let operator = QueueOffsetOperator::new();
operator.increase_queue_offset("topic-1".into(), 5);
operator.increase_batch_queue_offset("topic-1".into(), 5);
operator.increase_lmq_offset("topic-1".into(), 5);
operator.increase_batch_queue_offset(&CheetahString::from_static_str("topic-1"), 5);
operator.increase_lmq_offset(&CheetahString::from_static_str("topic-1"), 5);

operator.remove("topic".into(), 1);
operator.remove(&CheetahString::from_static_str("topic"), 1);

assert_eq!(operator.get_queue_offset("topic-1".into()), 0);
assert_eq!(operator.get_batch_queue_offset("topic-1".into()), 0);
assert_eq!(operator.get_lmq_offset("topic-1".into()), 0);
assert_eq!(
operator.get_batch_queue_offset(&CheetahString::from_static_str("topic-1")),
0
);
assert_eq!(
operator.get_lmq_offset(&CheetahString::from_static_str("topic-1")),
0
);
}

#[test]
Expand Down

0 comments on commit 263db7f

Please sign in to comment.