v0.3.12-pre.008
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/runtime_resources.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
fn grpc_endpoint(cluster: &str) -> std::option::Option<ksp_onchain_transport_lib::YellowstoneGrpcEndpointSettings> {
|
||||
return grpc_endpoint_with_identity(cluster, "yellowstone-fixture", "fixture-provider");
|
||||
@@ -1370,3 +1370,45 @@ fn pre_007_processing_frontier_compacts_settled_slots_to_pending_intervals() {
|
||||
assert_eq!(projection.processing_frontier_slot(), std::option::Option::Some(9));
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_008_reconnect_replay_and_proven_gap_are_distinct_monotone_and_frontier_preserving() {
|
||||
let (sender, receiver) = tokio::sync::watch::channel(crate::RawTransactionIngestProcessingFrontierProjection::empty());
|
||||
let mut reporter = super::RawTransactionIngestProcessingFrontierReporter::new(sender);
|
||||
assert!(reporter.observe_pending(42).is_ok());
|
||||
assert!(reporter.observe_source_continuity(crate::RawTransactionIngestSourceState::Reconnecting, 0, 1, 0).is_ok());
|
||||
let replaying = *receiver.borrow();
|
||||
assert_eq!(replaying.hydration_pending(), 1);
|
||||
assert_eq!(replaying.oldest_pending_slot(), std::option::Option::Some(42));
|
||||
assert_eq!(replaying.source_state(), std::option::Option::Some(crate::RawTransactionIngestSourceState::Reconnecting));
|
||||
assert_eq!(replaying.source_reconnect_total(), 0);
|
||||
assert_eq!(replaying.source_replay_attempt_total(), 1);
|
||||
assert_eq!(replaying.source_continuity_gap_total(), 0);
|
||||
assert!(reporter.observe_source_continuity(crate::RawTransactionIngestSourceState::Active, 1, 1, 0).is_ok());
|
||||
let gap = reporter.observe_source_continuity(crate::RawTransactionIngestSourceState::Reconnecting, 1, 2, 1);
|
||||
assert!(gap.is_err());
|
||||
let gap = match gap {
|
||||
std::result::Result::Ok(()) => return,
|
||||
std::result::Result::Err(value) => value,
|
||||
};
|
||||
assert_eq!(gap.code(), crate::ERROR_CODE_RAW_TRANSACTION_INGEST_RUNTIME_INVALID);
|
||||
assert!(gap.context().iter().any(|context| {
|
||||
return context.value() == "source.continuity_gap_proven";
|
||||
}));
|
||||
let proven = *receiver.borrow();
|
||||
assert_eq!(proven.hydration_pending(), 1);
|
||||
assert_eq!(proven.oldest_pending_slot(), std::option::Option::Some(42));
|
||||
assert_eq!(proven.source_reconnect_total(), 1);
|
||||
assert_eq!(proven.source_replay_attempt_total(), 2);
|
||||
assert_eq!(proven.source_continuity_gap_total(), 1);
|
||||
let regression = reporter.observe_source_continuity(crate::RawTransactionIngestSourceState::Active, 0, 2, 1);
|
||||
assert!(regression.is_err());
|
||||
let regression = match regression {
|
||||
std::result::Result::Ok(()) => return,
|
||||
std::result::Result::Err(value) => value,
|
||||
};
|
||||
assert!(regression.context().iter().any(|context| {
|
||||
return context.value() == "source.continuity_counter_regression";
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user