Skip to content

Commit

Permalink
agent: fix a flakey test case
Browse files Browse the repository at this point in the history
  • Loading branch information
psFried committed Jan 21, 2025
1 parent fb1360a commit d04668a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/agent/src/controllers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,11 @@ mod test {
assert_eq!(0, next.after_seconds);
assert!(next.with_jitter_percent(0).compute_duration().is_zero());

let now = Utc::now();
let then = now + chrono::Duration::seconds(60);
let millis = NextRun::after(then)
let millis = NextRun::after_minutes(1)
.with_jitter_percent(20)
.compute_duration()
.as_millis();
assert!(millis > 59900, "duration too small, got: {millis}ms");
assert!(millis < 72000, "duration too big, got: {millis}ms");
assert!(millis >= 60000, "duration too small, got: {millis}ms");
assert!(millis <= 72000, "duration too big, got: {millis}ms");
}
}

0 comments on commit d04668a

Please sign in to comment.