Expose the existing helper sync lease deadline without changing readiness
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -204,6 +204,10 @@ impl<V: Ed25519Verifier> HelperSync<V> {
|
|||||||
self.lease = None;
|
self.lease = None;
|
||||||
self.capture = None;
|
self.capture = None;
|
||||||
}
|
}
|
||||||
|
/// Read-only bound of the existing confirmed lease; creates no readiness.
|
||||||
|
pub fn validity_deadline(&self) -> Option<DateTime<Utc>> {
|
||||||
|
self.lease.as_ref().map(|lease| lease.until)
|
||||||
|
}
|
||||||
pub fn active_generation(&self) -> Option<u64> {
|
pub fn active_generation(&self) -> Option<u64> {
|
||||||
self.lease.as_ref().map(|lease| lease.generation)
|
self.lease.as_ref().map(|lease| lease.generation)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -984,11 +984,13 @@ fn clean_ready_shared_lock_and_reopen_start_closed() {
|
|||||||
let mut f = Fixture::new();
|
let mut f = Fixture::new();
|
||||||
let mut sync = f.sync();
|
let mut sync = f.sync();
|
||||||
assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot));
|
assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot));
|
||||||
|
assert_eq!(sync.validity_deadline(), None);
|
||||||
let snapshot = f.snapshot(&mut sync, 1);
|
let snapshot = f.snapshot(&mut sync, 1);
|
||||||
let raw = f.request(&snapshot);
|
let raw = f.request(&snapshot);
|
||||||
let d = f.decision(&snapshot, &raw, 1, true);
|
let d = f.decision(&snapshot, &raw, 1, true);
|
||||||
let applied = f.apply(&mut sync, &d, &raw).unwrap();
|
let applied = f.apply(&mut sync, &d, &raw).unwrap();
|
||||||
assert!(applied.ready);
|
assert!(applied.ready);
|
||||||
|
assert_eq!(sync.validity_deadline(), Some(d.valid_until));
|
||||||
assert_eq!(sync.active_generation(), Some(1));
|
assert_eq!(sync.active_generation(), Some(1));
|
||||||
assert_eq!(applied.snapshot.previous_decision_id, Some(d.decision_id));
|
assert_eq!(applied.snapshot.previous_decision_id, Some(d.decision_id));
|
||||||
assert!(applied.unlocked_grants.is_empty());
|
assert!(applied.unlocked_grants.is_empty());
|
||||||
@@ -1004,6 +1006,7 @@ fn clean_ready_shared_lock_and_reopen_start_closed() {
|
|||||||
.is_err()
|
.is_err()
|
||||||
);
|
);
|
||||||
sync.close();
|
sync.close();
|
||||||
|
assert_eq!(sync.validity_deadline(), None);
|
||||||
assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot));
|
assert!(!sync.can_start(&f.db, &f.guard, 1, &f.clock, &f.boot));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user