Skip to content

Issue with interaction providerState and set_up_provider_states #192

@audunhalland

Description

@audunhalland

Hello, I'm using pact-js to verify an express-js based provider. Having debugged this issue for a while, I found that pact-ruby expects to have multiple provider states, while the pact file only contains one provider state. Here is a verbose log output from the verification, that uses pact-provider-verifier, that again uses pact-ruby (as a library(?), I'm no ruby expert):

(version: 1.64.0)

$ pact-provider-verifier --provider myGraphlServer --provider-base-url http://localhost:9999 --pact-broker-base-url https://[my broker] --provider-states-setup-url http://localhost:9999/_pactSetup --verbose

...
INFO: Reading pact at https://[my broker]

Verifying a pact between myFrontend and myGraphqlServer
  Given There is a feed with semanticKey "innsikt-hovedfeed" with one notice
    A request for published notices
      with POST /graphql
        returns a response which
DEBUG: Setting up provider state '' for consumer 'myFrontend' using provider state set up URL http://localhost:9999/_pactSetup
...

A quick study of the ruby code reveals that an interaction object has a provider_state, which is used for the log line with "Given ${interaction.provider_state}". But then set_up_provider_states is called with a different property: interaction.provider_states (plural); this property is somehow not defined in my pact.

Then my node-js based verifier receives a POST request to configure its provider state, and the body of that request is {"consumer":"myFrontend","state":null,"states":[null],"params":{}} (intercepted with netcat, nc -l 9999) and there's no hack that I can currently do to make it work.

If you need more info, I can provide a sample pact file with an exact command line to invoke the ruby verifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions