Expand description
Utilities for driving a WireframeApp
with in-memory streams during tests.
These helpers spawn the application on a tokio::io::duplex stream and
return all bytes written by the app for easy assertions. They work with any
message implementing [serde::Serialize]. The payload is encoded with
bincode::encode_to_vec using bincode::config::standard(), which means
little-endian byte order, variable-length integer encoding and no byte limit
are applied. The example uses a simple u8 value so no generics are
required.
use wireframe::app::WireframeApp;
use wireframe_testing::drive_with_bincode;
let bytes = drive_with_bincode(app, 42u8).await.unwrap();Re-exports§
pub use client_pair::WireframePair;pub use client_pair::spawn_wireframe_pair;pub use client_pair::spawn_wireframe_pair_default;pub use echo_server::ServerMode;pub use echo_server::process_frame;pub use helpers::MaxFrameLength;pub use helpers::PayloadLength;pub use helpers::TEST_MAX_FRAME;pub use helpers::TestSerializer;pub use helpers::TransactionId;pub use helpers::decode_frames;pub use helpers::decode_frames_with_codec;pub use helpers::decode_frames_with_max;pub use helpers::drive_with_bincode;pub use helpers::drive_with_codec_frames;pub use helpers::drive_with_codec_frames_with_capacity;pub use helpers::drive_with_codec_payloads;pub use helpers::drive_with_codec_payloads_mut;pub use helpers::drive_with_codec_payloads_with_capacity;pub use helpers::drive_with_codec_payloads_with_capacity_mut;pub use helpers::drive_with_frame;pub use helpers::drive_with_frame_mut;pub use helpers::drive_with_frame_with_capacity;pub use helpers::drive_with_frames;pub use helpers::drive_with_frames_mut;pub use helpers::drive_with_frames_with_capacity;pub use helpers::drive_with_payloads;pub use helpers::drive_with_payloads_mut;pub use helpers::encode_frame;pub use helpers::encode_payloads_with_codec;pub use helpers::extract_payloads;pub use helpers::mismatched_total_size_wire;pub use helpers::new_test_codec;pub use helpers::oversized_hotline_wire;pub use helpers::run_app;pub use helpers::run_with_duplex_server;pub use helpers::sequential_hotline_wire;pub use helpers::truncated_hotline_header;pub use helpers::truncated_hotline_payload;pub use helpers::valid_hotline_frame;pub use helpers::valid_hotline_wire;pub use integration_helpers::CommonHandler;pub use integration_helpers::CommonTestApp;pub use integration_helpers::CommonTestEnvelope;pub use integration_helpers::Echo;pub use integration_helpers::TestApp;pub use integration_helpers::echo_app_factory;pub use integration_helpers::echo_handler;pub use integration_helpers::factory;pub use integration_helpers::factory;pub use integration_helpers::unused_listener;pub use logging::LoggerHandle;pub use logging::logger;pub use logging::logger;pub use observability::Labels;pub use observability::ObservabilityHandle;pub use observability::obs_handle;pub use observability::obs_handle;
Modules§
- client_
pair - In-process server and client pair harness.
- echo_
server - Echo server utilities for testing client messaging with correlation IDs.
- helpers
- Helper utilities for driving
WireframeAppinstances in tests. - integration_
helpers - Shared helpers for integration testing Wireframe applications.
- logging
- Logging utilities for test infrastructure.
- macros
- Assertion macros shared by test helpers and integration tests.
- multi_
packet - Helpers for draining
Response::MultiPacketvalues in tests. - observability
- Test observability harness for capturing logs and metrics.
- reassembly
- Compatibility re-exports for
wireframe::testkit::reassembly.
Macros§
- push_
expect - Await a push future and return a contextualized error on failure.
- recv_
expect - Await a receive future and return a contextualized error on failure.
Structs§
- Slow
IoConfig - Shared configuration for slow-I/O app driving.
- Slow
IoPacing - Pacing configuration for one I/O direction.
Enums§
- Test
Error - Error type shared by
wireframe::testkithelper APIs.
Constants§
- MAX_
SLOW_ IO_ CAPACITY - Maximum duplex capacity supported by the slow-I/O helpers.
Functions§
- collect_
multi_ packet - Collect all frames from a
Response::MultiPacket. - drive_
with_ fragment_ frames - Fragment and feed through
app, returning decoded response frames. - drive_
with_ fragments - Fragment
payload, encode each fragment into a codec frame, and drive throughapp. - drive_
with_ fragments_ mut - Fragment and feed through a mutable
app. - drive_
with_ fragments_ with_ capacity - Fragment and feed with a duplex buffer of
capacitybytes. - drive_
with_ partial_ codec_ frames - Drive
appwith payloads in chunks and return decoded response frames. - drive_
with_ partial_ fragments - Fragment
payloadand feed the wire bytes in chunks ofchunk_size. - drive_
with_ partial_ frames - Drive
appwith payloads encoded bycodec, writing wire bytes in chunks. - drive_
with_ partial_ frames_ mut - Drive a mutable
appwith payloads in chunks ofchunk_size. - drive_
with_ partial_ frames_ with_ capacity - Drive
appwith payloads in chunks using a duplex buffer ofcapacity. - drive_
with_ slow_ codec_ frames - Drive
appwith codec-encoded payloads using optional slow I/O pacing and return decoded response frames. - drive_
with_ slow_ codec_ payloads - Drive
appwith codec-encoded payloads using optional slow I/O pacing. - drive_
with_ slow_ frames - Drive
appwith pre-framed bytes using optional slow writer and reader pacing. - drive_
with_ slow_ payloads - Encode payloads with the default length-delimited codec and drive
app.
Type Aliases§
- Test
Result - Shared result type for testkit helpers.