Documentation
¶
Index ¶
- func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retry.RetryOption)
- func PreassignPorts(pactFilePaths []Pact)
- func SplitPactBulkFile(bulkFilePath string, outputDirPath string, ...) error
- func StopMockServers()
- func TestWithStubServices(pactFilePaths []Pact, testFunc func())
- func VerifyAll() error
- func VerifyMessageProviderRaw(params PactProviderTestParams, request dsl.VerifyMessageRequest) (types.ProviderVerifierResponse, error)
- func VerifyProviderMessagingPacts(params PactProviderTestParams, messageProducers dsl.MessageHandlers)
- func VerifyProviderPacts(params PactProviderTestParams)
- type MockServer
- type Pact
- type PactFile
- type PactProviderTestParams
- type PactRequestMatchingFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntegrationTest ¶
func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retry.RetryOption)
Runs mock services defined by the given pacts, invokes testFunc then verifies that the pacts have been invoked successfully
func PreassignPorts ¶
func PreassignPorts(pactFilePaths []Pact)
PreassignPorts sets a random port for all future mocked instances and configures viper to point to them. This is necessary to get viper configuration before actually loading pact files. This function can be called multiple times for the same files, it will only initialise them once.
func SplitPactBulkFile ¶
func SplitPactBulkFile(bulkFilePath string, outputDirPath string, requestFilters ...PactRequestMatchingFilter) error
SplitPactBulkFile reads bulk PACT files, splits it into smaller ones and writes output to destination directory
func StopMockServers ¶
func StopMockServers()
func TestWithStubServices ¶
func TestWithStubServices(pactFilePaths []Pact, testFunc func())
Runs testFunc with stub services defined by given pacts. Does not verify that the stubs are called
func VerifyMessageProviderRaw ¶
func VerifyMessageProviderRaw(params PactProviderTestParams, request dsl.VerifyMessageRequest) (types.ProviderVerifierResponse, error)
VerifyMessageProviderRaw runs provider message verification.
func VerifyProviderMessagingPacts ¶
func VerifyProviderMessagingPacts(params PactProviderTestParams, messageProducers dsl.MessageHandlers)
func VerifyProviderPacts ¶
func VerifyProviderPacts(params PactProviderTestParams)
Types ¶
type MockServer ¶
func (*MockServer) AddInteraction ¶
func (m *MockServer) AddInteraction(interaction interface{}) error
func (*MockServer) DeleteInteractions ¶
func (m *MockServer) DeleteInteractions() error
func (*MockServer) Verify ¶
func (m *MockServer) Verify() error
type PactFile ¶
type PactFile struct { Provider struct { Name string `json:"name"` } `json:"provider"` Consumer struct { Name string `json:"name"` } `json:"consumer"` Interactions []struct { Description string `json:"description"` ProviderStates interface{} `json:"providerStates"` Request interface{} `json:"request"` Response interface{} `json:"response"` } `json:"interactions"` Metadata interface{} `json:"metadata"` }
PactFile describes expectations between provider and consumer
func NewPactFile ¶
NewPactFile create new PACT file representation
type PactProviderTestParams ¶
type PactRequestMatchingFilter ¶ added in v1.0.2
type PactRequestMatchingFilter = func(map[string]interface{})