Using Pact Broker

帅比萌擦擦* 提交于 2020-06-18 12:13:52

问题


Can someone point me in detail as for how to publish JSON pacts in step by step to Pact Broker?

Have installed docker, dius/pack_broker and well as Postgres (brew installation).

Missing the point of mending all the above in a proper way and the appropriate script that will publish the JSON pact to pact broker.

To add, I'm using JVM implementation at the consumer side. And simple gradle verification at the provider side.


回答1:


The Pact Broker is a restful API over a repository of pacts, so the simplest way to publish is to just do a PUT request to the broker with the contents of the generated pact files.

As you have mentioned you're using Gradle, the Pact JVM Gradle plugin has a publish task which you could use. You just need to include the configuration in your consumer project and then execute the pactPublish task after running your tests.

See https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-gradle#publishing-pact-files-to-a-pact-broker-version-227 for more information.




回答2:


PACT Broker Setup Download Dockerized Pact Broker Image from Docker HUB https://hub.docker.com/r/dius/pact-broker/ And follow the Prerequisites & Getting Started section which is provided by PACT Foundation. In addition you need Postgres Docker Image. I recommend prepare docker compose file and run. By default PACT Broker run on PUMA which uses default port 9292. Here is the PACT Broker repository from PACT Foundation you can copy Docker Compose file from here. https://github.com/pact-foundation/pact-broker-docker



来源:https://stackoverflow.com/questions/42082754/using-pact-broker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!