SlideShare uma empresa Scribd logo
1 de 21
Consumer-driven contracts
Avoid microservices integration hell!
@PierreVincent
Nov 8th, 2016
Pierre Vincent
Technical Team Lead at Newsweaver
techblog.newsweaver.com
@PierreVincent
From this... … to this.
Login
Service
User
Service
API
GET /users/pierre
{
"user": "pierre",
"name": "Pierre Vincent",
"role": "publisher"
}
200 OK
How do we
test this?
Running in Prod
Tests Pass in
Build
Implement
changes
Deployed in
Prod
User
Service
Login
Service
!
✓ ✓ ✓ ✓
✓
{
...
"role": "editor"
}
{
...
"roles": ["publisher","editor"]
}
Running in Prod
✓ ✓
Maybe we should have tested before deploying to
production…?
Tested what
though?
Users
Service
Login
Service
IP
Check
Service
Token
Gen
Service
Cert/Key
Service
Login
Frontend
We only
wanted to
test this bit!
Contract
Login
Service
User
Service
API
Authentication Team Users Team
[docs.pact.io]
PACT Specification
Verification philosophy: Tolerant Reader
Implementation guidelines
Implementations
Login
Service
User
Service
A
P
I
Pact
Mock
Server
Authentication Team Users Team
Pact
Consumer
Unit Test
Define
interaction
Trigger
interaction
Generate
Pact
Pact
Provider
Test
Share
Pact
Replay
interaction
Replay &
Verify
Play &
Record
Consumer
Provider
Provider State
Request
Expected
Response
Login Service
User Service
Given that user 'pierre' exists
Method GET
Path /users/pierre
Headers
Accept: application/json
Status 200
Headers
Content-Type: application/json
Body
{
"user": "pierre",
"name": "Pierre Vincent",
"role": "publisher"
}
Interaction
User
Service
A
P
I
1. Set Provider State
2. Send Request
3. Verify Response
Interaction Verification Test
INSERT INTO users [...]
GET /users/pierre
Accept: application/json
{
"user": "pierre",
...
}
{
"user": "pierre",
...
}
?
Authentication
Dev Team
Users
Dev Team
CMS
Dev Team
Billing
Dev Team
Pact
Broker
PACT
PACT
PACT
PACT
PACT
PACT
PACTPACT
PACT
PACT
Pact
Broker
Dependency
Graphs
Living documentation
by example
✓ Versioning
✓ Tagging
✓ REST Api
Build/Deployment
Pipeline integration
Provider pipeline
Implement changes Get Pacts from Broker
Replay & Verify
Interactions
Deploy Service
Build
Deploy to EU
PROD-EU
Get Pacts from Broker
Replay & Verify
Interactions
Stop deployment of
incompatible Provider
Stop introduction of
breaking change
PROD-US
PROD-EU
Consumer pipeline
Implement
changes
Generate Pacts
(Build)
Push Pacts to
Broker
Tag Pacts
Each Provider verifies Pacts Deploy Service Tag Pacts
Build
Deploy to EU
HEAD
Stop deployment of
incompatible Consumer
HEAD
PROD-EU
Caution: side-effects may include teams
collaborating on API design
Provider state setup for each interaction
Confidence comes from coverage:
don’t limit to happy paths
Automation within
deployment pipeline isn’t trivial
What’s the catch…?
After 2 years of CDCs...
Increased confidence when coding & deploying
✓
Collaborative API design
✓
Living API documentation
✓
Pact docs.pact.io, github.com/pact-foundation
Pact Broker github.com/bethesque/pact_broker
Try it out!
“Pact Matrix” (Beth Skurrie) rea.tech/enter-the-pact-matrix-or-how-to-decouple-the-release-
cycles-of-your-microservices
Why should you use CDC for microservices integration tests
techblog.newsweaver.com/why-should-you-use-consumer-driven-contracts-for-microservices-
integration-tests
Sharing CDCs with Pact Broker
techblog.newsweaver.com/sharing-consumer-driven-contracts-with-pact-broker
More reading...
techblog.newsweaver.com
Questions?
@PierreVincent

