Documentation
¶
Overview ¶
Package probe contains a transport-agnostic contract and a matcher for checking outbound messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
MatchedCount int `json:"matched_count"`
ObservedMessages []Message `json:"observed_messages"`
LastMismatchReason string `json:"last_mismatch_reason"`
}
CheckResult contains the result of comparing the observed messages with the expectations contract.
func EvaluateAwait ¶
func EvaluateAwait(expectation OutboundExpectation, observed []Message, windowExpired bool) (CheckResult, error)
EvaluateAwait checks the intermediate state of the await step.
func EvaluateVerify ¶
func EvaluateVerify(expectation OutboundExpectation, observed []Message) (CheckResult, error)
EvaluateVerify checks the final state of the verify step.
type HeadersMode ¶
type HeadersMode string
HeadersMode defines the message header comparison strategy.
const ( // HeadersModeExact requires a complete match of the set of headers. HeadersModeExact HeadersMode = "exact" // HeadersModeSubset requires only the expected subset of headers to match. HeadersModeSubset HeadersMode = "subset" )
type Message ¶
type Message struct {
Topic string `json:"topic"`
Key *string `json:"key,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
Offset int64 `json:"offset"`
}
Message represents the broker's observable message in transport-agnostic form.
type OutboundExpectation ¶
type OutboundExpectation struct {
Topic string `json:"topic"`
Key *string `json:"key,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
HeadersMode HeadersMode `json:"headers_mode,omitempty"`
ExpectedCount int `json:"expected_count"`
Payload json.RawMessage `json:"payload,omitempty"`
PayloadSubset json.RawMessage `json:"payload_subset,omitempty"`
Ordering Ordering `json:"ordering,omitempty"`
}
OutboundExpectation describes the expectations contract for checking an outgoing publication.
func NormalizeExpectation ¶
func NormalizeExpectation(expectation OutboundExpectation) (OutboundExpectation, error)
NormalizeExpectation validates the contract and applies default values.
Click to show internal directories.
Click to hide internal directories.