Skip to content

Commit

Permalink
Fix downsampling test for slow environment
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Jan 24, 2024
1 parent 7754b65 commit d6493e0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions zenoh/tests/interceptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ fn downsampling() {
.unwrap();

let interval = std::time::Duration::from_millis(10);
let mut last_send_time = std::time::Instant::now();
let start_time = std::time::Instant::now();
let mut last_send_time = start_time;
for i in 0..100 {
let start_time = last_send_time;
println!("message {}", i);
Expand All @@ -81,6 +82,13 @@ fn downsampling() {
}

// check result count of queries
assert_eq!(*count_r100.lock().unwrap(), 10);
assert_eq!(*count_r50.lock().unwrap(), 20);
let full_elapsed_time = std::time::Instant::now() - start_time;
assert_eq!(
*count_r100.lock().unwrap(),
full_elapsed_time.as_millis() / 100
);
assert_eq!(
*count_r50.lock().unwrap(),
full_elapsed_time.as_millis() / 50
);
}

0 comments on commit d6493e0

Please sign in to comment.