Mais conteúdo relacionado

Mais procurados

SPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantSPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantNCCOMMS
 
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)Jeremy Gray
 
Servicehost Customization
Servicehost CustomizationServicehost Customization
Servicehost CustomizationEyal Vardi
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutesAndrew Siemer
 
API Proxy Auto Discovery
API Proxy Auto DiscoveryAPI Proxy Auto Discovery
API Proxy Auto DiscoveryVince Soliza
 
Box connector
Box connectorBox connector
Box connectorThang Loi
 
Creating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services APICreating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services APIDavid Keener
 
Buzzientsiebelcrm 120504110642 Phpapp01
Buzzientsiebelcrm 120504110642 Phpapp01Buzzientsiebelcrm 120504110642 Phpapp01
Buzzientsiebelcrm 120504110642 Phpapp01TBJ Investments, LLC
 
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013NCCOMMS
 
3/3 : The path to CDI 2.0 - Antoine Sabot-Durand
3/3 : The path to CDI 2.0 - Antoine Sabot-Durand3/3 : The path to CDI 2.0 - Antoine Sabot-Durand
3/3 : The path to CDI 2.0 - Antoine Sabot-DurandSOAT
 
ZZ BC#8 Hello ASP.NET MVC 4 (dks)
ZZ BC#8 Hello ASP.NET MVC 4 (dks)ZZ BC#8 Hello ASP.NET MVC 4 (dks)
ZZ BC#8 Hello ASP.NET MVC 4 (dks)Chalermpon Areepong
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization Chalermpon Areepong
 
Creating web services
Creating web servicesCreating web services
Creating web servicesAdam Nemeth
 
2/3 : CDI advanced - Antoine Sabot-Durand
2/3 : CDI advanced - Antoine Sabot-Durand2/3 : CDI advanced - Antoine Sabot-Durand
2/3 : CDI advanced - Antoine Sabot-DurandSOAT
 
Rate Limiting - SLA Based Policy
Rate Limiting - SLA Based PolicyRate Limiting - SLA Based Policy
Rate Limiting - SLA Based PolicyVince Soliza
 

Mais procurados (20)

SPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantSPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You Want
 
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
 
Servicehost Customization
Servicehost CustomizationServicehost Customization
Servicehost Customization
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutes
 
API Proxy Auto Discovery
API Proxy Auto DiscoveryAPI Proxy Auto Discovery
API Proxy Auto Discovery
 
Box connector
Box connectorBox connector
Box connector
 
Testing soapui
Testing soapuiTesting soapui
Testing soapui
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency Injection
 
Mule 4 connecting ring central
Mule 4 connecting ring centralMule 4 connecting ring central
Mule 4 connecting ring central
 
Creating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services APICreating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services API
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
 
Buzzientsiebelcrm 120504110642 Phpapp01
Buzzientsiebelcrm 120504110642 Phpapp01Buzzientsiebelcrm 120504110642 Phpapp01
Buzzientsiebelcrm 120504110642 Phpapp01
 
Authentication and single sign on (sso)
Authentication and single sign on (sso)Authentication and single sign on (sso)
Authentication and single sign on (sso)
 
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013
SPCA2013 - Developing Provider-Hosted Apps for SharePoint 2013
 
3/3 : The path to CDI 2.0 - Antoine Sabot-Durand
3/3 : The path to CDI 2.0 - Antoine Sabot-Durand3/3 : The path to CDI 2.0 - Antoine Sabot-Durand
3/3 : The path to CDI 2.0 - Antoine Sabot-Durand
 
ZZ BC#8 Hello ASP.NET MVC 4 (dks)
ZZ BC#8 Hello ASP.NET MVC 4 (dks)ZZ BC#8 Hello ASP.NET MVC 4 (dks)
ZZ BC#8 Hello ASP.NET MVC 4 (dks)
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization
 
Creating web services
Creating web servicesCreating web services
Creating web services
 
