-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hooks): support hook functions and request middleware
- Deprecate ProviderStatesSetupURL, in favour of functional hooks - Add BeforeHook and AfterHook to execute at the start and end of an interaction lifecycle - Add RequestFilter to be able to support more advanced provider intercepting (e.g. Authorisation) use cases - Improved test coverage - Add proxy infrastructure on provider verification to support - Remove existing broker fetch/publish code, defer to CLI tools *Summary of new hooks lifecycle*: For each _interaction_ in a pact file, the order of execution is as follows: `BeforeHook` -> `StateHandler` -> `RequestFilter (pre)`, `Execute Provider Test` -> `RequestFilter (post)` -> `AfterHook` If any of the middleware or hooks fail, the tests will also fail. BREAKING CHANGE
- Loading branch information
Showing
43 changed files
with
1,110 additions
and
1,629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package client | ||
|
||
import ( | ||
"log" | ||
) | ||
|
||
// PublishService is a wrapper for the Pact Provider Verifier Service. | ||
type PublishService struct { | ||
ServiceManager | ||
} | ||
|
||
// NewService creates a new PublishService with default settings. | ||
// Arguments allowed: | ||
// | ||
// --provider-base-url | ||
// --pact-urls | ||
// --provider-states-url | ||
// --provider-states-setup-url | ||
// --broker-username | ||
// --broker-password | ||
// --publish-verification-results | ||
// --provider-app-version | ||
// --custom-provider-headers | ||
func (v *PublishService) NewService(args []string) Service { | ||
log.Printf("[DEBUG] starting verification service with args: %v\n", args) | ||
|
||
v.Args = []string{ | ||
"publish", | ||
} | ||
|
||
v.Args = append(v.Args, args...) | ||
v.Cmd = getPublisherCommandPath() | ||
|
||
return v | ||
} | ||
|
||
func getPublisherCommandPath() string { | ||
return "pact-broker" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.