pact-foundation / pact-ruby

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
2.17k stars 216 forks source link

Service provider configuration overlaps with other service providers #280

Closed bmorton closed 3 months ago

bmorton commented 2 years ago

I'm working on introducing Pact contracts to a few of our codebases. Our Rails monolith powers a few scenarios here and so we have multiple service providers defined in our pact_helper.rb file. When we implemented the second one with a separate app, we noticed that they started to overlap. We noticed that it's unpredictable which app will receive all the requests, perhaps based on test load order or something.

I think this is because the code expects to use a global implementation of app for all service providers: https://github.com/pact-foundation/pact-ruby/blob/8cb00ca9515d24a8c42431f8ea537a0388940ffa/lib/pact/provider/rspec.rb#L12-L14

I noticed the use of Pact.clear_configuration in the test suite, so I am going to try working around this issue with that method call to see if I can get it to run between the provider verifications. Failing that, I may try to separate these into different pact_helper files since I also have a message provider and may need to follow the guidance from #260 anyway.

YOU54F commented 3 months ago

thanks for raising, closing as dupe of #260