v0.3.6-pre.009-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/unit_tests/runtime.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
use ksp_job_api::JobSnapshotSource; // rust-rules: trait-import
|
||||
|
||||
@@ -78,7 +78,7 @@ async fn pre_009_terminal_snapshot_is_retained_and_late_cancellation_is_rejected
|
||||
let listener = handle.snapshots();
|
||||
let started = runtime.publisher.publish_running(crate::BackfillJobPhase::Discovering);
|
||||
assert!(started.is_ok());
|
||||
assert_eq!(runtime.control.claim_normal_terminal(), crate::TerminalClaim::Completed);
|
||||
assert_eq!(runtime.control.claim_normal_terminal(), super::TerminalClaim::Completed);
|
||||
let terminal = runtime.publisher.publish_terminal(ksp_job_api::JobState::Completed(ksp_job_api::JobCompletion::Complete), std::option::Option::None);
|
||||
assert!(terminal.is_ok());
|
||||
assert!(!handle.cancel());
|
||||
@@ -94,13 +94,13 @@ async fn pre_009_terminal_snapshot_is_retained_and_late_cancellation_is_rejected
|
||||
#[test]
|
||||
fn pre_009_terminal_race_is_first_decision_wins_for_cancellation_vs_completion() {
|
||||
let (cancel_sender, _) = tokio::sync::watch::channel(false);
|
||||
let cancellation_first = crate::BackfillRuntimeControl::new(cancel_sender);
|
||||
let cancellation_first = super::BackfillRuntimeControl::new(cancel_sender);
|
||||
assert!(cancellation_first.request_cancellation());
|
||||
assert_eq!(cancellation_first.claim_normal_terminal(), crate::TerminalClaim::Cancelled);
|
||||
assert_eq!(cancellation_first.claim_normal_terminal(), super::TerminalClaim::Cancelled);
|
||||
assert!(!cancellation_first.request_cancellation());
|
||||
let (cancel_sender, _) = tokio::sync::watch::channel(false);
|
||||
let completion_first = crate::BackfillRuntimeControl::new(cancel_sender);
|
||||
assert_eq!(completion_first.claim_normal_terminal(), crate::TerminalClaim::Completed);
|
||||
let completion_first = super::BackfillRuntimeControl::new(cancel_sender);
|
||||
assert_eq!(completion_first.claim_normal_terminal(), super::TerminalClaim::Completed);
|
||||
assert!(!completion_first.request_cancellation());
|
||||
return;
|
||||
}
|
||||
@@ -108,10 +108,10 @@ fn pre_009_terminal_race_is_first_decision_wins_for_cancellation_vs_completion()
|
||||
#[test]
|
||||
fn pre_009_fatal_failure_overrides_pending_cancellation_before_terminal_publication() {
|
||||
let (cancel_sender, _) = tokio::sync::watch::channel(false);
|
||||
let control = crate::BackfillRuntimeControl::new(cancel_sender);
|
||||
let control = super::BackfillRuntimeControl::new(cancel_sender);
|
||||
assert!(control.request_cancellation());
|
||||
control.claim_failed();
|
||||
assert_eq!(control.claim_normal_terminal(), crate::TerminalClaim::Failed);
|
||||
assert_eq!(control.claim_normal_terminal(), super::TerminalClaim::Failed);
|
||||
assert!(!control.request_cancellation());
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ fn pre_009_fatal_failure_overrides_pending_cancellation_before_terminal_publicat
|
||||
#[tokio::test]
|
||||
async fn pre_009_long_running_pre_store_future_is_cancelled_cooperatively() {
|
||||
let (cancel_sender, cancel_receiver) = tokio::sync::watch::channel(false);
|
||||
let control = crate::BackfillRuntimeControl::new(cancel_sender);
|
||||
let control = super::BackfillRuntimeControl::new(cancel_sender);
|
||||
let signal = crate::BackfillCancellationSignal::new(control.token(), cancel_receiver);
|
||||
let operation = std::future::pending::<ksp_core_lib::Result<usize>>();
|
||||
let wait = signal.run_cancellable(operation);
|
||||
|
||||
Reference in New Issue
Block a user