Test infrastructure on steroids

Sergey Pirogov

http://automation-remarks.com

https://qaguild-slack.herokuapp.com

QA Tech Lead

http://automation-remarks.com/podcast

Talk will be about?

Baremetal

Container deployment

Won't cover

Project

Deployment workflow

Feature branches

Moment of truth

feature/Jira-5678

master

Bad scenario

feature/Jira-5677

feature/Jira-5679

master

feature/Jira-5680

Good scenario

Run all the tests

feature/Jira-5677

master

Time for DevOps stuff

Infrastructure

Jenkinsfile

Dockerfile

docker-compose.yml

Feature env

http://jira-5766.pp.host.com

http://jira-5767.pp.host.com

Local Workspace Infrastructure

Selenoid + VNC + VIDEO

Selenium Grid with Docker

Selenoid + Windows

version: '3'
services:
  selenoid:
    image: "aerokube/selenoid:latest-release"
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - "$PWD:/etc/selenoid"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "$PWD/video:/opt/selenoid/video"
    environment:
      - DOCKER_API_VERSION=1.35  
      - OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/video
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video"]
  selenoid-ui:
    image: "aerokube/selenoid-ui:latest-release"
    network_mode: bridge
    links:
      - selenoid
    ports:
      - "8080:8080"
    command: ["--selenoid-uri", "http://172.17.0.2:4444"]
docker inspect -f '{{ .NetworkSettings.IPAddress }}' selenoid

Docker compose .env file

version: '3'
services:
  selenoid:
    image: "aerokube/selenoid:latest-release"
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - "$PWD:/etc/selenoid"
      - "$PWD/video:/opt/selenoid/video"

https://docs.docker.com/compose/environment-variables/

PWD=/c/Users/user/selenoid

selenoid/

        .env

                                       docker-compose.yml

docker-compose.yml

Docker + Windows

Test Infrastructure

Selenoid + GGR

Configuration management

Ansible + Selenoid + GGR

---
- hosts: all
  vars:
        selenoid_version: 1.4.0
        selenoid_cm_version: 1.3.1
        selenoid_docker_api_version: 1.24
        selenoid_limit: 4
        selenoid_tmpfs: 128
        selenoid_config_dir: /etc/selenoid
        selenoid_listen_port: 4444
        selenoid_time_zone: Europe/Moscow
        selenoid_browsers_last_versions: 5
        selenoid_browsers:
          - firefox
          - opera
          - chrome
  roles:
  - selenoid

https://github.com/iqoption/selenoid-docker

---
- hosts: all
  vars:
    grid_router_path: "{{ ansible_env.HOME }}/grid-router"
    grid_router_qouta_path: "{{ ansible_env.HOME }}/grid-router/quota"
    grid_router_port: 4445

    grid_router_regions:
      - name: "region-1"
        hosts:
        - name: 192.168.1.1
          port: 4444
          browser_count: 4
        - name: 192.168.1.2
          port: 4445
          browser_count: 4            

    grid_router_browsers:
      - name: "chrome"
        defaultVersion: "62.0"
        versions:
          - "62.0"
          - "63.0"
  roles:
    - gridrouter-docker

Example

playbook

ansible-playbook selenoid.yml -i hosts

Jenkins pipeline

Results

feature envs

push to feature branch

tests

GGR

Selenoids

Merge/delete feature env

Pain points

  • Browser cluster monitoring
  • Windows Powershell DSC
  • Windows Server 2016 1709

Lessons learned

  • Keep your infrastructure as a code
  • Always test what your deployment
  • Run all your test for merge request
  • Collaborate with your team
  • Ensure high availability

Useful to read

Thank you!

http://automation-remarks.com

https://qaguild-slack.herokuapp.com

http://automation-remarks.com/podcast

Testing infrastructure on steroids

By Sergey Pirogov

Testing infrastructure on steroids

  • 3,972