Comments (11)
@bethesque from the provider side, how would we determine which provider description/state to tell the user? It's quite a blunt instrument at the moment as we get back only unstructured data from a single call to 'verify'.
I see a few options here:
- Have the verifier (and mock service?) send back structured data that the client libraries can use more intelligently (this might be required for other scenarios, such as message/other engine support)
- Have the verifier output a generic message as per your suggestion that doesn't
- Have a clear message in the unstructured data that can be filtered and used to make this decision
- Be quite generic and just tell the user they can do this sort of thing
- Something else I can't imagine at this moment in time
from pact-go.
FWIW it's worth, it works for Pact Go:
PACT_DESCRIPTION="yeah" PACT_PROVIDER_STATE="blah" make pact
...
Reading pact at /Users/mfellows/go/src/github.com/pact-foundation/pact-go/examples/e2e/../pacts/billy-bobby.json
Filtering interactions by: {:description=>/yeah/, :provider_state=>/blah/}
No examples found.
0 interactions, 0 failures
from pact-go.
For each failure in the pact, the ruby code outputs the command to run that individual interaction (you probably just gloss over that as it's not relevant for js/go).
Failed interactions:
bundle exec rake pact:verify:at[./spec/support/test_app_fail.json] PACT_DESCRIPTION="a test request" PACT_PROVIDER_STATE="the weather is cloudy" # A test request given the weather is cloudy
bundle exec rake pact:verify:at[./spec/support/test_app_fail.json] PACT_DESCRIPTION="another test request" PACT_PROVIDER_STATE="" # Another test request
bundle exec rake pact:verify:at[./spec/support/test_app_fail.json] PACT_DESCRIPTION="another test request" PACT_PROVIDER_STATE="a missing provider state" # Another test request given a missing provider state
If the calling code can also set an environment variable called PACT_INTERACTION_RERUN_COMMAND
then I can use that to create language specific re-run commands. Otherwise, I can just print the description/state env vars for each interaction, with the text "Please re-run the verify command with the relevant env vars set to run an individual interaction"
from pact-go.
The value of PACT_INTERACTION_RERUN_COMMAND
for ruby is
bundle exec rake pact:verify:at[<PACT_URI>] PACT_DESCRIPTION=\"<PACT_DESCRIPTION>\" PACT_PROVIDER_STATE=\"<PACT_PROVIDER_STATE>\"
I substitute in the relevant description, state and URL.
from pact-go.
Yep, but it doesn't do that anymore right?
PACT_INTERACTION_RERUN_COMMAND
seems like a good suggestion. Is that already available?
from pact-go.
I've already done it.
from pact-go.
I think that was a race condition - I can do that :)
from pact-go.
I've updated the code base to set PACT_INTERACTION_RERUN_COMMAND
when running the verification process. Let us know when it's in the upstream package. I'm running it locally against 1.4.2 and it's still wanting to do Ruby stuff.
from pact-go.
Bother, I thought I had already. Will go and check my releases.
from pact-go.
It's working for me with 1.4.2. If I run
PACT_INTERACTION_RERUN_COMMAND="foo" ./pact-provider-verifier -a "1.0.100" --provider-base-url http://localhost:4567 --pact-urls fail.json --provider_states_setup_url http://localhost:4567/provider-state -v
I get:
3 interactions, 2 failures
Failed interactions:
foo # Greeting fail
foo # Provider state success
from pact-go.
I worked out why - we use the --json
flag and it doesn't seem to come through in there (and for good reason).
I'll update docs and have the code pass it through anyway for future safe-keepings.
from pact-go.
Related Issues (20)
- pact-go v2.0.x requires CGO HOT 2
- Unable to Call AddSynchronousMessage() Multiple Times within the same Go Test
- Provider verifier not working correctly when consumer uses matchers.Decimal HOT 2
- Is PactFileWriteMode no longer available? HOT 1
- Metadata information not getting recorded for protobuf-message HOT 1
- Protobuf cannot find enum with multiple proto files HOT 3
- requestMetadata expects exact value instead of matching type
- How to specify Pact CLI path in Go package manager HOT 7
- Add support for disabling colored output HOT 8
- Library not loaded: libpact_ffi.dylib HOT 22
- VerifyMessageConsumer failed: error creating message: exit status 255 HOT 1
- undefined structs running pact-go/v2 HOT 3
- BeforeEach method runs before every state HOT 6
- Why is there a functional pattern constructore for the installer? HOT 1
- Runtime error occurs with golang 1.22.x HOT 8
- Installation section of README.md is the wrong path HOT 1
- Current state of the go implementation and roadmap HOT 8
- "example=0" struct tags for numbers lead to wrong example values in contract HOT 1
- New release? HOT 5
- Incorrect header matching rules key in v2 pact files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-go.