Testing AS A Container - Irfan Ahmad

Post on 08-Jan-2017

1,122 views 0 download

transcript

TESTING AS A CONTAINERUSING DOCKER CONTAINERS TO DELIVER TESTING AT SPEED

IRFAN AHMAD

CONTENTS

▸ Challenges :Testing and Delivery

▸ Docker and Friends

▸ Testing : In Containers ,On Containers

▸ Demo

▸ Docker In Practise

CHALLENGES : TESTING AND DELIVERY

WHY WE FAIL TO TEST?

45%

15%5%

35%

▸ Slow deployments

▸ Slow test and setup

▸ Ineffective tests

▸ Not needed

MATRIX FROM HELL - SHIP GOODS?

MATRIX FROM HELL - SHIP SOFTWARE?

MATRIX FROM HELL -SOLVED

SOFTWARE TRENDS

CONATINERS

A CONTAINER IS AN ENTIRE ISOLATED PORTABLE RUNTIME ENVIRONMENT: AN APPLICATION, PLUS ALL ITS DEPENDENCIES, LIBRARIES AND OTHER BINARIES, AND CONFIGURATION FILES NEEDED TO RUN IT, BUNDLED INTO ONE PACKAGE.

WHAT ARE CONTAINERS?

CONTAINERS VS VM

DOCKER▸ Docker is an open platform for developers and

sysadmins to build, ship, and run distributed applications.

INSIDE DOCKER ▸ Docker Image :static snapshot of the containers’

configuration.

▸ Docker Engine: a lightweight runtime and robust tooling that builds and runs your Docker containers.

▸ Docker Registry :a repository of images

DOCKER HUB

DOCKER TOOLBOX

HOW COMPONENTS FITS TOGETHER

DOCKER LIFECYCLE

HOW DOCKER WORKS

DOCKER RUNDOCKER LOOKS

FOR LOCAL IMAGES

IS IT INSTALLED

DOCKER LOOKS FOR IMAGES

FROM REGISTRY

NO

IS IT INSTALLED

DOCKER DOWNLOADS THE

IMAGE

IMAGE INSTALLED LOCALLY

DOCKER CREATES NEW

CONTAINER AND STARTS

PROGRAM

CONTAINER IS RUNNING

YES

DOCKER COMMANDS

DOCKERFILE▸ configuration file with build instructions for

Docker images

DOCKER-COMPOSE ▸ Compose is a tool for defining and running

multi-container Docker applications

▸ Compose is great for :

▸ development

▸ testing

▸ environments setup

▸ CI workflows

EXAMPLE

TESTING: IN CONTAINERS, ON CONTAINERS

DOCKER USE CASES

TRENDS IN TESTING▸ Agility

▸ Automation

▸ Devops

▸ Scale

▸ Diversity

TESTING CONTAINERS ,WHY ?

▸ easy setup

▸ fast

▸ shareable

▸ composable

▸ scalable

TESTING CONTAINERS ,HOW ?

▸ write dockerfiles for setup

▸ ship tests as docker images

▸ execute tests as containers

▸ compose with any other application ,tests or CI

DEMO

PRE-REQUISITES

▸ virtual-box

▸ download docker toolbox

▸ https://www.docker.com/products/docker-toolbox

CHECK SETUP

VOTING APP : APP UNDER TEST▸ Simple Real Time voting app

▸ Runs with Docker Compose and multiple containers in network

VOTING APP : COMPONENTS

DELIVER BELOW TESTS AS CONAINER TO TEST VOTING APP DOCKER IMAGE

1.API 2.WEB 3.LOAD

PROBLEM STATEMENT

USING IMAGES IN DOCKER COMPOSE

DOCKER IN PRACTICE

BEST PRACTICES

▸ One container one process

▸ Ship Images not code

▸ Required packages

▸ Specific tags

▸ Group common operations

SIMPLE CI WORKFLOW

FUTURE : CONTAINERS EVERYWHERE

Q & A

Github

https://github.com/irfanah/TestStack

https://github.com/irfanah/example-voting-app

Docker hub

https://hub.docker.com/u/irfanah/

Email :irfan@critick.io

Web :http://critick.io

Twitter: @irfanahmads

Open Sourced : for hands on

THANK YOU