2/3 : CDI advanced - Antoine Sabot-Durand
2/3 : CDI advanced - Antoine Sabot-Durand2/3 : CDI advanced - Antoine Sabot-Durand
2/3 : CDI advanced - Antoine Sabot-Durand
 
Rate Limiting - SLA Based Policy
Rate Limiting - SLA Based PolicyRate Limiting - SLA Based Policy
Rate Limiting - SLA Based Policy
 

Destaque

Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...Peter Sellars
 
Pacts to the Rescue - Making your microservices play nicely together with Con...
Pacts to the Rescue - Making your microservices play nicely together with Con...Pacts to the Rescue - Making your microservices play nicely together with Con...
Pacts to the Rescue - Making your microservices play nicely together with Con...Beth Skurrie
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Rob Crowley
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureMarcin Grzejszczak
 
Serverless Architectures and Continuous Delivery
Serverless Architectures and Continuous DeliveryServerless Architectures and Continuous Delivery
Serverless Architectures and Continuous DeliveryRobin Weston
 
Improve collaboration and confidence with Consumer-driven contracts
Improve collaboration and confidence with Consumer-driven contractsImprove collaboration and confidence with Consumer-driven contracts
Improve collaboration and confidence with Consumer-driven contractsPierre Vincent
 

Destaque (6)

Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
Lightening Talk: Auckland Continuous Delivery Meetup [Sept 2014] - Pact: Cons...
 
Pacts to the Rescue - Making your microservices play nicely together with Con...
Pacts to the Rescue - Making your microservices play nicely together with Con...Pacts to the Rescue - Making your microservices play nicely together with Con...
Pacts to the Rescue - Making your microservices play nicely together with Con...
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice Architecture
 
Serverless Architectures and Continuous Delivery
Serverless Architectures and Continuous DeliveryServerless Architectures and Continuous Delivery
Serverless Architectures and Continuous Delivery
 
Improve collaboration and confidence with Consumer-driven contracts
Improve collaboration and confidence with Consumer-driven contractsImprove collaboration and confidence with Consumer-driven contracts
Improve collaboration and confidence with Consumer-driven contracts
 

Semelhante a Consumer-driven contracts: avoid microservices integration hell! (MuCon London - Nov 2016)

CIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIsCIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIsCloudIDSummit
 
Complex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSComplex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSBoyan Dimitrov
 
Trusted by Default: The Forge Security & Privacy Model
Trusted by Default: The Forge Security & Privacy ModelTrusted by Default: The Forge Security & Privacy Model
Trusted by Default: The Forge Security & Privacy ModelAtlassian
 
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)Codit
 
Altitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeAltitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeFastly
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyMike Brittain
 
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdf
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdfDesign for Compliance - AWS FS Cloud Symposium Apr 2019.pdf
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdfAmazon Web Services
 
Social Sign-On with Authentication Providers Webinar
Social Sign-On with Authentication Providers WebinarSocial Sign-On with Authentication Providers Webinar
Social Sign-On with Authentication Providers WebinarSalesforce Developers
 
Recipes for a successful production cloudfoundry deployment - CF Summit 2014
Recipes for a successful production cloudfoundry deployment - CF Summit 2014Recipes for a successful production cloudfoundry deployment - CF Summit 2014
Recipes for a successful production cloudfoundry deployment - CF Summit 2014Vinícius Carvalho
 
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...VMware Tanzu
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Atlassian
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Atlassian
 
How to Manage Microservices and APIs with Apigee and Istio
How to Manage Microservices and APIs with Apigee and IstioHow to Manage Microservices and APIs with Apigee and Istio
How to Manage Microservices and APIs with Apigee and IstioVMware Tanzu
 
[Test bash NL] Contract testing in practice with Pact
[Test bash NL] Contract testing in practice with Pact[Test bash NL] Contract testing in practice with Pact
[Test bash NL] Contract testing in practice with PactPierre Vincent
 
Complex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSComplex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSBoyan Dimitrov
 
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...Amazon Web Services
 
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...Amazon Web Services
 
