SlideShare a Scribd company logo
1 of 21
Consumer-driven contracts
Improving collaboration and confidence
@PierreVincent
March 21st, 2017
PIPELINE
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
Don’t limit contracts to
happy paths interactions
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
Spring Cloud Contract (JVM only) https://cloud.spring.io/spring-cloud-contract
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

More Related Content

What's hot

Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
Nordic APIs
 
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorksTesting strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
Thoughtworks
 
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
camunda services GmbH
 

What's hot (20)

Hands on Ruby on Rails
Hands on Ruby on RailsHands on Ruby on Rails
Hands on Ruby on Rails
 
Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
 
From Continuous integration to Continuous Delivery with TeamCity
From Continuous integration to Continuous Delivery with TeamCityFrom Continuous integration to Continuous Delivery with TeamCity
From Continuous integration to Continuous Delivery with TeamCity
 
Leveraging JavaScript Promises and the Bulk API
Leveraging JavaScript Promises and the Bulk APILeveraging JavaScript Promises and the Bulk API
Leveraging JavaScript Promises and the Bulk API
 
Bring api manager into your stack
Bring api manager into your stackBring api manager into your stack
Bring api manager into your stack
 
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorksTesting strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks
 
Enterprise Node - Code Discoverability
Enterprise Node - Code DiscoverabilityEnterprise Node - Code Discoverability
Enterprise Node - Code Discoverability
 
Build 2017 - B8033 - Give your conversations superpowers: Building intelligen...
Build 2017 - B8033 - Give your conversations superpowers: Building intelligen...Build 2017 - B8033 - Give your conversations superpowers: Building intelligen...
Build 2017 - B8033 - Give your conversations superpowers: Building intelligen...
 
Bring Order to the Chaos: Take the MVC Plunge
Bring Order to the Chaos: Take the MVC PlungeBring Order to the Chaos: Take the MVC Plunge
Bring Order to the Chaos: Take the MVC Plunge
 
Getting started with mobile application development
Getting started with mobile application developmentGetting started with mobile application development
Getting started with mobile application development
 
Workflows and Digital Signatures
Workflows and Digital SignaturesWorkflows and Digital Signatures
Workflows and Digital Signatures
 
Fun with Jenkins & Salesforce
Fun with Jenkins & SalesforceFun with Jenkins & Salesforce
Fun with Jenkins & Salesforce
 
Lessons Learned from building a serverless API
Lessons Learned from building  a serverless APILessons Learned from building  a serverless API
Lessons Learned from building a serverless API
 
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformIntroduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce Platform
 
Restful services with ColdFusion
Restful services with ColdFusionRestful services with ColdFusion
Restful services with ColdFusion
 
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
CamundaCon 2018: Using Zeebe with Spring Boot and Apache Camel (Holisticon)
 
Release management with TFS 2013
Release management with TFS 2013Release management with TFS 2013
Release management with TFS 2013
 
Behavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shiftBehavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shift
 
Testing CRM from a 360 View - extremeCRM Rome 2013
Testing CRM from a 360 View - extremeCRM Rome 2013Testing CRM from a 360 View - extremeCRM Rome 2013
Testing CRM from a 360 View - extremeCRM Rome 2013
 
CI/CD using TFS Release Manager
CI/CD using TFS Release ManagerCI/CD using TFS Release Manager
CI/CD using TFS Release Manager
 

Viewers also liked

Muallim ul quran revised
Muallim ul quran revisedMuallim ul quran revised
Muallim ul quran revised
Sikander Ghunio
 

Viewers also liked (18)

Merge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescueMerge hells!! feature toggles to the rescue
Merge hells!! feature toggles to the rescue
 
Continuous delivery of embedded systems embedded meetup
Continuous delivery of embedded systems   embedded meetupContinuous delivery of embedded systems   embedded meetup
Continuous delivery of embedded systems embedded meetup
 
Xamarin 基礎講座
Xamarin 基礎講座Xamarin 基礎講座
Xamarin 基礎講座
 
Deep Learning技術の最近の動向とPreferred Networksの取り組み
Deep Learning技術の最近の動向とPreferred Networksの取り組みDeep Learning技術の最近の動向とPreferred Networksの取り組み
Deep Learning技術の最近の動向とPreferred Networksの取り組み
 
動画配信の基礎知識
動画配信の基礎知識動画配信の基礎知識
動画配信の基礎知識
 
Decorex Durban 2017 in pictures
Decorex Durban 2017 in picturesDecorex Durban 2017 in pictures
Decorex Durban 2017 in pictures
 
