Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions nexus/src/app/quiesce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -571,6 +572,7 @@ mod test {

fn verify_quiesced(
before: DateTime<Utc>,
before_instant: Instant,
after: DateTime<Utc>,
status: QuiesceStatus,
) {
Expand Down Expand Up @@ -598,7 +600,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());
}
Expand Down Expand Up @@ -643,14 +645,15 @@ 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
.expect("failed to start quiesce");
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
Expand Down Expand Up @@ -694,6 +697,7 @@ mod test {

// Start quiescing.
let before = Utc::now();
let before_instant = Instant::now();
let _ = nexus_client
.quiesce_start()
.await
Expand Down Expand Up @@ -801,7 +805,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.
Expand Down
Loading