Intro to Muon - How to build Polyglot Message and Event Microservices
Intro to Muon - How to build Polyglot Message and Event MicroservicesIntro to Muon - How to build Polyglot Message and Event Microservices
Intro to Muon - How to build Polyglot Message and Event MicroservicesDavid Dawson
 

Semelhante a Consumer-driven contracts: avoid microservices integration hell! (MuCon London - Nov 2016) (20)

CIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIsCIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIs
 
Complex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSComplex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWS
 
Trusted by Default: The Forge Security & Privacy Model
Trusted by Default: The Forge Security & Privacy ModelTrusted by Default: The Forge Security & Privacy Model
Trusted by Default: The Forge Security & Privacy Model
 
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)
Enable Oauth2.0 with Sentinet API Management (Massimo Crippa @ BTUG Event)
 
Altitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeAltitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the Edge
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at Etsy
 
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdf
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdfDesign for Compliance - AWS FS Cloud Symposium Apr 2019.pdf
Design for Compliance - AWS FS Cloud Symposium Apr 2019.pdf
 
Social Sign-On with Authentication Providers Webinar
Social Sign-On with Authentication Providers WebinarSocial Sign-On with Authentication Providers Webinar
Social Sign-On with Authentication Providers Webinar
 
Social Sign-On with Authentication Providers
Social Sign-On with Authentication ProvidersSocial Sign-On with Authentication Providers
Social Sign-On with Authentication Providers
 
Recipes for a successful production cloudfoundry deployment - CF Summit 2014
Recipes for a successful production cloudfoundry deployment - CF Summit 2014Recipes for a successful production cloudfoundry deployment - CF Summit 2014
Recipes for a successful production cloudfoundry deployment - CF Summit 2014
 
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...
Cloud Foundry Cookbook: Recipes for a Successful Cloud Foundry Deployment in ...
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
 
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
 
How to Manage Microservices and APIs with Apigee and Istio
How to Manage Microservices and APIs with Apigee and IstioHow to Manage Microservices and APIs with Apigee and Istio
How to Manage Microservices and APIs with Apigee and Istio
 
OAuth
OAuthOAuth
OAuth
 
[Test bash NL] Contract testing in practice with Pact
[Test bash NL] Contract testing in practice with Pact[Test bash NL] Contract testing in practice with Pact
[Test bash NL] Contract testing in practice with Pact
 
Complex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWSComplex architectures for authentication and authorization on AWS
Complex architectures for authentication and authorization on AWS
 
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...
Identity Management for Your Users and Apps: A Deep Dive on Amazon Cognito - ...
 
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...
User Management and App Authentication with Amazon Cognito - SID343 - re:Inve...
 
Intro to Muon - How to build Polyglot Message and Event Microservices
Intro to Muon - How to build Polyglot Message and Event MicroservicesIntro to Muon - How to build Polyglot Message and Event Microservices
Intro to Muon - How to build Polyglot Message and Event Microservices
 

Mais de Pierre Vincent

DevOpsDays Galway 2019 - Zero-downtime deployments
DevOpsDays Galway 2019 - Zero-downtime deploymentsDevOpsDays Galway 2019 - Zero-downtime deployments
DevOpsDays Galway 2019 - Zero-downtime deploymentsPierre Vincent
 
[Test Bash Manchester] Observability and Testing
[Test Bash Manchester] Observability and Testing[Test Bash Manchester] Observability and Testing
[Test Bash Manchester] Observability and TestingPierre Vincent
 
QCon London - How to build observable distributed systems
QCon London - How to build observable distributed systemsQCon London - How to build observable distributed systems
QCon London - How to build observable distributed systemsPierre Vincent
 
[RebelCon] Increasing visibility of distributed systems in production
[RebelCon] Increasing visibility of distributed systems in production[RebelCon] Increasing visibility of distributed systems in production
[RebelCon] Increasing visibility of distributed systems in productionPierre Vincent
 
