Documentation
¶
Overview ¶
Package streamtest provides a reusable behavioral suite for contract stream adapters. It is intended for adapter tests, not production call paths.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Verify ¶
func Verify[Send, Receive any]( t *testing.T, open OpenFunc[Send, Receive], config contract.StreamConfig, inputs []Send, echo func(Send) Receive, )
Verify runs the transport-neutral lifecycle, ordering, cancellation, slow-consumer delivery, transaction, context-firewall, terminal-error, root-cancellation, max-duration, and idle checks against a bidi adapter. It requires at least one input value and a deterministic echo mapper. The adapter is responsible for mapping the supplied handler to its test server. Exact queue blocking, process-local error causes, and remote-handler close budgets are transport-specific and should be asserted by the adapter's own tests.
Types ¶
type OpenFunc ¶
type OpenFunc[Send, Receive any] func( context.Context, contract.StreamConfig, contract.StreamHandler[Send, Receive], ) (contract.ClientStream[Send, Receive], error)
OpenFunc adapts a transport's stream opener to the conformance suite. An implementation may start a local server or test fixture before returning its ClientStream; the supplied handler defines that fixture's server behavior.