v0.3.11-pre.009-fix.001

This commit is contained in:
2026-09-08 16:48:22 +02:00
parent 822e8fcd86
commit bf6ef5b426
4 changed files with 117 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/admission.rs
// version: 3
// version: 4
fn material(
network: &str,
@@ -251,12 +251,14 @@ async fn pre_009_full_queue_dequeue_marks_source_neutral_backpressure_observatio
std::option::Option::None => return,
};
let (mut admission, sender) = crate::RawTransactionAdmission::new(1);
let ingress = crate::RawTransactionIngress { material, network, provenance, source_key: [13; 32] };
let ingress = crate::RawTransactionIngress { material, network: network.clone(), provenance, source_key: [13; 32] };
assert!(sender.send(ingress).await.is_ok());
assert!(admission.receive().await.is_some());
let first = admission.receive(&network).await;
assert!(matches!(first, std::result::Result::Ok(std::option::Option::Some(_))));
assert!(admission.take_backpressure_wait_observed());
admission.close();
assert!(admission.receive().await.is_none());
let second = admission.receive(&network).await;
assert!(matches!(second, std::result::Result::Ok(std::option::Option::None)));
assert!(!admission.take_backpressure_wait_observed());
return;
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/runtime.rs
// version: 6
// version: 7
struct ActiveTaskGuard {
active: std::sync::Arc<std::sync::atomic::AtomicUsize>,
@@ -678,13 +678,16 @@ async fn pre_009_source_failure_is_counted_and_late_stop_cannot_replace_terminal
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
let handle =
match super::start_foundation_with_source_spawner(settings, tokio::runtime::Handle::current(), move |children, _stop_receiver, _admission_sender| {
let handle = match super::start_foundation_with_source_spawner(
settings,
tokio::runtime::Handle::current(),
move |children: &mut tokio::task::JoinSet<ksp_core_lib::Result<()>>, _stop_receiver, _admission_sender| {
let _abort_handle = children.spawn(async move { std::result::Result::Err(crate::runtime_error("test.source_failed")) });
}) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
},
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
let source = handle.snapshot_source();
let terminal = match handle.wait_terminal().await {
std::result::Result::Ok(value) => value,