Available on crate feature
test-utils only.Expand description
Test utilities for deterministic completion-model tests.
Modules§
- observations
- Helpers for comparing deterministic observation test fixtures. These checks are not an execution-equivalence contract.
- streaming_
conformance Not ( target_os=unknownand WebAssembly) - Wire-sequence conformance scenarios for provider streaming pipelines.
Structs§
- Append
Failing Memory - Memory backend that loads empty history and always fails on append.
- Captured
Http Request - Request data captured by
RecordingHttpClient. - Counting
Memory - Memory backend that records load and append calls while delegating storage to
InMemoryConversationMemory. - Failing
Memory - Memory backend that always fails on load and no-ops append and clear.
- Http
Error Streaming Client - An
HttpClientExtimplementation whosesend_streamingfails immediately with a non-success HTTP status and response body. - Mock
Decoder - The decoder of
MockScript: each scripted step is written through the completion writer’s part handles. - Mock
Embeddings - The mock embedding runtime: every text embeds to one fixed vector, five
texts to a request at ten dimensions. It is the transport of a
Localembedding wire (Self::model). - Mock
Multi Text Document - A test document that contributes multiple text fragments to an embedding request.
- Mock
Relay - A completion handler under
labelthat relays each scripted turn as a host’s handler may: decoded by the scripted wire, its items, then the response. Each dispatch consumes one turn; a unary dispatch takes the response. - Mock
Runtime - The scripted runtime behind
MockCompletionModel: the transport of aMockScriptwire namedMOCK_PROVIDER. - Mock
Script - The scripted completion wire: its payload is the request, and each frame
is a scripted step its decoder writes through the completion writer’s
part handles, as any wire’s decoder does. A runtime that answers from a
script (
MockRuntime, or a test’s own) is its transport. - Mock
Streaming Client - A mock HTTP client that returns pre-built SSE bytes from
send_streaming. - Mock
Text Document - A test document that contributes one text fragment to an embedding request.
- Mock
Turn - A scripted non-streaming mock completion turn.
- NonSuccess
Streaming Client - An
HttpClientExtwhosesend_streaminghands a non-success reply back as anOkresponse — the fourth non-success cell: a custom transport that does not reject on status, so the driver must. - Recording
Http Client - An
HttpClientExtimplementation that records unary requests and returns a fixed response. - Sequenced
Http Client - An
HttpClientExtimplementation that records requests and returns one scripted response per request. A streamed request’s reply body arrives as one chunk. - Sequenced
Streaming Http Client - An
HttpClientExtimplementation that returns one scripted stream of byte chunks fromsend_streaming.
Enums§
- Mock
Error - Scripted error returned by
MockCompletionModel. - Mock
Frame - One step of a mock reply: a scripted event, or a whole response.
- Mock
Http Response - Response scripted for
RecordingHttpClient. - Mock
Stream Event - Scripted streaming event yielded by
MockCompletionModel.
Constants§
- MOCK_
PROVIDER - Provider descriptor name reported by the test doubles.
Functions§
- mock_
final - The end the mock model’s reply finishes with, carrying
usage. - mock_
final_ with_ total_ tokens - The end of a reply whose usage has only
total_tokensset. - scoped_
tracing_ subscriber_ guard - Serializes tests that install scoped tracing subscribers
(
tracing::subscriber::set_default/with_default). - scoped_
tracing_ subscriber_ guard_ blocking - Blocking variant of
scoped_tracing_subscriber_guardfor synchronous tests.
Type Aliases§
- Mock
Completion Model - A cloneable scripted completion model for tests: the scripted wire over its runtime. Clones share the script and the recorded requests.
- Mock
Embedding Model - A deterministic embedding model that returns a fixed vector for each input document.