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 shared lifecycle, ordering, cancellation, backpressure, transaction, firewall, terminal-error, and close-budget checks against an 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; a transport that cannot support bidi may use focused assertions over the same public Stream contract instead.
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.