From fdcfbb09bf6af0ce295fe6fff316d7a79f72c1f8 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 25 Sep 2025 08:52:58 -0700 Subject: [PATCH 1/2] quiesce test should not compare wall timestamps durations with monotonic ones --- nexus/src/app/quiesce.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nexus/src/app/quiesce.rs b/nexus/src/app/quiesce.rs index 853425e3909..135dc76c42c 100644 --- a/nexus/src/app/quiesce.rs +++ b/nexus/src/app/quiesce.rs @@ -571,6 +571,7 @@ mod test { fn verify_quiesced( before: DateTime, + before_instant: Instant, after: DateTime, status: QuiesceStatus, ) { @@ -598,7 +599,7 @@ mod test { assert!(duration_total >= duration_draining_sagas); assert!(duration_total >= duration_draining_db); assert!(duration_total >= duration_recording_quiesce); - assert!(duration_total <= (after - before).to_std().unwrap()); + assert!(duration_total <= before_instant.elapsed()); assert!(status.sagas.sagas_pending.is_empty()); assert!(status.db_claims.is_empty()); } @@ -643,6 +644,7 @@ mod test { // If we quiesce the only Nexus while it's not doing anything, that // should complete quickly. let before = Utc::now(); + let before_instant = Instant::now(); let _ = nexus_client .quiesce_start() .await @@ -650,7 +652,7 @@ mod test { let rv = wait_quiesce(log, &nexus_client, Duration::from_secs(30)).await; let after = Utc::now(); - verify_quiesced(before, after, rv); + verify_quiesced(before, before_instant, after, rv); } /// Exercise non-trivial app-level quiesce in an environment with just one @@ -694,6 +696,7 @@ mod test { // Start quiescing. let before = Utc::now(); + let before_instant = Instant::now(); let _ = nexus_client .quiesce_start() .await @@ -801,7 +804,7 @@ mod test { let rv = wait_quiesce(log, &nexus_client, Duration::from_secs(30)).await; let after = Utc::now(); - verify_quiesced(before, after, rv); + verify_quiesced(before, before_instant, after, rv); // Just to be sure, make sure we can neither create new saga nor access // the database. From b6e0e53c2bd415344d730706d591e0a583ec67f1 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 25 Sep 2025 08:54:58 -0700 Subject: [PATCH 2/2] it should build --- nexus/src/app/quiesce.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/nexus/src/app/quiesce.rs b/nexus/src/app/quiesce.rs index 135dc76c42c..adffc9ab7a6 100644 --- a/nexus/src/app/quiesce.rs +++ b/nexus/src/app/quiesce.rs @@ -535,6 +535,7 @@ mod test { use std::collections::BTreeSet; use std::sync::Arc; use std::time::Duration; + use std::time::Instant; use tokio::sync::watch; use uuid::Uuid;