v0.2.9-pre.002-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/unit_tests/grpc_channel.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
fn endpoint(enabled: bool, value: &str) -> crate::YellowstoneGrpcEndpointSettings {
|
||||
let parsed = crate::YellowstoneGrpcEndpointUrl::parse(value).expect("fixture Yellowstone gRPC URL must parse");
|
||||
@@ -13,8 +13,8 @@ fn endpoint(enabled: bool, value: &str) -> crate::YellowstoneGrpcEndpointSetting
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grpc_channel_prepare_is_lazy_safe_and_keeps_tonic_private() {
|
||||
#[tokio::test(flavor = "current_thread")]
|
||||
async fn grpc_channel_prepare_is_lazy_safe_and_keeps_tonic_private() {
|
||||
let endpoint = endpoint(true, "http://127.0.0.1:10000/GRPC-SECRET-CANARY");
|
||||
let channel = crate::YellowstoneGrpcChannel::prepare(&endpoint);
|
||||
assert!(channel.is_ok());
|
||||
@@ -28,10 +28,20 @@ fn grpc_channel_prepare_is_lazy_safe_and_keeps_tonic_private() {
|
||||
let rendered = format!("{channel:?}");
|
||||
assert!(!rendered.contains("GRPC-SECRET-CANARY"));
|
||||
assert!(!rendered.contains("127.0.0.1"));
|
||||
let _channel_type = std::any::type_name_of_val(&channel.channel);
|
||||
let _channel_type = std::any::type_name_of_val(&channel._channel);
|
||||
let _wire_type = std::any::type_name::<yellowstone_grpc_proto::geyser::SubscribeRequest>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grpc_channel_prepare_requires_active_tokio_runtime_without_panicking() {
|
||||
let endpoint = endpoint(true, "http://127.0.0.1:10000/GRPC-SECRET-CANARY");
|
||||
let result = crate::YellowstoneGrpcChannel::prepare(&endpoint);
|
||||
assert!(result.is_err());
|
||||
let rendered = format!("{result:?}");
|
||||
assert!(!rendered.contains("GRPC-SECRET-CANARY"));
|
||||
assert!(!rendered.contains("127.0.0.1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grpc_channel_prepare_rejects_disabled_endpoint_before_network_io() {
|
||||
let endpoint = endpoint(false, "http://127.0.0.1:10000");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/unit_tests/grpc_settings.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
fn endpoint(name: &str, enabled: bool, url: &str, session: crate::YellowstoneGrpcSessionSettings) -> crate::YellowstoneGrpcEndpointSettings {
|
||||
let parsed = crate::YellowstoneGrpcEndpointUrl::parse(url).expect("fixture Yellowstone gRPC URL must parse");
|
||||
@@ -130,14 +130,14 @@ fn grpc_transport_settings_reject_excessive_descriptor_and_endpoint_count() {
|
||||
let parsed = crate::YellowstoneGrpcEndpointUrl::parse("http://127.0.0.1:10000").expect("fixture Yellowstone gRPC URL must parse");
|
||||
let endpoints = (0..=super::MAX_GRPC_ENDPOINT_COUNT)
|
||||
.map(|index| {
|
||||
crate::YellowstoneGrpcEndpointSettings::new(
|
||||
return crate::YellowstoneGrpcEndpointSettings::new(
|
||||
format!("endpoint-{index}"),
|
||||
true,
|
||||
crate::YellowstoneGrpcProviderName::new("fixture"),
|
||||
crate::YellowstoneGrpcClusterName::new("devnet"),
|
||||
parsed.clone(),
|
||||
crate::YellowstoneGrpcSessionSettings::default(),
|
||||
)
|
||||
);
|
||||
})
|
||||
.collect();
|
||||
assert!(crate::YellowstoneGrpcTransportSettings::new(endpoints).validate().is_err());
|
||||
|
||||
Reference in New Issue
Block a user