@@ -535,6 +535,7 @@ mod test {
535
535
use std:: collections:: BTreeSet ;
536
536
use std:: sync:: Arc ;
537
537
use std:: time:: Duration ;
538
+ use std:: time:: Instant ;
538
539
use tokio:: sync:: watch;
539
540
use uuid:: Uuid ;
540
541
@@ -571,6 +572,7 @@ mod test {
571
572
572
573
fn verify_quiesced (
573
574
before : DateTime < Utc > ,
575
+ before_instant : Instant ,
574
576
after : DateTime < Utc > ,
575
577
status : QuiesceStatus ,
576
578
) {
@@ -598,7 +600,7 @@ mod test {
598
600
assert ! ( duration_total >= duration_draining_sagas) ;
599
601
assert ! ( duration_total >= duration_draining_db) ;
600
602
assert ! ( duration_total >= duration_recording_quiesce) ;
601
- assert ! ( duration_total <= ( after - before ) . to_std ( ) . unwrap ( ) ) ;
603
+ assert ! ( duration_total <= before_instant . elapsed ( ) ) ;
602
604
assert ! ( status. sagas. sagas_pending. is_empty( ) ) ;
603
605
assert ! ( status. db_claims. is_empty( ) ) ;
604
606
}
@@ -643,14 +645,15 @@ mod test {
643
645
// If we quiesce the only Nexus while it's not doing anything, that
644
646
// should complete quickly.
645
647
let before = Utc :: now ( ) ;
648
+ let before_instant = Instant :: now ( ) ;
646
649
let _ = nexus_client
647
650
. quiesce_start ( )
648
651
. await
649
652
. expect ( "failed to start quiesce" ) ;
650
653
let rv =
651
654
wait_quiesce ( log, & nexus_client, Duration :: from_secs ( 30 ) ) . await ;
652
655
let after = Utc :: now ( ) ;
653
- verify_quiesced ( before, after, rv) ;
656
+ verify_quiesced ( before, before_instant , after, rv) ;
654
657
}
655
658
656
659
/// Exercise non-trivial app-level quiesce in an environment with just one
@@ -694,6 +697,7 @@ mod test {
694
697
695
698
// Start quiescing.
696
699
let before = Utc :: now ( ) ;
700
+ let before_instant = Instant :: now ( ) ;
697
701
let _ = nexus_client
698
702
. quiesce_start ( )
699
703
. await
@@ -801,7 +805,7 @@ mod test {
801
805
let rv =
802
806
wait_quiesce ( log, & nexus_client, Duration :: from_secs ( 30 ) ) . await ;
803
807
let after = Utc :: now ( ) ;
804
- verify_quiesced ( before, after, rv) ;
808
+ verify_quiesced ( before, before_instant , after, rv) ;
805
809
806
810
// Just to be sure, make sure we can neither create new saga nor access
807
811
// the database.
0 commit comments