Introduction

In Trendyol, we are using microservice architecture. So, there are many teams developing their own microservices in different languages like JAVA, GoLang etc. There many integrations between these microservices on live systems. For example, one of the sevice developed by my team (Trendyol instant messaging or chat) gets order information of a user from another service developed by order management system (OMS) team. If OMS team changes the response object without informing us, probably our service would be broken in production environment. To prevent incidents like this, and to deploy the changes to the production environment without breaking anything, we are writing Pact Contract Tests on both consumer and provider side. So, if one team changes the contract without informing the other team, their service would fail during the build since it cannot verify the contract on Pact Broker. So, if there is a need to change the contract, first the consumer service should be updated and the new generated pact file should be uploaded to Pact Broker, then provider can be updated and verify the new contract. Thats why it is also called consumer-driven contract testing. In this article, i am gonna demonstrate an example for both consumer and provider tests with GoLang including Pact Broker verification . …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store