Deploying microservices in a fast-paced customer-centric environment: How and...
Deploying microservices in a fast-paced customer-centric environment: How and...Deploying microservices in a fast-paced customer-centric environment: How and...
Deploying microservices in a fast-paced customer-centric environment: How and...Pierre Vincent
 
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...Pierre Vincent
 
Agile at Newsweaver (Agile Cork March 2016)
Agile at Newsweaver (Agile Cork March 2016)Agile at Newsweaver (Agile Cork March 2016)
Agile at Newsweaver (Agile Cork March 2016)Pierre Vincent
 

Mais de Pierre Vincent (7)

DevOpsDays Galway 2019 - Zero-downtime deployments
DevOpsDays Galway 2019 - Zero-downtime deploymentsDevOpsDays Galway 2019 - Zero-downtime deployments
DevOpsDays Galway 2019 - Zero-downtime deployments
 
[Test Bash Manchester] Observability and Testing
[Test Bash Manchester] Observability and Testing[Test Bash Manchester] Observability and Testing
[Test Bash Manchester] Observability and Testing
 
QCon London - How to build observable distributed systems
QCon London - How to build observable distributed systemsQCon London - How to build observable distributed systems
QCon London - How to build observable distributed systems
 
[RebelCon] Increasing visibility of distributed systems in production
[RebelCon] Increasing visibility of distributed systems in production[RebelCon] Increasing visibility of distributed systems in production
[RebelCon] Increasing visibility of distributed systems in production
 
Deploying microservices in a fast-paced customer-centric environment: How and...
Deploying microservices in a fast-paced customer-centric environment: How and...Deploying microservices in a fast-paced customer-centric environment: How and...
Deploying microservices in a fast-paced customer-centric environment: How and...
 
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
 
Agile at Newsweaver (Agile Cork March 2016)
Agile at Newsweaver (Agile Cork March 2016)Agile at Newsweaver (Agile Cork March 2016)
Agile at Newsweaver (Agile Cork March 2016)
 

Último

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 

