Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Live update stubs #52

Open
jamesarosen opened this issue Oct 13, 2022 · 3 comments
Open

Feature request: Live update stubs #52

jamesarosen opened this issue Oct 13, 2022 · 3 comments
Labels
enhancement Indicates new feature requests

Comments

@jamesarosen
Copy link

jamesarosen commented Oct 13, 2022

Problem

If I run the server as follows:

pact-stub:
  command:
    - "-p3001"
    - "-dpacts"
  container_name: my-pact-stub
  image: pactfoundation/pact-stub-server
  ports:
    - "3001:3001"
  tty: true
  volumes:
    - "./test/pacts/:/app/pacts:ro"

and then change one of the files in test/pacts/ (either manually or by running my unit tests), the change is not reflected in subsequent requests to the server without restarting it.

Why this matters

Following the Writing Consumer Tests guide, our process is:

  1. write some Unit tests using Pact
  2. run the tests; Pact generates test/pacts/… files
  3. run Acceptance tests using Cypress and the pact-stub-server

I'd like to keep Cypress, the pact-stub-server, and the unit-test suite all running in the background so I can develop continuously. As it is, I need to restart the Docker containers after every change.

Possible Solutions

  • PactSource::Dir could watch the directory rather than walk it during load.
  • The pact-stub-server Dockerfile could use something like notify-rs to watch the directory and restart the server process on changes (after a debounce period)
@jamesarosen
Copy link
Author

Another use-case: it would be nice to start the pact-stub-server in a GitHub Action using services, but that will start it before I have a chance to run unit tests and output pact files.

@mefellows mefellows changed the title Server does not obey changes to pact files Feature request: Live update stubs Nov 23, 2022
@mstaudt
Copy link

mstaudt commented Dec 6, 2022

+1, would be very helpful :)

@neokree
Copy link

neokree commented Apr 18, 2023

+1

@YOU54F YOU54F added the enhancement Indicates new feature requests label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

4 participants