Containerised Testing at Demonware : PyCon Ireland 2016

Thomas Shaw
Thomas ShawSystems Engineer
PyCon Ireland 2016
Containerised Testing at Demonware
“Quality is free, but
only to those willing
to pay heavily for
it.”
T. DeMarco and T. Lister
Who are Demonware?
Demonware provide online services and infrastructure for some of the
world’s most popular video game franchises.
Bio
Thomas is a Build Engineer at Demonware and works closely with the
development teams to optimise their CI/CD pipelines. His background is
in QA and other roles include Configuration Management and Test Tools
automation.
James is a Django developer on a Demonware internal product. Before
Demonware he worked at a handful of startups, largely in web
development.
Pets vs Cattle
CaaS
4 Stages of
Evolution
TaaS
Continuous
Delivery
Agenda
The future
Continuous Delivery
Define Develop Build Integrate Test Release Deploy
Continuous Delivery
Continuous Integration
Why Continuous Delivery ?
● Deliver new services, features and updates rapidly
● Reduce manual intervention
● Shorter feedback loop
● Reduce cost of deployments
● Reduce risk
Quality is no longer important ...
It’s
C R I T I C A L
Continuous Delivery without Quality
Best case scenario Worst case scenario
Time to deliver
● The Continuous Delivery pipeline is only as fast as the slowest stage
● The Build and Deploy stages took minutes
● The Test stage took 6+ hours for a full set of testsuites to complete
● The Test stage was a blockage in our CD pipeline
Development teams began optimising
their tests.
• Split across containers
• Measure execution time to
manage slices of tests
• Quality metrics like static analysis
and coverage reports
The Build Engineering team began
optimising the test environments.
• Test infrastructure as code
• Immutable and platform agnostic
test environments
• Eliminate “Dependency Hell”
Optimising the Test stage
Tests are run in fresh containers;
new test run, new container.
Container images are built from
code.
Developers control the test
environment dependencies.
Test environments are easily
reproducible anywhere.
Test environments are manually
configured. Setup and tear down
happens with each test run.
Each test environment is a
snowflake.
Everyone has root access.
Environments are never updated
for fear of breaking tests.
Pets Cattle
Baremetal Vagrant VMs Docker
Containers
./setup
./start tests
./teardown
./setup
./start
./teardown
./setup
./start
./teardown
./setup
./start
./teardown
./setup
./start
./teardown
Moving from Pets towards Cattle
2012 2013 2014 - Present
4 Stages of Evolution
1 : Fat containers
2 : Containers wrapped in Bash
3 : Containers defined in yaml
4 : Containers as a service
Fat containers
What is a “Fat” container and how was it created?
In this context it is a container with multiple services installed.
We tarred up a CentOS vagrant vm and imported into a docker image.
Pros :
1. It helped get the ball rolling
2. Everything needed to run tests was included
3. Image caching reduced the time required to build new images
Cons :
1. Large base container image. Approximately 3gig
2. The container ran multiple supporting services such as MySQL, RabbitMQ, Apache
3. It took almost as long as a VM for all services to become available
Containers wrapped in Bash
As we began splitting services out into their own containers we needed a way to co-ordinate them.
In particular we needed to link containers and wait for services to become available. We used a
high level bash wrapper to start, link and wait for containers to become ready.
Pros :
1. The script was initially quite simple
2. It filled a gap in tooling around multi container deployments (June 2014)
Cons :
1. The script was duplicated across multiple projects and became unwieldy
2. A lot of logic required to check a service health/status
3. Fragile
Containers defined in yaml
We began using docker-compose in August 2015. Compose allowed developers to define
complex container orchestration in YAML.
Example :
testsuite:
build: unittest
command: python testrunner.py
ports:
- "80:80"
volumes:
- unittests:/unittests
links:
- percona
percona:
image: percona
Containers defined in yaml
Pros :
1. Compose is easy to use
2. Portable
3. Repeatable
4. Container configuration defined in code
5. Container orchestration requirements defined in code
Cons :
1. Runs on a single host. Not fully cluster aware. This will change very soon.
Test Containers
Limitation of first 3 stages
● Single host, fixed resources
● Fixed number of Test Containers per host
● Fixed number of Tests per Container
● Local debugging of failures is difficult
● Re-running failed/flaky tests is expensive
Containers as a service
We are currently in this stage. With the release of Docker 1.12 we started to look at how and
where tests are being run.
2 key features in 1.12 :
● Swarm Mode
○ Natively manage a cluster of Docker Engines called a swarm. Use the Docker CLI to
create a swarm, deploy application services to a swarm, and manage swarm behavior.
● Services
○ Docker services enables the use to start a replicated, distributed, load balanced
service on a swarm of Engines.
Containers as a service
Docker Swarm mode and Services enable us to provide a much more flexible yet robust and
scalable test environment.
Tests as a service
Like any Swarm service, the number of containers is scalable based on the resources available in
the Test Cluster.
We need a dynamic way of splitting tests at execution time to maximise the usefulness of this.
Populate a Redis service with test case names.
Each container grabs a chunk of tests from the Redis service. Tests are run and results stored in
a shared mount point across all nodes.
What does the test cluster look like?
Shared volume mounted using GlusterFS. Used for results, logs etc
Manager Manager Manager WorkerWorkerWorker Worker Worker
Team A Unit
Tests
Team B Unit
Tests
Docker Registry
(Global)
Redis (Global)
Tests as a service
How do we create a test service?
● docker service create --name unittests --replicas 1 <image_name>
How do we scale up the test tasks as resources become available ?
● docker service scale unittests=50
How do we scale down when tests are finished ?
● docker service scale unittests=0
What does this look like ?
Check
Cluster
Resources
Create
overlay
network
Start Redis
Population
service
Create Test
Service
Cleanup
Services
Execute
Tests
Stop Redis
Population
service
Create Redis
Global
service
Create
shared work
directory
The code
Create overlay network :
docker network create -d overlay --subnet 10.0.9.0/24 network_unittests_129
Create global Redis service :
docker service create --name 129_redis --network network_unittests_129 --mount
type=bind,src=/home/test_cluster/unittest/129,dst=/data -p 6379:6379 redis
Populate Redis service :
docker service create --name 129_redis_populate --network network_unittests_129 --mount
type=bind,src=/home/test_cluster/unittest/129,dst=/tmp --replicas=1
127.0.0.1:5000/populate_redis:latest -c 'cat /tmp/testlist |redis-cli -h 129_redis -p 6379'
Start Test Service :
docker service create --name 129_tests --env REDIS_SERVICE=129_redis --network
network_unittests_129 --mount type=bind,src=/home/test_cluster/results/129,dst=/results
--replicas=12 127.0.0.1:5000/unittest:129
What other benefits does Docker
Swarm provide ?
● Easy to setup
○ docker swarm init
○ docker swarm join --token <swarm_token> <ip of manager>
● Secure by default. Uses TLS
● Service discovery
● Load Balancing
● Scaling
● Desired State reconciliation
● Multi-host networking
● Rolling updates
Test Containers
What Docker Swarm solves
● Single host, fixed resources
● Fixed number of Test Containers per host
● Fixed number of Tests per Container
● Local debugging of failures is difficult
● Re-running failed/flaky tests is expensive
SOLVED
SOLVED
SOLVED
SOLVED
SOLVED
Summary
● We increase our resource use, but not by 'throwing resources at it'
- instead we optimise for parallel execution
● With a relatively small time investment we were able to innovate
● The tools used to create and manage the test cluster are open source
■ Docker : https://www.docker.com/
■ Ansible : https://www.ansible.com/
■ GlusterFS : https://www.gluster.org/
■ Swarm Visualizer :
https://github.com/ManoMarks/docker-swarm-visualizer
● Our containerised tests can scale seamlessly across 3 different
platforms
We are hiring:
Full details at demonware.net
Or email : jobs@demonware.net
Internships available.
Drop by our stand for more details.
Contact details :
thshaw@demonware.net / @tomwillfixit
jheslin@demonware.net / @PROGRAM_IX
Follow us @demonware for engineering
related content.
Meetup : meetup.com/Docker-Dublin/
Upcoming Event
Containerised Testing at Demonware : PyCon Ireland 2016
1 of 34

