Documentation ¶
Overview ¶
assert contains the necessary matchers and steps to perform assertions on eventshub contents
Index ¶
- Constants
- func Any() eventshub.EventInfoMatcher
- func HasAdditionalHeader(key, value string) eventshub.EventInfoMatcher
- func MatchEvent(evf ...cetest.EventMatcher) eventshub.EventInfoMatcher
- func MatchHeartBeatsImageMessage(expectedMsg string) cetest.EventMatcher
- func MatchKind(kind eventshub.EventKind) eventshub.EventInfoMatcher
- func MatchOIDCUser(username string) eventshub.EventInfoMatcher
- func MatchOIDCUserFromResource(gvr schema.GroupVersionResource, resourceName string) eventshub.EventInfoMatcherCtx
- func MatchPeerCertificatesFromSecret(namespace, name string, key string) eventshub.EventInfoMatcherCtx
- func MatchStatusCode(statusCode int) eventshub.EventInfoMatcher
- func NoError() eventshub.EventInfoMatcher
- func OneOf(matchers ...eventshub.EventInfoMatcher) eventshub.EventInfoMatcher
- type MatchAssertionBuilder
- func (m MatchAssertionBuilder) AtLeast(min int) feature.StepFn
- func (m MatchAssertionBuilder) Exact(n int) feature.StepFn
- func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn
- func (m MatchAssertionBuilder) Match(matchers ...eventshub.EventInfoMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchPeerCertificatesReceived(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchReceivedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchRejectedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchResponseEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchSentEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
- func (m MatchAssertionBuilder) MatchWithContext(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder
- func (m MatchAssertionBuilder) Not() feature.StepFn
Constants ¶
const ( EventReceived = eventshub.EventReceived EventRejected = eventshub.EventRejected EventSent = eventshub.EventSent EventResponse = eventshub.EventResponse )
Reexport kinds here to simplify the usage
Variables ¶
This section is empty.
Functions ¶
func HasAdditionalHeader ¶
func HasAdditionalHeader(key, value string) eventshub.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) eventshub.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 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
func MatchKind ¶
func MatchKind(kind eventshub.EventKind) eventshub.EventInfoMatcher
MatchKind matches the kind of EventInfo
func MatchOIDCUser ¶
func MatchOIDCUser(username string) eventshub.EventInfoMatcher
MatchOIDCUser matches the OIDC username used for the request
func MatchOIDCUserFromResource ¶
func MatchOIDCUserFromResource(gvr schema.GroupVersionResource, resourceName string) eventshub.EventInfoMatcherCtx
MatchOIDCUserFromResource matches the given resources OIDC identifier
func MatchPeerCertificatesFromSecret ¶
func MatchPeerCertificatesFromSecret(namespace, name string, key string) eventshub.EventInfoMatcherCtx
func MatchStatusCode ¶
func MatchStatusCode(statusCode int) eventshub.EventInfoMatcher
MatchStatusCode matches the status code of EventInfo
func NoError ¶
func NoError() eventshub.EventInfoMatcher
Matcher that fails if there is an error in the EventInfo
func OneOf ¶
func OneOf(matchers ...eventshub.EventInfoMatcher) eventshub.EventInfoMatcher
Types ¶
type MatchAssertionBuilder ¶
type MatchAssertionBuilder struct {
// contains filtered or unexported fields
}
func OnStore ¶
func OnStore(name string) MatchAssertionBuilder
OnStore creates an assertion builder starting from the name of the store
func (MatchAssertionBuilder) AtLeast ¶
func (m MatchAssertionBuilder) AtLeast(min int) feature.StepFn
AtLeast builds the assertion feature.StepFn OnStore(store).Match(matchers).AtLeast(min) is equivalent to StoreFromContext(ctx, store).AssertAtLeast(min, matchers)
func (MatchAssertionBuilder) Exact ¶
func (m MatchAssertionBuilder) Exact(n int) feature.StepFn
Exact builds the assertion feature.StepFn OnStore(store).Match(matchers).Exact(n) is equivalent to StoreFromContext(ctx, store).AssertExact(n, matchers)
func (MatchAssertionBuilder) InRange ¶
func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn
InRange builds the assertion feature.StepFn OnStore(store).Match(matchers).InRange(min, max) is equivalent to StoreFromContext(ctx, store).AssertInRange(min, max, matchers)
func (MatchAssertionBuilder) Match ¶
func (m MatchAssertionBuilder) Match(matchers ...eventshub.EventInfoMatcher) MatchAssertionBuilder
Match adds the provided matchers in this builder
func (MatchAssertionBuilder) MatchEvent ¶
func (m MatchAssertionBuilder) MatchEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
MatchEvent is a shortcut for Match(MatchEvent(), OneOf(MatchKind(eventshub.EventReceived), MatchKind(eventshub.EventSent)))
func (MatchAssertionBuilder) MatchPeerCertificatesReceived ¶
func (m MatchAssertionBuilder) MatchPeerCertificatesReceived(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder
MatchPeerCertificates adds the provided matchers in this builder
func (MatchAssertionBuilder) MatchReceivedEvent ¶
func (m MatchAssertionBuilder) MatchReceivedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
MatchReceivedEvent is a shortcut for Match(MatchKind(eventshub.EventReceived), MatchEvent(matchers...))
func (MatchAssertionBuilder) MatchRejectedEvent ¶
func (m MatchAssertionBuilder) MatchRejectedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
MatchRejectedEvent is a shortcut for Match(MatchKind(eventshub.EventRejected), MatchEvent(matchers...))
func (MatchAssertionBuilder) MatchResponseEvent ¶
func (m MatchAssertionBuilder) MatchResponseEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
MatchResponseEvent is a shortcut for Match(MatchKind(eventshub.EventResponse), MatchEvent(matchers...))
func (MatchAssertionBuilder) MatchSentEvent ¶
func (m MatchAssertionBuilder) MatchSentEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder
MatchSentEvent is a shortcut for Match(MatchKind(eventshub.EventSent), MatchEvent(matchers...))
func (MatchAssertionBuilder) MatchWithContext ¶
func (m MatchAssertionBuilder) MatchWithContext(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder
MatchWithContext adds the provided matchers in this builder
func (MatchAssertionBuilder) Not ¶
func (m MatchAssertionBuilder) Not() feature.StepFn
Not builds the assertion feature.StepFn OnStore(store).Match(matchers).Not() is equivalent to StoreFromContext(ctx, store).AssertNot(matchers)