Documentation
¶
Index ¶
- type AsynchronousConsumer
- type AsynchronousMessage
- type AsynchronousMessageBuilder
- func (m *AsynchronousMessageBuilder) ExpectsToReceive(description string) *UnconfiguredAsynchronousMessageBuilder
- func (m *AsynchronousMessageBuilder) Given(state string) *AsynchronousMessageBuilder
- func (m *AsynchronousMessageBuilder) GivenWithParameter(state models.ProviderState) *AsynchronousMessageBuilder
- type AsynchronousMessageWithConsumer
- type AsynchronousMessageWithContents
- type AsynchronousMessageWithPlugin
- type AsynchronousMessageWithPluginContents
- type AsynchronousMessageWithTransport
- type AsynchronousPact
- type Config
- type MessageContents
- type Metadata
- type PluginConfig
- type RequestBuilderFunc
- type ResponseBuilderFunc
- type SynchronousMessage
- type SynchronousMessageBuilder
- type SynchronousMessageWithPlugin
- type SynchronousMessageWithPluginContents
- type SynchronousMessageWithRequest
- type SynchronousMessageWithRequestBuilder
- func (m *SynchronousMessageWithRequestBuilder) WithContent(contentType string, body []byte) *SynchronousMessageWithRequestBuilder
- func (m *SynchronousMessageWithRequestBuilder) WithJSONContent(content interface{}) *SynchronousMessageWithRequestBuilder
- func (m *SynchronousMessageWithRequestBuilder) WithMetadata(metadata map[string]string) *SynchronousMessageWithRequestBuilder
- type SynchronousMessageWithResponse
- type SynchronousMessageWithResponseBuilder
- func (m *SynchronousMessageWithResponseBuilder) WithContent(contentType string, body []byte) *SynchronousMessageWithResponseBuilder
- func (m *SynchronousMessageWithResponseBuilder) WithJSONContent(content interface{}) *SynchronousMessageWithResponseBuilder
- func (m *SynchronousMessageWithResponseBuilder) WithMetadata(metadata map[string]string) *SynchronousMessageWithResponseBuilder
- type SynchronousMessageWithTransport
- type SynchronousPact
- type TransportConfig
- type UnconfiguredAsynchronousMessageBuilder
- func (m *UnconfiguredAsynchronousMessageBuilder) UsingPlugin(config PluginConfig) *AsynchronousMessageWithPlugin
- func (m *UnconfiguredAsynchronousMessageBuilder) WithContent(contentType string, body []byte) *AsynchronousMessageWithContents
- func (m *UnconfiguredAsynchronousMessageBuilder) WithJSONContent(content interface{}) *AsynchronousMessageWithContents
- func (m *UnconfiguredAsynchronousMessageBuilder) WithMetadata(metadata map[string]string) *UnconfiguredAsynchronousMessageBuilder
- type UnconfiguredSynchronousMessageBuilder
- func (m *UnconfiguredSynchronousMessageBuilder) Given(state string) *UnconfiguredSynchronousMessageBuilder
- func (m *UnconfiguredSynchronousMessageBuilder) GivenWithParameter(state models.ProviderState) *UnconfiguredSynchronousMessageBuilder
- func (m *UnconfiguredSynchronousMessageBuilder) UsingPlugin(config PluginConfig) *SynchronousMessageWithPlugin
- func (m *UnconfiguredSynchronousMessageBuilder) WithRequest(r RequestBuilderFunc) *SynchronousMessageWithRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsynchronousConsumer ¶
type AsynchronousConsumer func(AsynchronousMessage) error
AsynchronousConsumer receives a message and must be able to parse the content
type AsynchronousMessage ¶
type AsynchronousMessage MessageContents
AsynchronousMessage is a representation of a single, unidirectional message e.g. MQ, pub/sub, Websocket, Lambda AsynchronousMessage is the main implementation of the Pact AsynchronousMessage interface.
type AsynchronousMessageBuilder ¶
type AsynchronousMessageBuilder struct { // Type to Marshal content into when sending back to the consumer // Defaults to interface{} Type interface{} // contains filtered or unexported fields }
func (*AsynchronousMessageBuilder) ExpectsToReceive ¶
func (m *AsynchronousMessageBuilder) ExpectsToReceive(description string) *UnconfiguredAsynchronousMessageBuilder
ExpectsToReceive specifies the content it is expecting to be given from the Provider. The function must be able to handle this message for the interaction to succeed.
func (*AsynchronousMessageBuilder) Given ¶
func (m *AsynchronousMessageBuilder) Given(state string) *AsynchronousMessageBuilder
Given specifies a provider state. Optional.
func (*AsynchronousMessageBuilder) GivenWithParameter ¶
func (m *AsynchronousMessageBuilder) GivenWithParameter(state models.ProviderState) *AsynchronousMessageBuilder
Given specifies a provider state. Optional.
type AsynchronousMessageWithConsumer ¶
type AsynchronousMessageWithConsumer struct {
// contains filtered or unexported fields
}
type AsynchronousMessageWithContents ¶
type AsynchronousMessageWithContents struct {
// contains filtered or unexported fields
}
func (*AsynchronousMessageWithContents) AsType ¶
func (m *AsynchronousMessageWithContents) AsType(t interface{}) *AsynchronousMessageWithContents
AsType specifies that the content sent through to the consumer handler should be sent as the given type
func (*AsynchronousMessageWithContents) ConsumedBy ¶
func (m *AsynchronousMessageWithContents) ConsumedBy(handler AsynchronousConsumer) *AsynchronousMessageWithConsumer
The function that will consume the message
type AsynchronousMessageWithPlugin ¶
type AsynchronousMessageWithPlugin struct {
// contains filtered or unexported fields
}
func (*AsynchronousMessageWithPlugin) WithContents ¶
func (s *AsynchronousMessageWithPlugin) WithContents(contents string, contentType string) *AsynchronousMessageWithPluginContents
type AsynchronousMessageWithPluginContents ¶
type AsynchronousMessageWithPluginContents struct {
// contains filtered or unexported fields
}
func (*AsynchronousMessageWithPluginContents) ExecuteTest ¶
func (s *AsynchronousMessageWithPluginContents) ExecuteTest(t *testing.T, integrationTest func(m AsynchronousMessage) error) error
func (*AsynchronousMessageWithPluginContents) StartTransport ¶
func (s *AsynchronousMessageWithPluginContents) StartTransport(transport string, address string, config map[string][]interface{}) *AsynchronousMessageWithTransport
type AsynchronousMessageWithTransport ¶
type AsynchronousMessageWithTransport struct {
// contains filtered or unexported fields
}
func (*AsynchronousMessageWithTransport) ExecuteTest ¶
func (s *AsynchronousMessageWithTransport) ExecuteTest(t *testing.T, integrationTest func(tc TransportConfig, m AsynchronousMessage) error) error
type AsynchronousPact ¶
type AsynchronousPact struct {
// contains filtered or unexported fields
}
func NewAsynchronousPact ¶
func NewAsynchronousPact(config Config) (*AsynchronousPact, error)
func (*AsynchronousPact) AddAsynchronousMessage ¶
func (p *AsynchronousPact) AddAsynchronousMessage() *AsynchronousMessageBuilder
AddMessage creates a new asynchronous consumer expectation
func (*AsynchronousPact) AddMessage ¶
func (p *AsynchronousPact) AddMessage() *AsynchronousMessageBuilder
AddMessage creates a new asynchronous consumer expectation Deprecated: use AddAsynchronousMessage() instead
func (*AsynchronousPact) Verify ¶
func (p *AsynchronousPact) Verify(t *testing.T, message *AsynchronousMessageBuilder, handler AsynchronousConsumer) error
VerifyMessageConsumer is a test convience function for VerifyMessageConsumerRaw, accepting an instance of `*testing.T`
type MessageContents ¶
type MessageContents struct { // Message Body Contents []byte // Body is the attempt to reify the message body back into a specified type // Not populated for synchronous messages Body interface{} `json:"contents"` }
V3 Message (Asynchronous only)
type PluginConfig ¶
type RequestBuilderFunc ¶
type RequestBuilderFunc func(*SynchronousMessageWithRequestBuilder)
type ResponseBuilderFunc ¶
type ResponseBuilderFunc func(*SynchronousMessageWithResponseBuilder)
type SynchronousMessage ¶
type SynchronousMessage struct { // TODO: should we pass this in? Probably need to be able to reify the message // in these cases Request MessageContents // Currently only support a single response, but support may be added for multiple // responses to be given in the future Response []MessageContents }
SynchronousMessage contains a req/res message It is currently an empty struct to allow future expansion
type SynchronousMessageBuilder ¶
type SynchronousMessageBuilder struct { }
SynchronousMessageBuilder is a representation of a single, bidirectional message
type SynchronousMessageWithPlugin ¶
type SynchronousMessageWithPlugin struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithPlugin) UsingPlugin ¶
func (m *SynchronousMessageWithPlugin) UsingPlugin(config PluginConfig) *SynchronousMessageWithPlugin
UsingPlugin enables a plugin for use in the current test case
func (*SynchronousMessageWithPlugin) WithContents ¶
func (s *SynchronousMessageWithPlugin) WithContents(contents string, contentType string) *SynchronousMessageWithPluginContents
type SynchronousMessageWithPluginContents ¶
type SynchronousMessageWithPluginContents struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithPluginContents) ExecuteTest ¶
func (m *SynchronousMessageWithPluginContents) ExecuteTest(t *testing.T, integrationTest func(m SynchronousMessage) error) error
ExecuteTest runs the current test case against a Mock Service. Will cleanup interactions between tests within a suite and write the pact file if successful
func (*SynchronousMessageWithPluginContents) StartTransport ¶
func (s *SynchronousMessageWithPluginContents) StartTransport(transport string, address string, config map[string][]interface{}) *SynchronousMessageWithTransport
type SynchronousMessageWithRequest ¶
type SynchronousMessageWithRequest struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithRequest) WithResponse ¶
func (m *SynchronousMessageWithRequest) WithResponse(builder ResponseBuilderFunc) *SynchronousMessageWithResponse
AddMessage creates a new asynchronous consumer expectation
type SynchronousMessageWithRequestBuilder ¶
type SynchronousMessageWithRequestBuilder struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithRequestBuilder) WithContent ¶
func (m *SynchronousMessageWithRequestBuilder) WithContent(contentType string, body []byte) *SynchronousMessageWithRequestBuilder
WithContent specifies the payload in bytes that the consumer expects to receive
func (*SynchronousMessageWithRequestBuilder) WithJSONContent ¶
func (m *SynchronousMessageWithRequestBuilder) WithJSONContent(content interface{}) *SynchronousMessageWithRequestBuilder
WithJSONContent specifies the payload as an object (to be marshalled to WithJSONContent) that is expected to be consumed
func (*SynchronousMessageWithRequestBuilder) WithMetadata ¶
func (m *SynchronousMessageWithRequestBuilder) WithMetadata(metadata map[string]string) *SynchronousMessageWithRequestBuilder
WithMetadata specifies message-implementation specific metadata to go with the content func (m *Message) WithMetadata(metadata MapMatcher) *Message {
type SynchronousMessageWithResponse ¶
type SynchronousMessageWithResponse struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithResponse) ExecuteTest ¶
func (m *SynchronousMessageWithResponse) ExecuteTest(t *testing.T, integrationTest func(md SynchronousMessage) error) error
ExecuteTest runs the current test case against a Mock Service. Will cleanup interactions between tests within a suite and write the pact file if successful
type SynchronousMessageWithResponseBuilder ¶
type SynchronousMessageWithResponseBuilder struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithResponseBuilder) WithContent ¶
func (m *SynchronousMessageWithResponseBuilder) WithContent(contentType string, body []byte) *SynchronousMessageWithResponseBuilder
WithContent specifies the payload in bytes that the consumer expects to receive May be called multiple times, with each call appeding a new response to the interaction
func (*SynchronousMessageWithResponseBuilder) WithJSONContent ¶
func (m *SynchronousMessageWithResponseBuilder) WithJSONContent(content interface{}) *SynchronousMessageWithResponseBuilder
WithJSONContent specifies the payload as an object (to be marshalled to WithJSONContent) that is expected to be consumed
func (*SynchronousMessageWithResponseBuilder) WithMetadata ¶
func (m *SynchronousMessageWithResponseBuilder) WithMetadata(metadata map[string]string) *SynchronousMessageWithResponseBuilder
WithMetadata specifies message-implementation specific metadata to go with the content func (m *Message) WithMetadata(metadata MapMatcher) *Message {
type SynchronousMessageWithTransport ¶
type SynchronousMessageWithTransport struct {
// contains filtered or unexported fields
}
func (*SynchronousMessageWithTransport) ExecuteTest ¶
func (s *SynchronousMessageWithTransport) ExecuteTest(t *testing.T, integrationTest func(tc TransportConfig, m SynchronousMessage) error) error
type SynchronousPact ¶
type SynchronousPact struct {
// contains filtered or unexported fields
}
func NewSynchronousPact ¶
func NewSynchronousPact(config Config) (*SynchronousPact, error)
func (*SynchronousPact) AddSynchronousMessage ¶
func (m *SynchronousPact) AddSynchronousMessage(description string) *UnconfiguredSynchronousMessageBuilder
type TransportConfig ¶
type UnconfiguredAsynchronousMessageBuilder ¶
type UnconfiguredAsynchronousMessageBuilder struct {
// contains filtered or unexported fields
}
func (*UnconfiguredAsynchronousMessageBuilder) UsingPlugin ¶
func (m *UnconfiguredAsynchronousMessageBuilder) UsingPlugin(config PluginConfig) *AsynchronousMessageWithPlugin
UsingPlugin enables a plugin for use in the current test case
func (*UnconfiguredAsynchronousMessageBuilder) WithContent ¶
func (m *UnconfiguredAsynchronousMessageBuilder) WithContent(contentType string, body []byte) *AsynchronousMessageWithContents
WithContent specifies the payload in bytes that the consumer expects to receive
func (*UnconfiguredAsynchronousMessageBuilder) WithJSONContent ¶
func (m *UnconfiguredAsynchronousMessageBuilder) WithJSONContent(content interface{}) *AsynchronousMessageWithContents
WithJSONContent specifies the payload as an object (to be marshalled to WithJSONContent) that is expected to be consumed
func (*UnconfiguredAsynchronousMessageBuilder) WithMetadata ¶
func (m *UnconfiguredAsynchronousMessageBuilder) WithMetadata(metadata map[string]string) *UnconfiguredAsynchronousMessageBuilder
WithMetadata specifies message-implementation specific metadata to go with the content func (m *Message) WithMetadata(metadata MapMatcher) *Message {
type UnconfiguredSynchronousMessageBuilder ¶
type UnconfiguredSynchronousMessageBuilder struct {
// contains filtered or unexported fields
}
func (*UnconfiguredSynchronousMessageBuilder) Given ¶
func (m *UnconfiguredSynchronousMessageBuilder) Given(state string) *UnconfiguredSynchronousMessageBuilder
Given specifies a provider state
func (*UnconfiguredSynchronousMessageBuilder) GivenWithParameter ¶
func (m *UnconfiguredSynchronousMessageBuilder) GivenWithParameter(state models.ProviderState) *UnconfiguredSynchronousMessageBuilder
Given specifies a provider state
func (*UnconfiguredSynchronousMessageBuilder) UsingPlugin ¶
func (m *UnconfiguredSynchronousMessageBuilder) UsingPlugin(config PluginConfig) *SynchronousMessageWithPlugin
UsingPlugin enables a plugin for use in the current test case
func (*UnconfiguredSynchronousMessageBuilder) WithRequest ¶
func (m *UnconfiguredSynchronousMessageBuilder) WithRequest(r RequestBuilderFunc) *SynchronousMessageWithRequest
AddMessage creates a new asynchronous consumer expectation