Crate rapace_testkit

Crate rapace_testkit 

Source
Expand description

rapace-testkit: Conformance test suite for rapace transports.

Provides TransportFactory trait and shared test scenarios that all transports must pass.

§Usage

Each transport crate implements TransportFactory and runs the shared tests:

use rapace_testkit::{TransportFactory, TestError};

struct MyTransportFactory;

impl TransportFactory for MyTransportFactory {
    type Transport = MyTransport;

    fn connect_pair() -> impl Future<Output = Result<(Self::Transport, Self::Transport), TestError>> + Send {
        async { /* create connected pair */ }
    }
}

#[tokio::test]
async fn my_transport_unary_happy_path() {
    rapace_testkit::run_unary_happy_path::<MyTransportFactory>().await;
}

Modules§

bidirectional
Bidirectional RPC test harness.
helper_binary
Helper binary management for cross-process tests.

Structs§

AdderClient
Client stub for the #trait_name service.
AdderImpl
Implementation of the Adder service for testing.
AdderRegistryClient
Registry-aware client stub for the #trait_name service.
AdderServer
Server dispatcher for the #trait_name service.
LargeBlobServiceClient
Client stub for the #trait_name service.
LargeBlobServiceImpl
Implementation of LargeBlobService for testing.
LargeBlobServiceRegistryClient
Registry-aware client stub for the #trait_name service.
LargeBlobServiceServer
Server dispatcher for the #trait_name service.
RangeServiceClient
Client stub for the #trait_name service.
RangeServiceImpl
Implementation of the RangeService for testing.
RangeServiceRegistryClient
Registry-aware client stub for the #trait_name service.
RangeServiceServer
Server dispatcher for the #trait_name service.

Enums§

TestError
Error type for test scenarios.

Constants§

ADDER_METHOD_ID_ADD
LARGE_BLOB_SERVICE_METHOD_ID_CHECKSUM
LARGE_BLOB_SERVICE_METHOD_ID_ECHO
LARGE_BLOB_SERVICE_METHOD_ID_XOR_TRANSFORM
RANGE_SERVICE_METHOD_ID_RANGE

Traits§

Adder
Simple arithmetic service used for testing.
LargeBlobService
Service that processes large byte payloads.
RangeService
Service with server-streaming RPC for testing.
TransportFactory
Factory trait for creating transport pairs for testing.

Functions§

adder_register
Register this service with a registry.
large_blob_service_register
Register this service with a registry.
range_service_register
Register this service with a registry.
run_bidirectional_streaming
Test bidirectional streaming: both sides send multiple items.
run_cancellation
Test that cancellation frames are correctly transmitted.
run_client_streaming_happy_path
Test client-streaming: client sends N items + EOS, server sends single response.
run_credit_grant
Test that credit grants are correctly transmitted.
run_deadline_exceeded
Test that requests with expired deadlines fail with DeadlineExceeded.
run_deadline_success
Test that requests with generous deadlines succeed.
run_error_response
Test that error responses are correctly transmitted.
run_large_blob_checksum
Test large blob checksum (verifies both directions work for different sizes).
run_large_blob_echo
Test that large blobs are correctly echoed back.
run_large_blob_transform
Test large blob transformation.
run_macro_server_streaming
Test server-streaming using the macro-generated client and server.
run_ping_pong
Test PING/PONG round-trip on control channel.
run_server_streaming_happy_path
Test server-streaming: client sends request, server sends N responses + EOS.
run_session_cancel_control_frame
Test that Session processes CANCEL control frames and filters subsequent frames.
run_session_cancelled_channel_drop
Test that Session silently drops frames for cancelled channels.
run_session_credit_exhaustion
Test that Session enforces credit limits on data channels.
run_session_deadline_check
Test Session deadline checking.
run_session_grant_credits_control_frame
Test that Session processes GRANT_CREDITS control frames.
run_streaming_cancellation
Test streaming with cancellation mid-stream.
run_unary_happy_path
Run a single unary RPC call and verify the result.
run_unary_multiple_calls
Run multiple unary RPC calls sequentially.