Recommended

DockerCon2017 - Skypilot by
DockerCon2017 - SkypilotDockerCon2017 - Skypilot
DockerCon2017 - SkypilotThomas Shaw
381 views28 slides
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12 by
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12Puppet
1.7K views31 slides
Dev to Delivery with Puppet, Vagrant and AWS by
Dev to Delivery with Puppet, Vagrant and AWSDev to Delivery with Puppet, Vagrant and AWS
Dev to Delivery with Puppet, Vagrant and AWSPuppet
4.4K views35 slides
Puppet@Citygrid - Julien Rottenberg - PuppetCamp LA '12 by
Puppet@Citygrid - Julien Rottenberg - PuppetCamp LA '12Puppet@Citygrid - Julien Rottenberg - PuppetCamp LA '12
Puppet@Citygrid - Julien Rottenberg - PuppetCamp LA '12Puppet
808 views33 slides
Puppet and Telefonica R&D by
Puppet and Telefonica R&DPuppet and Telefonica R&D
Puppet and Telefonica R&DPuppet
1.4K views33 slides
The State of Puppet - Dan Bode by
The State of Puppet - Dan BodeThe State of Puppet - Dan Bode
The State of Puppet - Dan BodePuppet
1.1K views38 slides

More Related Content

What's hot

Continuous delivery with jenkins, docker and exoscale by
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleJulia Mateo
4.2K views35 slides
Immutable infrastructure with Docker and containers (GlueCon 2015) by
Immutable infrastructure with Docker and containers (GlueCon 2015)Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)Jérôme Petazzoni
20.2K views59 slides
Testing with Docker by
Testing with DockerTesting with Docker
Testing with Dockertoffermann
5.9K views56 slides
Taking Docker to Production: What You Need to Know and Decide by
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideDocker, Inc.
1K views62 slides
Learn docker in 90 minutes by
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
22.8K views20 slides
Docker Continuous Delivery Workshop by
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
3K views26 slides

