Bump tokio to 1.10 and add a test to confirm memory usage of rolling_total (#392)

This commit is contained in:
James Wilson
2021-08-31 19:18:46 +01:00
committed by GitHub
parent 699c19736f
commit ec5db0fbbf
5 changed files with 25 additions and 5 deletions
+20
View File
@@ -197,6 +197,26 @@ mod test {
use super::*;
#[test]
fn deosnt_grow_beyond_window_size() {
let start_time = Instant::now();
let granularity = Duration::from_secs(1);
let mut rolling_total = RollingTotalBuilder::new()
.granularity(granularity)
.window_size_multiple(3) // There should be no more than 3 buckets ever,
.time_source(UserTimeSource(start_time))
.start();
for n in 0..1_000 {
rolling_total.push(n);
rolling_total
.time_source()
.increment_by(Duration::from_millis(300)); // multiple values per granularity.
}
assert_eq!(rolling_total.averages().len(), 3);
}
#[test]
fn times_grouped_by_granularity_spacing() {
let start_time = Instant::now();