- Docker and Docker Compose
- Node.js and yarn package manager
- Python 3.9 or higher
-
Go to
pact-broker
folder -
Create
broker.env
anddatabase.env
files based on sample files in the same folder. Have in mind that the same values should be applied to both files or the app won't connect with the database -
In order to use
https
you have to add your ssl certificate, generatepact_cert.pem
andpact_cert.key
files and push them intopackages/pact-broker/ssl/cert
folder. Uncomment the SSL section of Nginx Configuration file and set your desired configuration, lines 16 and 17, with your custom certificate paths. Use the following command to generate the certificates.openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout pact_cert.key -out pact_cert.pem
-
Run
docker-compose up -d
-
Use your browser to open http://localhost or https://localhost if ssl is configured correctly
-
Go to
javascript
folder -
Install dependencies with
yarn
cd javascript yarn
-
Run pact tests
⤵️
- In the javascript directory, run
yarn pact
. It will run the pact tests in each project and will generate the pacts inside each package within the pacts folder.yarn pact:publish
will publish the pact results of the consumers.yarn pact:verify
will verify all existing published pacts by each respective provider. - You can also run manually each pact test or publishing with the following commands:
yarn pact:hachebo
: hachebo pact testing and generate pactsyarn pact:hachebo:publish
: hachebo pact publish resultsyarn pact:neflis
: neflis pact testing and generate pactsyarn pact:neflis:publish
: neflis pact publish resultsyarn pact:tv-shows
: tv shows pact testing and generate pactsyarn pact:tv-shows:publish
: tv shows pact publish resultsyarn pact:tv-shows:verify
: tv shows verify pacts
cd pact-example/python
python3 -m venv venv
source ./venv/bin/activate
pip install .
cd duration_provider
uvicorn main:app --reload --port 9000
cd movies-api
uvicorn main:app --reload --port 9001
make servers-start
make servers-shutdown
make movies-api-generate
make movies-api-publish
make movies-api-verify
make duration-provider-verify
Regarding consumer schemas information, check this