What's hot(20)

Continuous delivery with jenkins, docker and exoscale by Julia Mateo
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscale
Julia Mateo4.2K views
Immutable infrastructure with Docker and containers (GlueCon 2015) by Jérôme Petazzoni
Immutable infrastructure with Docker and containers (GlueCon 2015)Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)
Jérôme Petazzoni20.2K views
Testing with Docker by toffermann
Testing with DockerTesting with Docker
Testing with Docker
toffermann5.9K views
Taking Docker to Production: What You Need to Know and Decide by Docker, Inc.
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
Docker, Inc.1K views
Learn docker in 90 minutes by Larry Cai
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
Larry Cai22.8K views
PuppetCamp SEA 1 - The State of Puppet by Walter Heck
PuppetCamp SEA 1 - The State of PuppetPuppetCamp SEA 1 - The State of Puppet
PuppetCamp SEA 1 - The State of Puppet
Walter Heck479 views
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS by Bamdad Dashtban
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWSAutomated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Bamdad Dashtban29.9K views
Docker for Devs - John Zaccone, IBM by Docker, Inc.
Docker for Devs - John Zaccone, IBMDocker for Devs - John Zaccone, IBM
Docker for Devs - John Zaccone, IBM
Docker, Inc.466 views
How to write a Dockerfile by Knoldus Inc.
How to write a DockerfileHow to write a Dockerfile
How to write a Dockerfile
Knoldus Inc.307 views
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor... by Docker, Inc.
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Docker, Inc.33K views
Intro to Docker and clustering with Rancher from scratch by John Culviner
Intro to Docker and clustering with Rancher from scratchIntro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratch
John Culviner2.5K views
Joomla Continuous Delivery with Docker by Jirayut Nimsaeng
Joomla Continuous Delivery with DockerJoomla Continuous Delivery with Docker
Joomla Continuous Delivery with Docker
Jirayut Nimsaeng7.7K views
On-Demand Image Resizing from Part of the monolith to Containerized Microserv... by Docker, Inc.
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
On-Demand Image Resizing from Part of the monolith to Containerized Microserv...
Docker, Inc.711 views
From development environments to production deployments with Docker, Compose,... by Jérôme Petazzoni
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni33K views
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf by Julia Mateo
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfContinuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Julia Mateo5.2K views
Docker and Containers for Development and Deployment — SCALE12X by Jérôme Petazzoni
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12X
Jérôme Petazzoni25.5K views
Workshop: Know Before You Push 'Go': Using the Beaker Acceptance Test Framewo... by Puppet
Workshop: Know Before You Push 'Go': Using the Beaker Acceptance Test Framewo...Workshop: Know Before You Push 'Go': Using the Beaker Acceptance Test Framewo...
Workshop: Know Before You Push 'Go': Using the Beaker Acceptance Test Framewo...
Puppet4.6K views
DCSF19 CMD and Conquer: Containerizing the Monolith by Docker, Inc.
DCSF19 CMD and Conquer: Containerizing the Monolith  DCSF19 CMD and Conquer: Containerizing the Monolith
DCSF19 CMD and Conquer: Containerizing the Monolith
Docker, Inc.245 views
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16 by Docker, Inc.
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16 What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
Docker, Inc.9.9K views

Viewers also liked

Connect2013 id506 hadr ideas for social business by
Connect2013 id506 hadr ideas for social businessConnect2013 id506 hadr ideas for social business
Connect2013 id506 hadr ideas for social businessLuis Guirigay
1.1K views39 slides
The State of Puppet by
The State of PuppetThe State of Puppet
The State of PuppetPuppet
580 views44 slides
Stop Sucking at Building Stuff! by
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Puppet
1.2K views30 slides
Granite Lotus User Group November 2012 ICS Updates by
Granite Lotus User Group November 2012 ICS UpdatesGranite Lotus User Group November 2012 ICS Updates
Granite Lotus User Group November 2012 ICS UpdatesLuis Guirigay
549 views19 slides
Puppet at the Centre of Everything by
Puppet at the Centre of EverythingPuppet at the Centre of Everything
Puppet at the Centre of EverythingPuppet
1.1K views68 slides
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-Bending by
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-BendingIBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-Bending
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-BendingLuis Guirigay
2.1K views76 slides

Viewers also liked(20)

Connect2013 id506 hadr ideas for social business by Luis Guirigay
Connect2013 id506 hadr ideas for social businessConnect2013 id506 hadr ideas for social business
Connect2013 id506 hadr ideas for social business
Luis Guirigay1.1K views
The State of Puppet by Puppet
The State of PuppetThe State of Puppet
The State of Puppet
Puppet580 views
Stop Sucking at Building Stuff! by Puppet
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!
Puppet1.2K views
Granite Lotus User Group November 2012 ICS Updates by Luis Guirigay
Granite Lotus User Group November 2012 ICS UpdatesGranite Lotus User Group November 2012 ICS Updates
Granite Lotus User Group November 2012 ICS Updates
Luis Guirigay549 views
Puppet at the Centre of Everything by Puppet
Puppet at the Centre of EverythingPuppet at the Centre of Everything
Puppet at the Centre of Everything
Puppet1.1K views
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-Bending by Luis Guirigay
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-BendingIBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-Bending
IBM ConnectED 2015 - BP103: Solving the Weird, the Obscure, and the Mind-Bending
Luis Guirigay2.1K views
Managing RightScale on RightScale by RightScale
Managing RightScale on RightScaleManaging RightScale on RightScale
Managing RightScale on RightScale
RightScale515 views
Operations Playbook: Monitoring and Automation - RightScale Compute 2013 by RightScale
Operations Playbook: Monitoring and Automation - RightScale Compute 2013Operations Playbook: Monitoring and Automation - RightScale Compute 2013
Operations Playbook: Monitoring and Automation - RightScale Compute 2013
RightScale2.3K views
Getting Started With Puppet - Chad Metcalf by Puppet
Getting Started With Puppet - Chad MetcalfGetting Started With Puppet - Chad Metcalf
Getting Started With Puppet - Chad Metcalf
Puppet1.6K views
Introduction to Puppet Enterprise 2016.5 by Puppet
Introduction to Puppet Enterprise 2016.5Introduction to Puppet Enterprise 2016.5
Introduction to Puppet Enterprise 2016.5
Puppet633 views
Puppets around the_world by nutmegblue
Puppets around the_worldPuppets around the_world
Puppets around the_world
nutmegblue12.1K views
Top 10 business benefits of it automation by Puppet
Top 10 business benefits of it automationTop 10 business benefits of it automation
Top 10 business benefits of it automation
Puppet7K views
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet by Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
Puppet2K views
Puppets by JEENA AEJY
PuppetsPuppets
Puppets
JEENA AEJY10.2K views
Introduction to Puppet Enterprise 2016.5 by Puppet
Introduction to Puppet Enterprise 2016.5Introduction to Puppet Enterprise 2016.5
Introduction to Puppet Enterprise 2016.5
Puppet652 views
Introduction to Puppet Enterprise by Puppet
Introduction to Puppet EnterpriseIntroduction to Puppet Enterprise
Introduction to Puppet Enterprise
Puppet634 views
automation testing benefits by nazeer pasha
automation testing benefitsautomation testing benefits
automation testing benefits
nazeer pasha6.7K views

Similar to Containerised Testing at Demonware : PyCon Ireland 2016

Resilience Testing by
Resilience Testing Resilience Testing
Resilience Testing Ran Levy
302 views33 slides
Cloud Native Dünyada CI/CD by
Cloud Native Dünyada CI/CDCloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CDMustafa AKIN
354 views41 slides
Prod-Like Integration Testing for Distributed Containerized Applications by
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsVMware Tanzu
302 views50 slides
Stop Being Lazy and Test Your Software by
Stop Being Lazy and Test Your SoftwareStop Being Lazy and Test Your Software
Stop Being Lazy and Test Your SoftwareLaura Frank Tacho
15.8K views75 slides
Austin - Container Days - Docker 101 by
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
362 views40 slides
Docker Swarm secrets for creating great FIWARE platforms by
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsFederico Michele Facca
300 views35 slides

Similar to Containerised Testing at Demonware : PyCon Ireland 2016(20)

Resilience Testing by Ran Levy
Resilience Testing Resilience Testing
Resilience Testing
Ran Levy302 views
Cloud Native Dünyada CI/CD by Mustafa AKIN
Cloud Native Dünyada CI/CDCloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CD
Mustafa AKIN354 views
Prod-Like Integration Testing for Distributed Containerized Applications by VMware Tanzu
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized Applications
VMware Tanzu302 views
Stop Being Lazy and Test Your Software by Laura Frank Tacho
Stop Being Lazy and Test Your SoftwareStop Being Lazy and Test Your Software
Stop Being Lazy and Test Your Software
Laura Frank Tacho15.8K views
Austin - Container Days - Docker 101 by Bill Maxwell
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
Bill Maxwell362 views
DCEU 18: Building Your Development Pipeline by Docker, Inc.
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
Docker, Inc.1.6K views
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms by FIWARE
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE192 views
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc... by eZ Systems
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
eZ Systems1.1K views
Anatomy of a Build Pipeline by Samuel Brown
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build Pipeline
Samuel Brown3.5K views
Scala, docker and testing, oh my! mario camou by J On The Beach
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
J On The Beach2.8K views
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline by KubeAcademy
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeAcademy761 views
ContainerDayVietnam2016: Dockerize a small business by Docker-Hanoi
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
Docker-Hanoi498 views
Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche... by Richard Bullington-McGuire
Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche...Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche...
Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche...
Docker dev ops for cd meetup 12-14 by Simon Storm
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
Simon Storm1.1K views
Using Rancher and Docker with RightScale at Industrie IT by RightScale
Using Rancher and Docker with RightScale at Industrie IT Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT
RightScale1.8K views
Getting Started with MariaDB with Docker by MariaDB plc
Getting Started with MariaDB with DockerGetting Started with MariaDB with Docker
Getting Started with MariaDB with Docker
MariaDB plc1.2K views
ContainerCon - Test Driven Infrastructure by Yury Tsarev
ContainerCon - Test Driven InfrastructureContainerCon - Test Driven Infrastructure
ContainerCon - Test Driven Infrastructure
Yury Tsarev2.6K views
DCSF 19 Building Your Development Pipeline by Docker, Inc.
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
Docker, Inc.467 views

Recently uploaded

Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...NUS-ISS
28 views70 slides
20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
28 views73 slides
Top 10 Strategic Technologies in 2024: AI and Automation by
Top 10 Strategic Technologies in 2024: AI and AutomationTop 10 Strategic Technologies in 2024: AI and Automation
Top 10 Strategic Technologies in 2024: AI and AutomationAutomationEdge Technologies
14 views14 slides
Attacking IoT Devices from a Web Perspective - Linux Day by
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Simone Onofri
15 views68 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
50 views21 slides

Recently uploaded(20)

Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS28 views
Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 views
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze by NUS-ISS
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeDigital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
NUS-ISS19 views
Combining Orchestration and Choreography for a Clean Architecture by ThomasHeinrichs1
Combining Orchestration and Choreography for a Clean ArchitectureCombining Orchestration and Choreography for a Clean Architecture
Combining Orchestration and Choreography for a Clean Architecture
ThomasHeinrichs169 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta15 views
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada130 views
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... by Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin75 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab15 views

Containerised Testing at Demonware : PyCon Ireland 2016

  • 3. “Quality is free, but only to those willing to pay heavily for it.” T. DeMarco and T. Lister
  • 4. Who are Demonware? Demonware provide online services and infrastructure for some of the world’s most popular video game franchises.
  • 5. Bio Thomas is a Build Engineer at Demonware and works closely with the development teams to optimise their CI/CD pipelines. His background is in QA and other roles include Configuration Management and Test Tools automation. James is a Django developer on a Demonware internal product. Before Demonware he worked at a handful of startups, largely in web development.
  • 6. Pets vs Cattle CaaS 4 Stages of Evolution TaaS Continuous Delivery Agenda The future
  • 7. Continuous Delivery Define Develop Build Integrate Test Release Deploy Continuous Delivery Continuous Integration
  • 8. Why Continuous Delivery ? ● Deliver new services, features and updates rapidly ● Reduce manual intervention ● Shorter feedback loop ● Reduce cost of deployments ● Reduce risk
  • 9. Quality is no longer important ... It’s C R I T I C A L
  • 10. Continuous Delivery without Quality Best case scenario Worst case scenario
  • 11. Time to deliver ● The Continuous Delivery pipeline is only as fast as the slowest stage ● The Build and Deploy stages took minutes ● The Test stage took 6+ hours for a full set of testsuites to complete ● The Test stage was a blockage in our CD pipeline
  • 12. Development teams began optimising their tests. • Split across containers • Measure execution time to manage slices of tests • Quality metrics like static analysis and coverage reports The Build Engineering team began optimising the test environments. • Test infrastructure as code • Immutable and platform agnostic test environments • Eliminate “Dependency Hell” Optimising the Test stage
  • 13. Tests are run in fresh containers; new test run, new container. Container images are built from code. Developers control the test environment dependencies. Test environments are easily reproducible anywhere. Test environments are manually configured. Setup and tear down happens with each test run. Each test environment is a snowflake. Everyone has root access. Environments are never updated for fear of breaking tests. Pets Cattle
  • 14. Baremetal Vagrant VMs Docker Containers ./setup ./start tests ./teardown ./setup ./start ./teardown ./setup ./start ./teardown ./setup ./start ./teardown ./setup ./start ./teardown Moving from Pets towards Cattle 2012 2013 2014 - Present
  • 15. 4 Stages of Evolution 1 : Fat containers 2 : Containers wrapped in Bash 3 : Containers defined in yaml 4 : Containers as a service
  • 16. Fat containers What is a “Fat” container and how was it created? In this context it is a container with multiple services installed. We tarred up a CentOS vagrant vm and imported into a docker image. Pros : 1. It helped get the ball rolling 2. Everything needed to run tests was included 3. Image caching reduced the time required to build new images Cons : 1. Large base container image. Approximately 3gig 2. The container ran multiple supporting services such as MySQL, RabbitMQ, Apache 3. It took almost as long as a VM for all services to become available
  • 17. Containers wrapped in Bash As we began splitting services out into their own containers we needed a way to co-ordinate them. In particular we needed to link containers and wait for services to become available. We used a high level bash wrapper to start, link and wait for containers to become ready. Pros : 1. The script was initially quite simple 2. It filled a gap in tooling around multi container deployments (June 2014) Cons : 1. The script was duplicated across multiple projects and became unwieldy 2. A lot of logic required to check a service health/status 3. Fragile
  • 18. Containers defined in yaml We began using docker-compose in August 2015. Compose allowed developers to define complex container orchestration in YAML. Example : testsuite: build: unittest command: python testrunner.py ports: - "80:80" volumes: - unittests:/unittests links: - percona percona: image: percona
  • 19. Containers defined in yaml Pros : 1. Compose is easy to use 2. Portable 3. Repeatable 4. Container configuration defined in code 5. Container orchestration requirements defined in code Cons : 1. Runs on a single host. Not fully cluster aware. This will change very soon.
  • 20. Test Containers Limitation of first 3 stages ● Single host, fixed resources ● Fixed number of Test Containers per host ● Fixed number of Tests per Container ● Local debugging of failures is difficult ● Re-running failed/flaky tests is expensive
  • 21. Containers as a service We are currently in this stage. With the release of Docker 1.12 we started to look at how and where tests are being run. 2 key features in 1.12 : ● Swarm Mode ○ Natively manage a cluster of Docker Engines called a swarm. Use the Docker CLI to create a swarm, deploy application services to a swarm, and manage swarm behavior. ● Services ○ Docker services enables the use to start a replicated, distributed, load balanced service on a swarm of Engines.
  • 22. Containers as a service Docker Swarm mode and Services enable us to provide a much more flexible yet robust and scalable test environment.
  • 23. Tests as a service Like any Swarm service, the number of containers is scalable based on the resources available in the Test Cluster. We need a dynamic way of splitting tests at execution time to maximise the usefulness of this. Populate a Redis service with test case names. Each container grabs a chunk of tests from the Redis service. Tests are run and results stored in a shared mount point across all nodes.
  • 24. What does the test cluster look like? Shared volume mounted using GlusterFS. Used for results, logs etc Manager Manager Manager WorkerWorkerWorker Worker Worker Team A Unit Tests Team B Unit Tests Docker Registry (Global) Redis (Global)
  • 25. Tests as a service How do we create a test service? ● docker service create --name unittests --replicas 1 <image_name> How do we scale up the test tasks as resources become available ? ● docker service scale unittests=50 How do we scale down when tests are finished ? ● docker service scale unittests=0
  • 26. What does this look like ? Check Cluster Resources Create overlay network Start Redis Population service Create Test Service Cleanup Services Execute Tests Stop Redis Population service Create Redis Global service Create shared work directory
  • 27. The code Create overlay network : docker network create -d overlay --subnet 10.0.9.0/24 network_unittests_129 Create global Redis service : docker service create --name 129_redis --network network_unittests_129 --mount type=bind,src=/home/test_cluster/unittest/129,dst=/data -p 6379:6379 redis Populate Redis service : docker service create --name 129_redis_populate --network network_unittests_129 --mount type=bind,src=/home/test_cluster/unittest/129,dst=/tmp --replicas=1 127.0.0.1:5000/populate_redis:latest -c 'cat /tmp/testlist |redis-cli -h 129_redis -p 6379' Start Test Service : docker service create --name 129_tests --env REDIS_SERVICE=129_redis --network network_unittests_129 --mount type=bind,src=/home/test_cluster/results/129,dst=/results --replicas=12 127.0.0.1:5000/unittest:129
  • 28. What other benefits does Docker Swarm provide ? ● Easy to setup ○ docker swarm init ○ docker swarm join --token <swarm_token> <ip of manager> ● Secure by default. Uses TLS ● Service discovery ● Load Balancing ● Scaling ● Desired State reconciliation ● Multi-host networking ● Rolling updates
  • 29. Test Containers What Docker Swarm solves ● Single host, fixed resources ● Fixed number of Test Containers per host ● Fixed number of Tests per Container ● Local debugging of failures is difficult ● Re-running failed/flaky tests is expensive SOLVED SOLVED SOLVED SOLVED SOLVED
  • 30. Summary ● We increase our resource use, but not by 'throwing resources at it' - instead we optimise for parallel execution ● With a relatively small time investment we were able to innovate ● The tools used to create and manage the test cluster are open source ■ Docker : https://www.docker.com/ ■ Ansible : https://www.ansible.com/ ■ GlusterFS : https://www.gluster.org/ ■ Swarm Visualizer : https://github.com/ManoMarks/docker-swarm-visualizer ● Our containerised tests can scale seamlessly across 3 different platforms
  • 31. We are hiring: Full details at demonware.net Or email : jobs@demonware.net Internships available. Drop by our stand for more details.
  • 32. Contact details : thshaw@demonware.net / @tomwillfixit jheslin@demonware.net / @PROGRAM_IX Follow us @demonware for engineering related content. Meetup : meetup.com/Docker-Dublin/