SlideShare a Scribd company logo
1 of 38
Download to read offline
Laptop Devops
Daniel Lockman - Marcos Mercuri
Putting Modern Infrastructure Automation to Work for Local
Development
Who are you, folks?
Daniel Lockman
Lead developer at TW, started in NY.
Interests include fullstack dev, DevOps, and
data processing/engineering
Marcos Mercuri
Sr Software developer at TW. Been learning
how to make good software for more than
10 years, and still learning.
Why local development and
testing?
THE WHY THE HOW
THE WHAT
NOW
Featuring our friend the dev
workstation
How do these patterns fit
into the modern software
lifecycle?
What’s this all about?
But what’s the problem?
Your friendly neighborhood, the
test environment
Shared test environments have some significant problems in our experience:
● Contention over resources
● Difficulty of change attribution when things go wrong
● Special snowflake test environments
● “NOBODY TOUCH NOTHIN” syndrome
● The data... isn’t always the best
So…….. do it live?
Testing in production has a few clear advantages, and in certain cases can be a
simpler solution.
● You can be sure your code works against real external dependencies
● Doesn’t use additional test resources, less to maintain
● Works best for read-only dependencies
● Need to be very careful when manipulating data or environment for
testing purposes
Won’t be the focus of this presentation.
Why Local Development?
Wait! What is local development
exactly?
“The ability to develop software without external dependencies.”
● Not reliant on an internet connection
● Not reliant on software outside of the laptop
● Not sharing dependencies with other developers
● Ability to create meaningful business value without these dependencies
Some benefits
By writing code on my own computer and checking in “finished” work, I gain
some advantages.
● No internet needed!
● Independent sandboxed environment
● Can make potentially breaking changes without affecting others
● Full control of configuration
● Full access to debugging and logs without external noise
● See if my code actually works before committing to shared codebase
But aren’t some of these really testing…?
So what we really mean is testing
locally
Meaningful development locally means I need to confirm that my code actually
works:
● Calls external services correctly to orchestrate or for getting data
● Abides by contracts for services that depend on it
● Interacts correctly with tightly coupled infrastructure
○ Ex. Database, search, messaging middleware.
● Correctly handles reasonably prod-like test data or configuration
Principles of Local Development
ASAP + ASAP + ACAP
● As Soon As Possible
○ If I can test locally, I don’t need to wait to merge, deploy, etc
● As Sure As Possible
○ I can code on the airplane, and commit my changes, confident that it won’t break on
successive environments
● As Cheaply As Possible
○ I don't need extra environments
Shorten the feedback loop
But I have all these other tests!
Seems pointless...
● You still need to
○ Check it connects well with your infra
○ Connects well with the others dependencies in your machine
● Even with all your automated tests, there’s still room for manual testing
○ For exploratory testing
○ If you want to try some configurations tweaks
○ When a TDD test case is harder to write
There’s always going to be a scenario where you need to boot your service
So How Does This Work?
Introducing the “Developer
Workstation”
Setting up Our Own
Organization’s Services
The Problem
● Lots of different developer laptop environments
● Need to set things up consistently
● Lots of services and libraries that may conflict with local setup
Isolated Software Installs
● Vagrant
● Containers
○ We’re using docker, but there are other options
○ Will probably want some sort of orchestration to run these
common.yml
Dependencies on Infrastructure
Just Download Some Images?
● Often complicated setups or installation of 3rd party systems
● Configuration can widely change the behavior of the software
● Don’t want to write loads of custom scripts
More Hammers!
● Infrastructure Configuration/Orchestration Frameworks
○ Puppet / Chef / Ansible / Saltstack
● Fancier CI pipelines with image layers
Dependencies on External
Services
● How to deal with external dependencies
○ PACT for contract testing
○ Mountebank for stubbing over the wire
Example - Mountebank
How to manage my test data?
Features should be created with basic test datasets
● Flyway
○ Database schema versioning
○ Test data bootstrapping
Example - Flyway
Networking
Our Problems
● Local network environment can be very different than “real” environments
● Lots of services may have conflicting ports
● Orchestration heavy services may have lots of dependencies
○ Don’t want huge test configuration files
Our options
● Docker Networking (beware!)
○ More advanced with Kubernetes, Openshift, etc.
● Networking Middleware
○ Nginx, apache, consul
○ Bonus points if you’re already using it in production
● Full service discovery locally
● Hacking it together
○ This can get complicated quickly
○ Generally need custom scripts for each new service
Guidelines for Using this Magic
What do I want to test locally?
● End-to-end core business logic of service
● Interaction with tightly coupled dependencies
○ Database
○ Messaging system
● Contracts with other services or 3rd parties
● UI
● Bug reproduction
● Exploratory testing
What do I NOT want to test
locally?
● Don’t test performance
○ Too many things different from prod-like environment
● Don’t test the platform
● Depending on the size of your microservice architecture, you don’t want to
test all end-to-end features
Bringing it All Together
Local Development and CI/CD
Reinforce each other
● All services can be created and deployed programmatically
● Local development environment is a step away from creating CI
environments
● Investment in automation should be promoted upwards toward
production
○ Phoenixable environments and tracking of infrastructure changes is very important
for production
○ Test/local environments can be a special case of “real” environment infra-as-code
But do I even need CI anymore?
● YES
○ Local development is still only testing your changes
○ There will always be some things you can’t test locally
● BUT…
○ You can be a bit more liberal with your pipeline
○ Even with more overall steps, your pipeline will fail less frequently
■ Can focus on things that are harder to test locally
○ Average speed through the pipeline will increase
THANK YOU
For questions or suggestions:
Daniel Lockman - dlockman@thoughtworks.com
Marcos Mercuri - mmercuri@thoughtworks.com

More Related Content

What's hot

What's hot (20)

[QE 2015] Sam Elamin - Monoliths to microservices - a journey
[QE 2015] Sam Elamin - Monoliths to microservices - a journey[QE 2015] Sam Elamin - Monoliths to microservices - a journey
[QE 2015] Sam Elamin - Monoliths to microservices - a journey
 
MuleSoft London Community September 2020 - Project Vita
MuleSoft London Community September 2020 - Project VitaMuleSoft London Community September 2020 - Project Vita
MuleSoft London Community September 2020 - Project Vita
 
The Rules of Network Automation - Interop/NYC 2014
The Rules of Network Automation - Interop/NYC 2014The Rules of Network Automation - Interop/NYC 2014
The Rules of Network Automation - Interop/NYC 2014
 
SKS in git ops mode
SKS in git ops modeSKS in git ops mode
SKS in git ops mode
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
 
The current state of SAP Integration, SAPPHIRENOW 2018
The current state of SAP Integration, SAPPHIRENOW 2018The current state of SAP Integration, SAPPHIRENOW 2018
The current state of SAP Integration, SAPPHIRENOW 2018
 
Continuous delivery journey at LesFurets.com
Continuous delivery journey at LesFurets.comContinuous delivery journey at LesFurets.com
Continuous delivery journey at LesFurets.com
 
VOLODYMYR TSAP, BAQ, "CI/CD Infrastructure as a Code"
VOLODYMYR TSAP, BAQ, "CI/CD Infrastructure as a Code"VOLODYMYR TSAP, BAQ, "CI/CD Infrastructure as a Code"
VOLODYMYR TSAP, BAQ, "CI/CD Infrastructure as a Code"
 
Develop, deploy, and operate services at reddit scale oscon 2018
Develop, deploy, and operate services at reddit scale   oscon 2018Develop, deploy, and operate services at reddit scale   oscon 2018
Develop, deploy, and operate services at reddit scale oscon 2018
 
Kubernetes at Reddit: An Origin Story - KubeCon NA 2018
Kubernetes at Reddit: An Origin Story - KubeCon NA 2018Kubernetes at Reddit: An Origin Story - KubeCon NA 2018
Kubernetes at Reddit: An Origin Story - KubeCon NA 2018
 
Introduction to Lagom Framework
Introduction to Lagom FrameworkIntroduction to Lagom Framework
Introduction to Lagom Framework
 
What we do with Go
What we do with GoWhat we do with Go
What we do with Go
 
Everything as code
Everything as codeEverything as code
Everything as code
 
How Hootsuite Manages Its Growing Microservice Landscape
How Hootsuite Manages Its Growing Microservice LandscapeHow Hootsuite Manages Its Growing Microservice Landscape
How Hootsuite Manages Its Growing Microservice Landscape
 
Why golang
Why golangWhy golang
Why golang
 
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ IntegrationsMumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
 
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
 
Hyperledger composer (from zero to hero )
Hyperledger composer  (from zero to hero )Hyperledger composer  (from zero to hero )
Hyperledger composer (from zero to hero )
 
Of Microservices and Microservices - Robert Munteanu
Of Microservices and Microservices -  Robert MunteanuOf Microservices and Microservices -  Robert Munteanu
Of Microservices and Microservices - Robert Munteanu
 
Tce automation-d4
Tce automation-d4Tce automation-d4
Tce automation-d4
 

Similar to Laptop Devops: Putting Modern Infrastructure Automation to Work For Local Development - Marcos Mercuri & Daniel Lockman

Similar to Laptop Devops: Putting Modern Infrastructure Automation to Work For Local Development - Marcos Mercuri & Daniel Lockman (20)

Monitoring and automation
Monitoring and automationMonitoring and automation
Monitoring and automation
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
 
The working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор ТурскийThe working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор Турский
 
The working architecture of node js applications open tech week javascript ...
The working architecture of node js applications   open tech week javascript ...The working architecture of node js applications   open tech week javascript ...
The working architecture of node js applications open tech week javascript ...
 
Path Dependent Development (PyCon AU)
Path Dependent Development (PyCon AU)Path Dependent Development (PyCon AU)
Path Dependent Development (PyCon AU)
 
Path dependent-development (PyCon India)
Path dependent-development (PyCon India)Path dependent-development (PyCon India)
Path dependent-development (PyCon India)
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
 
Not my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureNot my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructure
 
Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
 
Devops, the future is here, it's just not evenly distributed yet.
Devops, the future is here, it's just not evenly distributed yet.Devops, the future is here, it's just not evenly distributed yet.
Devops, the future is here, it's just not evenly distributed yet.
 
Break Up the Monolith- Testing Microservices by Marcus Merrell
Break Up the Monolith- Testing Microservices by Marcus MerrellBreak Up the Monolith- Testing Microservices by Marcus Merrell
Break Up the Monolith- Testing Microservices by Marcus Merrell
 
Continuous integration (eng)
Continuous integration (eng)Continuous integration (eng)
Continuous integration (eng)
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Investing in a good software factory and automating the build process
Investing in a good software factory and automating the build processInvesting in a good software factory and automating the build process
Investing in a good software factory and automating the build process
 
Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...Designing and coding for cloud-native applications using Python, Harjinder Mi...
Designing and coding for cloud-native applications using Python, Harjinder Mi...
 
The Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security TestingThe Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security Testing
 
Serverless java
Serverless   javaServerless   java
Serverless java
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering Teams
 

More from Thoughtworks

More from Thoughtworks (20)

Design System as a Product
Design System as a ProductDesign System as a Product
Design System as a Product
 
Designers, Developers & Dogs
Designers, Developers & DogsDesigners, Developers & Dogs
Designers, Developers & Dogs
 
Cloud-first for fast innovation
Cloud-first for fast innovationCloud-first for fast innovation
Cloud-first for fast innovation
 
More impact with flexible teams
More impact with flexible teamsMore impact with flexible teams
More impact with flexible teams
 
Culture of Innovation
Culture of InnovationCulture of Innovation
Culture of Innovation
 
Dual-Track Agile
Dual-Track AgileDual-Track Agile
Dual-Track Agile
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer Experience
 
When we design together
When we design togetherWhen we design together
When we design together
 
Hardware is hard(er)
Hardware is hard(er)Hardware is hard(er)
Hardware is hard(er)
 
Customer-centric innovation enabled by cloud
 Customer-centric innovation enabled by cloud Customer-centric innovation enabled by cloud
Customer-centric innovation enabled by cloud
 
Amazon's Culture of Innovation
Amazon's Culture of InnovationAmazon's Culture of Innovation
Amazon's Culture of Innovation
 
When in doubt, go live
When in doubt, go liveWhen in doubt, go live
When in doubt, go live
 
Don't cross the Rubicon
Don't cross the RubiconDon't cross the Rubicon
Don't cross the Rubicon
 
Error handling
Error handlingError handling
Error handling
 
Your test coverage is a lie!
Your test coverage is a lie!Your test coverage is a lie!
Your test coverage is a lie!
 
Docker container security
Docker container securityDocker container security
Docker container security
 
Redefining the unit
Redefining the unitRedefining the unit
Redefining the unit
 
Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22
 
A Tribute to Turing
A Tribute to TuringA Tribute to Turing
A Tribute to Turing
 
Rsa maths worked out
Rsa maths worked outRsa maths worked out
Rsa maths worked out
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 

