Scaling Tests with Docker : Study Notes

Chapter 1: Intro to Docker

Docker

  • Docker is a standalone software that can be installed on any computer to run containerised applications.
  • Designed to build, ship and run business critical applications at scale.
  • Build and share containers.
  • Automate development pipeline.

Containers

  • Containerization is an approach of running applications on an OS such that the application is isolated from the rest of the system. 
  • Applications run using containers and containers are the running instance of an image.
  • Containers are lightweight and faster.
  • You can control the environment as you create specific images.

Images

  • Images are specs used to create containers specifying which services, libraries you need for your container.
  • Images are the read-only template/snapshot used to create a Docker container and these Images can be pushed to and pulled from public or private repositories. This is the build component of docker. Images are lightweight, small, and fast as compared to Virtual Machine Images.

Why Docker??

With DockerWithout Docker
Docker containers can be summarized as wrapping up a piece of software in a complete file system that contains everything it needs to run – code, runtime, system tools, system libraries, etc.Have to manage each one of those separately
Manage everything in seconds easily with Spin up Restart Tear DownSetting up Selenium Grid is also a manual and tedious task. Running multiple commands Management of version

Chapter 2: Installing Docker on Windows

Installing Docker Flowchart

Installing Docker on Windows

Chapter 3: Setting up Docker

The main components to set up the grid are:

grid components
grid components

Steps to setup Docker:

flowchart

To restart the grid, use the following command:

docker-compose restart

To tear down the grid, use the following command:

docker-compose down

Sample YML file:

yml file

Chapter 4: Scaling Tests

Tips for tests before we run those using containers:

  • The tests considered in the script are independent.
  • Each test(s) should have its own instance of a Driver and not shared.
  • The test results are saved on the machine which is running the Docker engine and not remote entity like S3.
  • Label files/ directories with GUID as tests will run concurrently.

Sample tests:

  • Refer the suite from Example
  • Specify the type of driver as remote , browser as chrome in the run settings file

Run the tests:

flowchart

Chapter 5: Scaling Containers

It is all about scaling the clusters using multiple machines and then putting the grid on those clusters. There is a limit to scale the selenium grid on one machine, as it will run out of resources. Hence multiple machines are required.

Docker Swarm

A collection of Docker engines joined into a cluster is called a Swarm. Each machine in a SWARM is called a Node.

Docker Swarm
Docker Swarm

SWARM consists of:

Worker Nodes: Worker nodes listen to the task sent by Manager Nodes and then execute them.

Manager Nodes: Manager Nodes also execute tasks alongwith sending tasks to the Worker nodes and maintaining the Desired state of the SWARM

If the desired state has 6 nodes with 3 managers and 3 workers, from which the lead has the Hub and the other nodes have the Firefox containers and if due to some reason any one nodes goes down, then the Docker will detect this and spin up an entirely new node. This is how it makes sure that the Actual state is always matched with Desired State.

Docker Stack

Docker Stack is similar to Docker compose but allows to deploy the services across the SWARM in one command. The same docker-compose.yml file can be used here.

Docker Stack
Docker Stack

Starting Docker Stack

Learning Drive-Thru:

Happy Learning 🙌


Processing…
Success! You're on the list.

Rahul Parwal
Rahul Parwal
Senior Software Engineer at ifm engineering pvt. ltd | Website | + posts

Rahul is a Software Engineer by education and works with ifm engineering pvt. ltd., India. He is a Software Tester by trade, Programmer by practice, and a Mythology lover by heart.

His latest ebook is available at leanpub.com/productivitytoolkit

Apoorva
Apoorva Ram
Senior Software Test Engineer at Qapitol QA | + posts

Apoorva is a Test Enthusiast who believes that Software Testing is a Craft.

She is an avid reader who is passionate and curious about anything and everything in life.

When not Testing, She loves to travel, explore cultures and cuisines, and indulge in deep, meaningful conversations.

Himani
Himani Yadav
Specialist at Viewics | + posts

Himani is a Specialist at Viewics with 9+ years of experience in Software Testing and is well versed with traditional and Agile methodologies.
She has more than 4 years of experience in handling Test Leadership activities from inception to execution with expertise.
She strongly believes in “Always trust yourself and your capabilities, never underestimate yourself”.

One thought on “Scaling Tests with Docker : Study Notes

Add yours

Leave a Reply

Up ↑

%d bloggers like this: