DiUS / pact-consumer-js-dsl

*DEPRECATED* A Javascript DSL for creating pacts, superceded by Pact JS
https://github.com/pact-foundation/pact-js
Other
56 stars 26 forks source link

Incorrect work of pact-mock_server #53

Open ichyr opened 8 years ago

ichyr commented 8 years ago

@mefellows @uglyog

I'm using pact-consumer-js-dsl to generate pacts. But found interesting behaviour.

Currently I have 4 pairs of consumer-providers. I run gulp task to run the test cases with pact-dsl to generate them and they all go to the same instance of running pact_mock server. I start it before the tests run.

As a result I have 4 jsons with correct names,. The first json lists correctly the pair C1-P1 and C1P1 interactions but the second json lists C2-P2 and interaction C1P1 + C2P2. Where C = consumer, P = provider. And so on. Last json has all interactions in it but with C4P4.

How can this be overcome? I need json files with interactions specific for specific C-P pair only.

mefellows commented 8 years ago

Hi @ichyr, it sounds like your problem is that you are running the mock service between each C-P pair. I'm no expert on the Mock Service, however as I understand it you should start the service for each combination of C-P. Have you tried this approach?

ichyr commented 8 years ago

@mefellows But this is more or less not very efficient. I'm developing Angular.js front-end application that consumed data from microservice infrastructure ( thus one consumer with multiple providers ). I have moved all my pact generation jasmine specs into seperate guild job, but they still run in one batch.

How should this be resolved?

In my opinion this is the way it is supposed to be - run all pact generation script at once.

But current implementation implies that the pact_mock-server should be fired before and shut down after each batch of test with same C-P pair. This is a mess.

ichyr commented 8 years ago

@mefellows @uglyog maybe you already have some patterns to solve problems like mine?

uglyog commented 8 years ago

We are looking at ways of fixing this, probably by creating a standard mock server for all language implementations. Unfortunately, this won't be something that can be fixed in the short term.