Simple playground app for pact-python contract testing.
- Run pact broker:
>> docker-compose up
- Go into postgres container and create pact user role:
CREATE USER pactbrokeruser WITH PASSWORD 'pactbrokeruser';
CREATE DATABASE pactbroker WITH OWNER pactbrokeruser;
GRANT ALL PRIVILEGES ON DATABASE pactbroker TO pactbrokeruser;
-
Now you can enter
http://myuser:mypassword@localhost
to see pact admin page. -
In
consumer
location run with unique consumerversion_num
:
>> pytest --publish-pact <version_num>
In these step pact file will be generated and send to broker. Our consumer would be tested against mocked service.
- In
provider
location run with unique providerversion_num
:
>> pytest --publish-version <version_num>:
It would verify our provider against latest pact stored within broker.
- Checking whether can deploy component (provider / consumer):
http://localhost/can-i-deploy?pacticipant=<provider>&version=<version_num>