Skip to content

Parametrized tests workflow

Ilfat edited this page May 11, 2017 · 1 revision

Parametrized tests workflow

Introduction

There you can find information about how is testing going behind automated scripts, what environmental variables are reserved, where to add tests after creating them, how to specify configurations to use in tests.

Machines specifications

Described in template files here https://github.com/OSLL/mdbci/tree/integration/spec/parametrized_tests_templates

Tests wokflow

Tests are described in ruby files like https://github.com/OSLL/mdbci/blob/integration/spec/unit_parametrized_tasks.rb or https://github.com/OSLL/mdbci/blob/integration/spec/integration_parametrized_tasks.rb.

Each test is described like this:

  • Unit parametrzied test:
    task :task_TEST_NAME do |t| RakeTaskManager.new(t).run_unit_parametrized([DOCKER, PPC]) end
  • Integration parametrzied test:
    task :task_TEST_NAME do |t| RakeTaskManager.new(t).run_integration_parametrized([DOCKER, PPC]) end

Where TEST_NAME is:


filename: test1_spec.rb
TEST_NAME: test1

Methods run_unit_parametrized and run_integration_parametrized of RakeTaskManager takes one parameter: array of provider names. There can be only 3 providers: DOCKER, LIBVIRT, PPC. Depending on what providers you choose, job will create clone for that provider (from the original machine).

Reserved environmental variables

In tests you can use next variables:

  1. ENV[‘mdbci_param_conf_docker’] – cloned docker config
  2. ENV[‘mdbci_param_conf_libvirt’] – cloned docker libvirt config
  3. ENV[‘mdbci_param_conf_ppc’] – cloned ppc config

Also there is variables to use original machines:

  1. ENV[‘mdbci_param_test_docker’] – original docker config
  2. ENV[‘mdbci_param_test_libvirt’] – original docker libvirt config
  3. ENV[‘mdbci_param_test_ppc’] – original ppc config

Every config has 3 nodes:

  1. node1
  2. node2
  3. node3

Clean up after abortion of job on jenkins or some other error

If something nasty happens, cloned machines must be cleaned. To do that go to server, clone somewhere mdbci repository, cd in it.

Run next command:


./scripts/clean_vms.sh mdbci_param_test_clone

But some docker images could survive clean up, and we need to remove them manually:


for i in $(docker images | grep mdbci_param_test_clone); do docker rmi $i; done