Integrate independent signed Windows clocks with native Linux lease guards
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-15 10:26:24 +01:00
parent 6ddfc95fff
commit 09f7e5af84
13 changed files with 1093 additions and 37 deletions
+42
View File
@@ -17,6 +17,48 @@ struct Clock {
now: DateTime<Utc>,
trusted: bool,
}
#[test]
fn client_lease_requires_entire_fresh_upper_before_deadline() {
struct IntervalClock {
wall: DateTime<Utc>,
upper: DateTime<Utc>,
}
impl SyncClock for IntervalClock {
fn now(&self) -> anyhow::Result<DateTime<Utc>> {
Ok(self.wall)
}
fn reading(&self) -> anyhow::Result<ClockReading> {
Ok(ClockReading {
own_wall: self.wall,
upper: self.upper,
})
}
}
let mut f = Fixture::new();
let mut client = f.client();
let prepared = f.prepare(&mut client);
let decision = f.decision(&prepared, true);
f.apply(&mut client, &decision).unwrap();
let wall = decision.valid_until - Duration::milliseconds(10);
assert!(client.can_start(
&f.channel,
false,
&Clock {
now: wall,
trusted: true
}
));
for overshoot in [Duration::zero(), Duration::nanoseconds(1)] {
assert!(!client.can_start(
&f.channel,
false,
&IntervalClock {
wall,
upper: decision.valid_until + overshoot
}
));
}
}
impl SyncClock for Clock {
fn now(&self) -> anyhow::Result<DateTime<Utc>> {
anyhow::ensure!(self.trusted, "CLOCK_UNTRUSTED");