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

Add Health Check in Pact Interactions, Don't setup until Pact is available #32

Open mboudreau opened 9 years ago

mboudreau commented 9 years ago

Since we spoke about the healthcheck earlier, I am actually doing something similar in my build process to see when pact is available. I check every second until something is returned from the service.

Maybe this is something that should be included in the dsl to help people. At the very least, have the health check interaction under Pact.Interactions so that it can called easily.

bethesque commented 9 years ago

So, this approach shouldn't be needed any more if we can take advantage of a new feature in pact-mock-service.

If you call:

$ bundle exec pact-mock-service start

this will block until the service is healthy.

To stop, call

$ bundle exec pact-mock-service stop

This also removes the need to manage pids.

I had a go at trying to convert gulp to use this, but my gulp is not good enough.

mboudreau commented 9 years ago

What you've done is good, but I'm not certain if this will fix all edge cases. What if they don't use bundler? What about if Pact is on another machine that they're pointing to? What if they're build process actually doesn't even wait for the process to return anything and just goes onto the next step? What happens if they're using gulp and the pact-mock-service start is in parallel with the tests?

I think all of these are very valid reason as to why we should have a health check and a 'block' on http requests until the health check is satisfied.

bethesque commented 9 years ago

Good points. I'm happy for this to be added as a feature.

bethesque commented 9 years ago

There's now a PUT /interactions endpoint that means that we don't have to do the messy sequential DELETE, POST /interaction, POST /interaction... it will do it all in one go. I'd like to get that in next, before we modify the code to wait, as it will make the code much cleaner.

mboudreau commented 9 years ago

Sounds good. Let me know when ready.

bethesque commented 9 years ago

Had a few minutes waiting for a deploy, did the PUT change.