This is a POC accomplished during Innovate 2023 - Fall Edition.
The goal was to test the full loop of contract testing using PACT.
The setup:
- A Scala client (consumer) that mimics the SearchAPI in our infrastructure.
- A Java server (provider) that mimics the micro-service that expose ML models.
- A Pact broker leveraged to share pacts between consumer/provider.
The flow:
- Start the broker using
docker-compose up
- Write Pacts in the Scala Client
- Validate the pacts locally against a mock server.
- Bump the version of the library (in build.sbt)
- Publish the pacts using
sbt pactPublish
- Run the test in the ml-service. If needed, add more state fixtures.
- Validate the state of the pacts in the broker.
- Also, you can validate if you can deploy using:
pact-broker can-i-deploy --pacticipant searchapi --version 1.0.0 --broker-base-url http://localhost:9292