Skip to content

Commit b80864a

Browse files
authored
Merge pull request #155 from dmoliveira/loopmux-br-2xc-heartbeat-edges
Add heartbeat cadence edge-case regression tests
2 parents 774344c + 2cdc9e8 commit b80864a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/main.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11452,6 +11452,39 @@ runs:
1145211452
assert!(should_emit_fleet_heartbeat(now, Some("not-a-ts"), 5));
1145311453
}
1145411454

11455+
#[test]
11456+
fn fleet_heartbeat_emission_does_not_trigger_for_future_timestamps() {
11457+
let now = OffsetDateTime::parse(
11458+
"2026-03-01T00:01:00Z",
11459+
&time::format_description::well_known::Rfc3339,
11460+
)
11461+
.unwrap();
11462+
assert!(!should_emit_fleet_heartbeat(
11463+
now,
11464+
Some("2026-03-01T00:02:30Z"),
11465+
5,
11466+
));
11467+
}
11468+
11469+
#[test]
11470+
fn fleet_heartbeat_emission_with_zero_poll_uses_minimum_interval() {
11471+
let now = OffsetDateTime::parse(
11472+
"2026-03-01T00:01:00Z",
11473+
&time::format_description::well_known::Rfc3339,
11474+
)
11475+
.unwrap();
11476+
assert!(!should_emit_fleet_heartbeat(
11477+
now,
11478+
Some("2026-03-01T00:00:31Z"),
11479+
0,
11480+
));
11481+
assert!(should_emit_fleet_heartbeat(
11482+
now,
11483+
Some("2026-03-01T00:00:30Z"),
11484+
0,
11485+
));
11486+
}
11487+
1145511488
#[test]
1145611489
fn fleet_heartbeat_metric_marks_idle_and_active_modes() {
1145711490
let idle = format_fleet_heartbeat_metric(LoopState::Running, 10, 0, 60);

0 commit comments

Comments
 (0)