Back

Speaker "Pierre Vincent" Details Back

 

Topic

Consumer-driven Contracts: avoid microservices integration hell!

Abstract

Independent changes and independent deployments are a great way to achieve Continuous Delivery with minimum disruption. Unfortunately as systems become less coupled and communicate over APIs or message queues, interactions become easier to break.

Consumer-Driven Contracts testing brings an alternative integration testing approach for distributed systems, relying less on live-like integration environments and more on making interactions explicit and quickly verifiable.

This talk will cover how we have made CDCs part of our pipeline using Pact and how it improved confidence and collaboration between teams when designing APIs.

Full Summary:

Independent changes and independent deployments are a great way to achieve Continuous Delivery with minimum disruption. Unfortunately as microservices become less coupled and communicate over APIs or message queues, interactions become easier to break. With this in mind, ensuring that a simple change does not break the application can quickly grow into a painful process of provisioning a full live-like integration environment, creating a bottleneck in the deployment pipeline.

Consumer-Driven Contracts (CDC) make interactions between services a first-class concern, by recording them in contracts between Consumers (making requests) and Providers (responding to requests). The asynchronous nature of the contract generation and verification reduces the need for full live-like integration tests environment:
- a Consumer generates and publishes Contracts for its dependencies
- a Provider automatically verifies that the published interactions are not broken when a change is implemented

By making the services interactions explicit with CDCs, we have found that this favoured communication early on, resulting in collaborative API design. Typically, two developers (potentially in different teams) now start by agreeing on contracts for new interactions before implementation begins. Any change to that contract during implementation is a risk of a broken interaction and is quickly dealt with between the two teams. This faster feedback loop is a huge improvement: before, issues arising from service interface changes would only be discovered after deployment to an integration test environment.

In summary, this talk will cover:
- The Consumer-Driven Contracts testing pattern
- How CDCs can reduce the integration testing burden

Takeaway for the audience:

The objective of this talk is to demonstrate that Consumer-Driven Contracts are a great way to:
- strengthen the build and deployment pipeline by making services interactions an explicit concept
- improve confidence of API consumers and providers when making changes
- enable better communication between developers and teams, leading to a better collaboration and better understanding of how APIs are being used

Ultimately, the takeaway for the audience would be to realise the benefits of CDCs and that they are very easy to setup with Pact.

 

Profile

I am SRE Manager at Poppulo in Cork, Ireland. I am passionate about enabling engineers to deliver great software with speed. I am helping teams to embrace DevOps practices, focusing on building maintainable applications and continuously improving their processes.