pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

Is there anyway to read all contracts from PactBroker instead of put every single contract URL in CLI? #37

Closed aicquewk closed 2 years ago

aicquewk commented 3 years ago

Hi Team,

Let say I have 1000 contract files store in PactBroker.

I just wanna know if it have possible way to read all contracts from PactBroker (like when reading from directory) because when I want to add new contract(s), I don't want to waste time to kill container and re-run it every single time. It would be useful if I just put PactBroker base URL into CLI and stub-server is able to read all contracts from PactBroker (including a new one) automatically

Please let me know if you guys have solution(s) of future plan for this use case.

mefellows commented 3 years ago

Hi @aicquewk, are you able to please elaborate further on the actual use case behind this? Are you using the stub server for e2e tests or something else?

1000 contracts is a lot - do you actually have that many or is it just hypothetical?

aicquewk commented 3 years ago

Hi @aicquewk, are you able to please elaborate further on the actual use case behind this? Are you using the stub server for e2e tests or something else?

1000 contracts is a lot - do you actually have that many or is it just hypothetical?

In contract testing, I'd like to let DevOps start stub-server to provide a mock server as mock providers to let consumers test their APIs by just call stub-server-url/api-path instead of let consumers run stub-server by themselves cuz docker will consume a lot of resource on their workstations.

However, I'll actually have more than 1000 contracts cuz this is a big project xD

I hope this information would help. Thanks.

uglyog commented 3 years ago

Version 0.4.4 has been released with the option to fetch all the latest pacts from a Pact Broker.

Please note that it has to fetch the list off all pacts (2 calls), then fetch each pact file from the list. Running on my laptop, it can fetch about 4 pact files per second. With 1000 pact files in your broker and depending on the configuration of your Kubernetes cluster, it could take about 5 minutes to start.

aicquewk commented 3 years ago

Oh wow, that's very cool!. I will try and provide feedback. Thanks a lot! :D