-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better provider verification output #57
Add better provider verification output #57
Conversation
I'll be sure to update docs and examples and readme if these changes are given the green light. |
BREAKING CHANGE: PactClient#VerifyProvider now returns a types.ProviderVerifierResponse as well as an error. An error means that the client was unable to run the verification code successfully. The ProviderVerifierResponse is a direct mapping of the json output returned by the pact-provider-verifier binary. Iterate over the Examples structs to determine if they passed. NOTE: Verbose output for the types.VerifyRequest is not compatible with the json format since it logs to stdout, causing the json to be unparsable.
cfa381c
to
7e9d0cc
Compare
t.Errorf("%s\n%s\n", example.FullDescription, example.Exception.Message) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func is the only real addition for all these example tests. Everything else was just converting spaces to tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - weird I never picked this up!
This looks great, I'll review today! |
Yep, the benefit of the current daemon approach is that the pact binaries are known to be co-located with the daemon. The challenges with removing the daemon, is that we need another way of getting the pact binaries onto the PATH, and then keeping them up to date. But agreed, it is the first step (FWIW this was always the plan). |
This enables you to write your provider verification tests like this:
Changes
The main change is to
func (p PactClient) VerifyProvider(request types.VerifyRequest, reply *types.ProviderVerifierResponse) error
. The reply type is specific to the JSON output of thepact-provider-verifier
binary. Also, I've changed the semantics of the error a bit. If a valid JSON response from the binary can be parsed, there will be no error. Otherwise, there will be an error, and it will include both stderr and stdout from the binary.Notes
In doing this, I realized it would be pretty easy to repurpose the daemon package to remove the rpc layer and use it directly to execute the external ruby binaries. That could be a first step in solving #31