Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

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

Open
mboudreau opened this issue Feb 25, 2015 · 6 comments

Comments

@mboudreau
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

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

@bethesque
Copy link
Contributor

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
Copy link
Contributor Author

Sounds good. Let me know when ready.

@bethesque
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants