Code Monkey home page Code Monkey logo

Comments (11)

mefellows avatar mefellows commented on August 31, 2024

@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:

  1. 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)
  2. Have the verifier output a generic message as per your suggestion that doesn't
  3. Have a clear message in the unstructured data that can be filtered and used to make this decision
  4. Be quite generic and just tell the user they can do this sort of thing
  5. Something else I can't imagine at this moment in time

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

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.

bethesque avatar bethesque commented on August 31, 2024

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.

bethesque avatar bethesque commented on August 31, 2024

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.

mefellows avatar mefellows commented on August 31, 2024

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.

bethesque avatar bethesque commented on August 31, 2024

I've already done it.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

I think that was a race condition - I can do that :)

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

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.

bethesque avatar bethesque commented on August 31, 2024

Bother, I thought I had already. Will go and check my releases.

from pact-go.

bethesque avatar bethesque commented on August 31, 2024

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.

mefellows avatar mefellows commented on August 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.