v0.2.7-pre.008
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/unit_tests/ws_lifecycle.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
fn non_zero(value: u64) -> std::num::NonZeroU64 {
|
||||
return std::num::NonZeroU64::new(value).expect("test ID must be non-zero");
|
||||
@@ -45,6 +45,7 @@ fn websocket_snapshots_expose_safe_metadata_without_remote_ids_or_urls() {
|
||||
crate::WsSubscriptionKind::Slot,
|
||||
crate::WsSubscriptionState::Active,
|
||||
true,
|
||||
std::option::Option::None,
|
||||
);
|
||||
let snapshot = crate::WsSessionSnapshot::new(
|
||||
crate::WsSessionId::new(non_zero(3)),
|
||||
@@ -64,11 +65,27 @@ fn websocket_snapshots_expose_safe_metadata_without_remote_ids_or_urls() {
|
||||
assert_eq!(snapshot.continuity_gap_count(), 1);
|
||||
assert_eq!(snapshot.subscription_count(), 1);
|
||||
assert!(snapshot.subscriptions()[0].remote_bound());
|
||||
assert_eq!(snapshot.subscriptions()[0].terminal_error_code(), std::option::Option::None);
|
||||
assert_eq!(snapshot.overflow_count(), 0);
|
||||
let rendered = format!("{snapshot:?}");
|
||||
assert!(!rendered.contains("wss://"));
|
||||
assert!(!rendered.contains("remote_subscription_id"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn websocket_subscription_snapshot_preserves_only_safe_terminal_error_code() {
|
||||
let snapshot = crate::WsSubscriptionSnapshot::new(
|
||||
crate::WsSubscriptionId::new(non_zero(10)),
|
||||
crate::WsSubscriptionKind::Logs,
|
||||
crate::WsSubscriptionState::Failed,
|
||||
false,
|
||||
std::option::Option::Some(crate::ERROR_CODE_WS_BACKPRESSURE_OVERFLOW),
|
||||
);
|
||||
assert_eq!(snapshot.state(), crate::WsSubscriptionState::Failed);
|
||||
assert_eq!(snapshot.terminal_error_code(), std::option::Option::Some(crate::ERROR_CODE_WS_BACKPRESSURE_OVERFLOW));
|
||||
assert!(!format!("{snapshot:?}").contains("remote_subscription_id"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn websocket_subscription_kinds_map_exact_standard_method_triplets() {
|
||||
let cases = [
|
||||
|
||||
Reference in New Issue
Block a user