Skip to content
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

Support running a single interaction when verifying a pact #451

Closed
canny bot opened this issue Jun 26, 2024 · 2 comments
Closed

Support running a single interaction when verifying a pact #451

canny bot opened this issue Jun 26, 2024 · 2 comments

Comments

@canny
Copy link

canny bot commented Jun 26, 2024

The pact ruby implementation allows the user to replay a single interaction from a pact at a time. This makes it much easier to fix failing interactions as pacts can get quite large, and there can be a lot of noise when reporting the failure of every interaction at once.
The pact ruby implementation is being replaced by the pact rust shared core, which does not yet support this feature. I think we should work out how we could add support for it. The interactionId field that is added by the Pact Broker is suitable for this purpose.

It is possible that this might be best implemented as a Pact Broker feature by passing through another parameter in the 'pacts for verification' call.

https://pact.canny.io/admin/board/feature-requests/p/support-running-a-single-interaction-when-verifying-a-pact

Copy link
Author

canny bot commented Jun 26, 2024

This issue has been linked to a Canny post: Support running a single interaction when verifying a pact 🎉

@YOU54F
Copy link
Member

YOU54F commented Sep 9, 2024

The equivalent behaviour has been implemented in the rust shared core, exposed via environment variables, as per the pact-ruby implementation - user facing docs here

Interactions can be filtered via the CLI

https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli#command-line-interface

Filtering interactions:
      --filter-description <filter-description>
          Only validate interactions whose descriptions match this filter (regex format) [env: PACT_DESCRIPTION=]
      --filter-state <filter-state>
          Only validate interactions whose provider states match this filter (regex format) [env: PACT_PROVIDER_STATE=]
      --filter-no-state
          Only validate interactions that have no defined provider state [env: PACT_PROVIDER_NO_STATE=]
  -c, --filter-consumer <filter-consumer>
          Consumer name to filter the pacts to be verified (can be repeated)

They can be controlled externally when using libpact_ffi consumed in other languages by env vars

  • PACT_DESCRIPTION
    • Only validate interactions whose descriptions match this filter (regex format)
  • PACT_PROVIDER_STATE
    • Only validate interactions whose provider states match this filter (regex format)
  • PACT_PROVIDER_NO_STATE
    • Only validate interactions that have no defined provider state

@YOU54F YOU54F closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant