-
Notifications
You must be signed in to change notification settings - Fork 46
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
Feature Request - Automatically replace path with provider state when using pathFromProviderState
#441
Comments
pact-jvm does not use the pact-reference repo, which is used to build the rust core pact-jvm has its own implementation https://docs.pact.io/diagrams/ecosystem#java-goldberg-machine does this work correctly with a pact-jvm provider? |
I'm not exactly sure what you mean here. Are you referring to something like this: https://stackoverflow.com/a/63956890, where we use a provider test to overwrite the provided state? We are building a general/agnostic implementation in which we don't write any provider specific tests. So the only time we could make some replacements is when we retrieve the provider state from the state change url (right before verifying the pact using the pact-verifier). Or are you saying that the functionality I'm expecting is available in the rust core but not in the pact-jvm since it has a different implementation? But this I don't fully get either as we only use pact-jvm to create the pact files and the verifier for verification. Would that mean that the verifier can't handle pacts created by pact-jvm? |
To clarify the situation, the feature request is twofold:
|
If I understand the ask, I support both the idea of dynamic replacement of items that use provider state generators (item [1] in your summary) and dynamic provider state values supplied by the provider. We would need to work out implementation details, presumably this would be an HTTP contract between the verifier and the API (and documented here: https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli#state-change-requests) |
Just a note, this expression |
…he provider state parameters #441
Expectation: When using
pathFromProviderState
in a consumer pact test, I expect that the path param in the created pact is replaced by the supplied provider state. That is, when verifying a consumer pact using the standalone pact-verifier (version 1.1.1), I would expect the request that is sent to contain the supplied provider state, but instead the request path of the “example” parameter in the pathFromProviderState property is used.Consider the following example:
Executing this test creates below pact.
When using the pact-verifier the request that is sent is always equal to the
path
in the pact file (i.e./api/hello/James
) . I would expect/hope that the supplied provider state would actually be applied to the request when the pact-verifier sends the request. In this case the request would then be/api/hello/John
. In theory, I could obtain the provider state from the request made to the—state-change-url
. This way I could replace the path of the request with the provider state, but I would expect that that would happen out of the box. Is it a deliberate choice that this doesn’t happen? If not, could this be added to the pact-verifier in a future version?The text was updated successfully, but these errors were encountered: