pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

Request not matched when there are provider states being used #34

Closed AdamPike closed 4 years ago

AdamPike commented 4 years ago

I have 2 end points 1 has 3 tests, each with their own provider states, the second end point has a single test with no provider state.

When I start stub-server and pass the three states in with the parameter:

--provider-state "(?:store-with-full-data|store-with-empty-seo-text-spans|store-with-no-facilities)"

Then run my verification tests against it, the single test on it's own end point with no state get's returned a 404 after being compered to the 3 request types that do have states described, even though they're on a different end point path.

Is my regex wrong or is it true that the--provider-state regex checks take precedence over any other matching? In other words if you use any provider states, every test has to include one and all need to be passed into the regex.

uglyog commented 4 years ago

When using the --provider-state parameter, it will filter all the interactions against that regular expression. Those without a provider state will never match, so will be excluded.

AdamPike commented 4 years ago

Ok thank you for confirming.

uglyog commented 4 years ago

I've added an --empty-provider-state flag to allow empty provider states when filtering with --provider-state.

AdamPike commented 4 years ago

Thanks @uglyog, that takes care of my use case.