Último (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 

Consumer-driven contracts: avoid microservices integration hell! (MuCon London - Nov 2016)

Notas do Editor

  1. Touchy subject of microservices: integration tests If worked with > you know challenges when it comes to testing services together CDC is an approach to reduce these headaches Surfaced back yesterday in the thoughtworks tech radar as technique to adopt
  2. Been working for >8 years in Newsweaver SaaS company, Internal Comms platform/services for large enterprises improve and unify communication across channels by giving them tools to manage their content/campaigns and measuring engagement across channels Worked 6 years on large J2EE app Still going great, making for 90% of the company’s income 2 years ago, moved to a new team New product, opportunity to focus on Continuous Delivery Microservices emerged as our architecture of choice Now all of our new work is on microservices / splitting the monolith
  3. Rarely start from scratch - even if we do, we’ve usually been working on this system (left) - large, with components (if lucky), on one single DB etc - typically called monolith Then moving to microservices, look like this (right) - boundaries are clearer, concepts more clearly separate What’s missing is the interactions - in monolith, implicit, compile time, hard to break - in micro, more central, less validation (almost none!), easy to break if not careful
  4. Breaking example of API backward compatibility: Provider tests are all passing in build Provider deploys new version Some services then start throwing errors, even though they have not changed Why? Interactions got broken How do we test the interactions
  5. What are we testing? Can we login? Are we breaking an interaction? Who should test that? At what stage? Testing is there to stop us from doing something stupid We want to know as early as possible...
  6. The problem with end to end testing Why was this wrong? - team responsible for users need to concern themselves more than what they should - environment will take time to come up This is turning into a full e2e acceptance test. - there might still be value for e2e AT in the pipeline - but this is not what we’re trying to test here - temptation to think e2e AT cover everything Can we test that small thing here earlier? - anything we get faster feedback on is a win for our pipeline time In general e2e integration is really not practical - illusion of coverage (explosion of potential branches as nb of services go up) - slow, painful to maintain (e.g. UI based) - if it’s slow, this is stopping us from deploy (or even fixing forward) How do we get rid of this? This is where contracts testing comes in...
  7. We wanted to test the interaction - the idea behind CDC is to put the interaction at the center of the problem. By creating a contract between the 2 services, it makes things more explicit This is not an API specification that we write once and drift away from as the weeks go by! Consumers will have to ensure that they are using the provider in the way the contract specified Providers will have to ensure that they work the way the contract specified These contracts need to be tested and validated
  8. I will talk more specifically about PACT, framework we are using Some people roll their own thing, and it’s perfectly fine - PACT has worked great for our workflow, so why reinvent the wheel Pact terminology = a Pact (or Pact file) is a CDC between 2 services Pact spec = what the pact file contains, will go in more details, but quite simple - specify how interactions are defined Verif as Tolerant Reader / Postel’s Law: allows for flexibility in API evolution - ex. If provider starts sending back more fields, consumers shouldn’t be considered as broken (should ignore the new fields) - steers away for API versioning nightmares Implementation guidelines for the verification. Support in a lot of languages - on both sides of the puzzle (consumer / provider)
  9. Both parties are responsible for the interactions Consumer can define their expectations Provider can check that they are fulfilling them Contracts: Consumer define a contract, which is a set of interactions Interaction = request, response (in short) Provider verifies interactions by replaying requests and checking responses Benefits: Share the work, with each side keeping their concerns. Each step can be done separately, repeatedly and on their own time
  10. What’s inside the PACT file? Request: also query params, POST body...
  11. Replaying interaction Convert “plain english” provider state into state data (up to provider - consumer doesnt need to know db schema) Start service (or even faster, use test framework support to start in junit for ex) Replay the request from the contract Finally compare response with expected one Comparison follows tolerant reader pattern Comparison has flexibility, e.g. matchers on type only or regexps (allows for better flexibility - e.g. for generated fields)
  12. How do we share the PACTs? For small number of services/teams, start by copy/pasting - we did this for more than a year and it was fine (with 2 teams) Checking in repo and using URLs is also possible When it starts becoming painful, Pact Broker will help to scale up Pact Broker Consumers push the contracts they have generated Providers can query the broker for all contracts consumers have with them
  13. So it’s just some database of contracts? Kind of, but with a few added bonuses…
  14. Provider build workflow > Fast feedback during development > Find out unindented breaking change before commit Deployment workflow > Important if gap of time between build and deploy > Important if deploying to different environment (in that case there can be different PROD tags)
  15. Prevented breaking before deploying anything! (didn’t even break a test server!) HEAD pacts are “tentative” contracts that need to be verified by each related providers before the service can go forward. Provider pact tests are still unit tests, very quick to run - still no need to deploy anything.
  16. Original advantage: cover more interactions, faster, increase confidence in having backward compatible API. Extra finding: PACTs become very central to our way to work Team discuss them first thing when planning a new interaction
  17. Pacts against services that rely on state (e.g. with saved data) will require some setup logic (catered for with the assumptions piece) Large number of interactions and assumed starting state can put some pressure on the provider Confidence from the Pacts comes from interaction coverage Consumer tests must interact with mock and assert results, not check responses directly Beware of only testing happy paths. Errors are also interactions. But! Beware of being overzealous - this is probably not a place to test the Provider’s business logic (e.g. validation criteria) Integration in Build/Deploy workflow is key to scale Automating the verification prevents mistakes (CD book is all about this) Can be trickier when dealing with multiple live environments but tags are very powerful with the Broker Take the time to think about your flow and where the tests should sit best
  18. Increased in confidence when coding & deploying > Break fast, without having to deploy anything anywhere > Saved us many times (forgot consumers, forgot use case…) Relying less and less on full e2e env and tests > Reserved for acceptance and synthetic API design at the forefront > Interactions are discussed early “let’s see what the pact would look like” Consumer-driven benefits > API are designed with consumer in mind > Consumers are responsible for documenting their usage in PACT (“please don’t break this”) API documents itself as it’s being used > New consumers can check out existing pacts for examples of usage