Laptop Devops: Putting Modern Infrastructure Automation to Work For Local Development - Marcos Mercuri & Daniel Lockman

  • 1. Laptop Devops Daniel Lockman - Marcos Mercuri Putting Modern Infrastructure Automation to Work for Local Development
  • 2. Who are you, folks? Daniel Lockman Lead developer at TW, started in NY. Interests include fullstack dev, DevOps, and data processing/engineering Marcos Mercuri Sr Software developer at TW. Been learning how to make good software for more than 10 years, and still learning.
  • 3. Why local development and testing? THE WHY THE HOW THE WHAT NOW Featuring our friend the dev workstation How do these patterns fit into the modern software lifecycle? What’s this all about?
  • 4. But what’s the problem?
  • 5. Your friendly neighborhood, the test environment Shared test environments have some significant problems in our experience: ● Contention over resources ● Difficulty of change attribution when things go wrong ● Special snowflake test environments ● “NOBODY TOUCH NOTHIN” syndrome ● The data... isn’t always the best
  • 6. So…….. do it live? Testing in production has a few clear advantages, and in certain cases can be a simpler solution. ● You can be sure your code works against real external dependencies ● Doesn’t use additional test resources, less to maintain ● Works best for read-only dependencies ● Need to be very careful when manipulating data or environment for testing purposes Won’t be the focus of this presentation.
  • 8. Wait! What is local development exactly? “The ability to develop software without external dependencies.” ● Not reliant on an internet connection ● Not reliant on software outside of the laptop ● Not sharing dependencies with other developers ● Ability to create meaningful business value without these dependencies
  • 9. Some benefits By writing code on my own computer and checking in “finished” work, I gain some advantages. ● No internet needed! ● Independent sandboxed environment ● Can make potentially breaking changes without affecting others ● Full control of configuration ● Full access to debugging and logs without external noise ● See if my code actually works before committing to shared codebase But aren’t some of these really testing…?
  • 10. So what we really mean is testing locally Meaningful development locally means I need to confirm that my code actually works: ● Calls external services correctly to orchestrate or for getting data ● Abides by contracts for services that depend on it ● Interacts correctly with tightly coupled infrastructure ○ Ex. Database, search, messaging middleware. ● Correctly handles reasonably prod-like test data or configuration
  • 11. Principles of Local Development
  • 12. ASAP + ASAP + ACAP ● As Soon As Possible ○ If I can test locally, I don’t need to wait to merge, deploy, etc ● As Sure As Possible ○ I can code on the airplane, and commit my changes, confident that it won’t break on successive environments ● As Cheaply As Possible ○ I don't need extra environments Shorten the feedback loop
  • 13. But I have all these other tests! Seems pointless... ● You still need to ○ Check it connects well with your infra ○ Connects well with the others dependencies in your machine ● Even with all your automated tests, there’s still room for manual testing ○ For exploratory testing ○ If you want to try some configurations tweaks ○ When a TDD test case is harder to write There’s always going to be a scenario where you need to boot your service
  • 14. So How Does This Work?
  • 16. Setting up Our Own Organization’s Services
  • 17. The Problem ● Lots of different developer laptop environments ● Need to set things up consistently ● Lots of services and libraries that may conflict with local setup
  • 18. Isolated Software Installs ● Vagrant ● Containers ○ We’re using docker, but there are other options ○ Will probably want some sort of orchestration to run these
  • 21. Just Download Some Images? ● Often complicated setups or installation of 3rd party systems ● Configuration can widely change the behavior of the software ● Don’t want to write loads of custom scripts
  • 22. More Hammers! ● Infrastructure Configuration/Orchestration Frameworks ○ Puppet / Chef / Ansible / Saltstack ● Fancier CI pipelines with image layers
  • 23.
  • 24.
  • 25. Dependencies on External Services ● How to deal with external dependencies ○ PACT for contract testing ○ Mountebank for stubbing over the wire
  • 27. How to manage my test data? Features should be created with basic test datasets ● Flyway ○ Database schema versioning ○ Test data bootstrapping
  • 30. Our Problems ● Local network environment can be very different than “real” environments ● Lots of services may have conflicting ports ● Orchestration heavy services may have lots of dependencies ○ Don’t want huge test configuration files
  • 31. Our options ● Docker Networking (beware!) ○ More advanced with Kubernetes, Openshift, etc. ● Networking Middleware ○ Nginx, apache, consul ○ Bonus points if you’re already using it in production ● Full service discovery locally ● Hacking it together ○ This can get complicated quickly ○ Generally need custom scripts for each new service
  • 32. Guidelines for Using this Magic
  • 33. What do I want to test locally? ● End-to-end core business logic of service ● Interaction with tightly coupled dependencies ○ Database ○ Messaging system ● Contracts with other services or 3rd parties ● UI ● Bug reproduction ● Exploratory testing
  • 34. What do I NOT want to test locally? ● Don’t test performance ○ Too many things different from prod-like environment ● Don’t test the platform ● Depending on the size of your microservice architecture, you don’t want to test all end-to-end features
  • 35. Bringing it All Together
  • 36. Local Development and CI/CD Reinforce each other ● All services can be created and deployed programmatically ● Local development environment is a step away from creating CI environments ● Investment in automation should be promoted upwards toward production ○ Phoenixable environments and tracking of infrastructure changes is very important for production ○ Test/local environments can be a special case of “real” environment infra-as-code
  • 37. But do I even need CI anymore? ● YES ○ Local development is still only testing your changes ○ There will always be some things you can’t test locally ● BUT… ○ You can be a bit more liberal with your pipeline ○ Even with more overall steps, your pipeline will fail less frequently ■ Can focus on things that are harder to test locally ○ Average speed through the pipeline will increase
  • 38. THANK YOU For questions or suggestions: Daniel Lockman - dlockman@thoughtworks.com Marcos Mercuri - mmercuri@thoughtworks.com