• Home
  • Consumer-Driven Contracts with Kubernetes

Learn how to use the Pact Foundation’s framework for CDC testing

Consumer-Driven Contracts with Kubernetes

Learn how to use the Pact Foundation's framework for CDC testing
Consumer-Driven Contracts with Kubernetes

Consumer-driven contracts (CDC) was first promoted as a testing technique in 2006 by Ian Robinson . CDC has been slow to adapt over the years, but remains a vital testing technique. Recently our community has adopted a keener interest in CDC as it’s a helpful method for testing microservices.

CDC is a concept and testing approach that embraces the perspective of multiple consumers that communicate with providers. Typically, testing tends to define API contracts from the provider’s perspective. Through a registry of contracts, multiple consumers now have a voice to provide producers their expectations on how data should be exchanged between the consumers and producers.

Over the years the Pact Foundation has established itself as the primary framework that implements this testing approach.

This lab leverages on Kubernetes as it’s ideal for running microservices and containers.

You will explore a sample application composed of several microservices. The application aggregates population and COVID-19 datasources and presents data at an API gateway. We will use Pact to verify the API.

In this lab, you will learn how to:

    ☐ Set up a Pact Broker on Kubernetes
    ☐ Write a consumer that defines and publishes Pact contracts
    ☐ Deploy and run a few Spring Boot microservices on Kubernetes
    ☐ Connect microservices to a database and public data source
    ☐ Verify the consumer pacts against a producer
    ☐ Find API defects and fix them

  • LEVEL

    Intermediate

  • DURATION

    30 minutes

  • UPDATED

    31 Dec, 2021