Documentation ¶
Index ¶
- Constants
- func MatchHeartBeatsImageMessage(expectedMsg string) cetest.EventMatcher
- type EventInfo
- type EventInfoMatcher
- type EventInfoStore
- func (ei *EventInfoStore) AssertAtLeast(min int, matchers ...EventInfoMatcher) []EventInfo
- func (ei *EventInfoStore) AssertExact(n int, matchers ...EventInfoMatcher) []EventInfo
- func (ei *EventInfoStore) AssertInRange(min int, max int, matchers ...EventInfoMatcher) []EventInfo
- func (ei *EventInfoStore) AssertNot(matchers ...EventInfoMatcher) []EventInfo
- func (ei *EventInfoStore) Cleanup()
- func (ei *EventInfoStore) Find(matchers ...EventInfoMatcher) ([]EventInfo, SearchedInfo, []error, error)
- type MinMaxResponse
- type SearchedInfo
Constants ¶
const GetEntryPath = "/entry/"
HTTP path for the GetEntry REST call
const GetMinMaxPath = "/minmax"
HTTP path for the GetMinMax REST call
const RecordEventsPort = 8392
Port for the recordevents pod REST listener
const TrimThroughPath = "/trimthrough/"
HTTP path for the TrimThrough REST call
Variables ¶
This section is empty.
Functions ¶
func MatchHeartBeatsImageMessage ¶
func MatchHeartBeatsImageMessage(expectedMsg string) cetest.EventMatcher
MatchHeartBeatsImageMessage matches that the data field of the event, in the format of the heartbeats image, contains the following msg field
Types ¶
type EventInfo ¶
type EventInfo struct { // Set if the http request received by the pod couldn't be decoded or // didn't pass validation Error string // Event received if the cloudevent received by the pod passed validation Event *cloudevents.Event // HTTPHeaders of the connection that delivered the event HTTPHeaders map[string][]string }
Structure to hold information about an event seen by recordevents pod.
type EventInfoMatcher ¶
Does the provided EventInfo match some criteria
func AllOf ¶
func AllOf(matchers ...EventInfoMatcher) EventInfoMatcher
AllOf combines matchers together
func HasAdditionalHeader ¶
func HasAdditionalHeader(key, value string) EventInfoMatcher
Convert a matcher that checks valid messages to a function that checks EventInfo structures, returning an error for any that don't contain valid events.
func MatchEvent ¶
func MatchEvent(evf ...cetest.EventMatcher) EventInfoMatcher
Convert a matcher that checks valid messages to a function that checks EventInfo structures, returning an error for any that don't contain valid events.
func NoError ¶
func NoError() EventInfoMatcher
Matcher that fails if there is an error in the EventInfo
type EventInfoStore ¶
type EventInfoStore struct {
// contains filtered or unexported fields
}
Stateful store of events received by the recordevents pod it is pointed at. This pulls events from the pod during any Find or Wait call, storing them locally and triming them from the remote pod store.
func NewEventInfoStore ¶
func NewEventInfoStore(client *testlib.Client, podName string) (*EventInfoStore, error)
Creates an EventInfoStore that is used to iteratively download events recorded by the recordevents pod. Calling this forwards the recordevents port to the local machine and blocks waiting to connect to that pod. Fails if it cannot connect within the expected timeout (4 minutes currently)
func StartEventRecordOrFail ¶
Deploys a new recordevents pod and start the associated EventInfoStore
func (*EventInfoStore) AssertAtLeast ¶
func (ei *EventInfoStore) AssertAtLeast(min int, matchers ...EventInfoMatcher) []EventInfo
Assert that there are at least min number of match for the provided matchers. This method fails the test if the assert is not fulfilled.
func (*EventInfoStore) AssertExact ¶
func (ei *EventInfoStore) AssertExact(n int, matchers ...EventInfoMatcher) []EventInfo
Assert that there are exactly n matches for the provided matchers. This method fails the test if the assert is not fulfilled.
func (*EventInfoStore) AssertInRange ¶
func (ei *EventInfoStore) AssertInRange(min int, max int, matchers ...EventInfoMatcher) []EventInfo
Assert that there are at least min number of matches and at most max number of matches for the provided matchers. This method fails the test if the assert is not fulfilled.
func (*EventInfoStore) AssertNot ¶
func (ei *EventInfoStore) AssertNot(matchers ...EventInfoMatcher) []EventInfo
Assert that there aren't any matches for the provided matchers. This method fails the test if the assert is not fulfilled.
func (*EventInfoStore) Cleanup ¶
func (ei *EventInfoStore) Cleanup()
Clean up any background resources used by the store. Must be called exactly once after the last use.
func (*EventInfoStore) Find ¶
func (ei *EventInfoStore) Find(matchers ...EventInfoMatcher) ([]EventInfo, SearchedInfo, []error, error)
Find all events received by the recordevents pod that match the provided matchers, returning all matching events as well as a SearchedInfo structure including the last 5 events seen and the total events matched. This SearchedInfo structure is primarily to ease debugging in failure printouts. The provided function is guaranteed to be called exactly once on each EventInfo from the pod. The error array contains the eventual match errors, while the last return error contains an eventual communication error while trying to get the events from the recordevents pod
type MinMaxResponse ¶
On-wire json rest api format for recordevents GetMinMax calls sennt to the recordevents pod.
type SearchedInfo ¶
This is mainly used for providing better failure messages
func (*SearchedInfo) String ¶
func (s *SearchedInfo) String() string
Pretty print the SearchedInfor for error messages