Skip to content

Commit 4a0cb6b

Browse files
authored
quiesce test should not compare wall timestamps durations with monotonic ones (#9090)
Fixes #9089.
1 parent 4753535 commit 4a0cb6b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nexus/src/app/quiesce.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ mod test {
535535
use std::collections::BTreeSet;
536536
use std::sync::Arc;
537537
use std::time::Duration;
538+
use std::time::Instant;
538539
use tokio::sync::watch;
539540
use uuid::Uuid;
540541

@@ -571,6 +572,7 @@ mod test {
571572

572573
fn verify_quiesced(
573574
before: DateTime<Utc>,
575+
before_instant: Instant,
574576
after: DateTime<Utc>,
575577
status: QuiesceStatus,
576578
) {
@@ -598,7 +600,7 @@ mod test {
598600
assert!(duration_total >= duration_draining_sagas);
599601
assert!(duration_total >= duration_draining_db);
600602
assert!(duration_total >= duration_recording_quiesce);
601-
assert!(duration_total <= (after - before).to_std().unwrap());
603+
assert!(duration_total <= before_instant.elapsed());
602604
assert!(status.sagas.sagas_pending.is_empty());
603605
assert!(status.db_claims.is_empty());
604606
}
@@ -643,14 +645,15 @@ mod test {
643645
// If we quiesce the only Nexus while it's not doing anything, that
644646
// should complete quickly.
645647
let before = Utc::now();
648+
let before_instant = Instant::now();
646649
let _ = nexus_client
647650
.quiesce_start()
648651
.await
649652
.expect("failed to start quiesce");
650653
let rv =
651654
wait_quiesce(log, &nexus_client, Duration::from_secs(30)).await;
652655
let after = Utc::now();
653-
verify_quiesced(before, after, rv);
656+
verify_quiesced(before, before_instant, after, rv);
654657
}
655658

656659
/// Exercise non-trivial app-level quiesce in an environment with just one
@@ -694,6 +697,7 @@ mod test {
694697

695698
// Start quiescing.
696699
let before = Utc::now();
700+
let before_instant = Instant::now();
697701
let _ = nexus_client
698702
.quiesce_start()
699703
.await
@@ -801,7 +805,7 @@ mod test {
801805
let rv =
802806
wait_quiesce(log, &nexus_client, Duration::from_secs(30)).await;
803807
let after = Utc::now();
804-
verify_quiesced(before, after, rv);
808+
verify_quiesced(before, before_instant, after, rv);
805809

806810
// Just to be sure, make sure we can neither create new saga nor access
807811
// the database.

0 commit comments

Comments
 (0)