Propuestas de resolución 2017
Propuestas de resolución 2017Propuestas de resolución 2017
Propuestas de resolución 2017
 
New Declassified Report Exposes Hamas Human Shield Policy
New Declassified Report Exposes Hamas Human Shield PolicyNew Declassified Report Exposes Hamas Human Shield Policy
New Declassified Report Exposes Hamas Human Shield Policy
 
Perché le aziende devono essere presenti su internet
Perché le aziende devono essere presenti su internetPerché le aziende devono essere presenti su internet
Perché le aziende devono essere presenti su internet
 
Brand Storytelling - Miért használj a tartalomterjesztéshez fizetett hirdetés...
Brand Storytelling - Miért használj a tartalomterjesztéshez fizetett hirdetés...Brand Storytelling - Miért használj a tartalomterjesztéshez fizetett hirdetés...
Brand Storytelling - Miért használj a tartalomterjesztéshez fizetett hirdetés...
 
Sportcongres noord nederland Jaap van Zessen
Sportcongres noord nederland Jaap van ZessenSportcongres noord nederland Jaap van Zessen
Sportcongres noord nederland Jaap van Zessen
 
Presentación
PresentaciónPresentación
Presentación
 
Style Framework - SXSW2015
Style Framework - SXSW2015Style Framework - SXSW2015
Style Framework - SXSW2015
 
Webinar - Introducción a la ISO/IEC 29110-4-1:2011
Webinar - Introducción a la ISO/IEC 29110-4-1:2011Webinar - Introducción a la ISO/IEC 29110-4-1:2011
Webinar - Introducción a la ISO/IEC 29110-4-1:2011
 
Money Laundering Law Germany
Money Laundering Law GermanyMoney Laundering Law Germany
Money Laundering Law Germany
 
Don't Believe Trump's Hype: Regulations do Work for Business
Don't Believe Trump's Hype: Regulations do Work for BusinessDon't Believe Trump's Hype: Regulations do Work for Business
Don't Believe Trump's Hype: Regulations do Work for Business
 
Muallim ul quran revised
Muallim ul quran revisedMuallim ul quran revised
Muallim ul quran revised
 
Regalos del Chavez a otros Paises
Regalos del Chavez a otros PaisesRegalos del Chavez a otros Paises
Regalos del Chavez a otros Paises
 

Similar to Improve collaboration and confidence with Consumer-driven contracts

How Netflix Is Solving Authorization Across Their Cloud
How Netflix Is Solving Authorization Across Their CloudHow Netflix Is Solving Authorization Across Their Cloud
How Netflix Is Solving Authorization Across Their Cloud
Torin Sandall
 
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
Amazon Web Services
 

Similar to Improve collaboration and confidence with Consumer-driven contracts (20)

Consumer-driven contracts: avoid microservices integration hell! (MuCon Londo...
Consumer-driven contracts: avoid microservices integration hell! (MuCon Londo...Consumer-driven contracts: avoid microservices integration hell! (MuCon Londo...
Consumer-driven contracts: avoid microservices integration hell! (MuCon Londo...
 
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 - ...
 
[Test bash manchester] contract testing in practice
[Test bash manchester] contract testing in practice[Test bash manchester] contract testing in practice
[Test bash manchester] contract testing in practice
 
Azure AD B2C An Introduction - DogFoodCon 2018
Azure AD B2C An Introduction - DogFoodCon 2018Azure AD B2C An Introduction - DogFoodCon 2018
Azure AD B2C An Introduction - DogFoodCon 2018
 
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
 
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
 
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
 
CIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIsCIS14: Enterprise Identity APIs
CIS14: Enterprise Identity APIs
 
[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
 
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
 
How Netflix Is Solving Authorization Across Their Cloud
How Netflix Is Solving Authorization Across Their CloudHow Netflix Is Solving Authorization Across Their Cloud
How Netflix Is Solving Authorization Across Their Cloud
 
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
 
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
 
Simplify Your Front End Apps with Serverless Backend in the Cloud.
Simplify Your Front End Apps with Serverless Backend in the Cloud.Simplify Your Front End Apps with Serverless Backend in the Cloud.
Simplify Your Front End Apps with Serverless Backend in the Cloud.
 
OAuth
OAuthOAuth
OAuth
 
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
 
Build a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UIBuild a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UI
 
Build a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UIBuild a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UI
 

More from Pierre Vincent

More from Pierre Vincent (6)

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...
 
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)
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Improve collaboration and confidence with Consumer-driven contracts

Editor's Notes

  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 >9 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