summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorLuigi Toscano <ltoscano@redhat.com>2021-05-27 14:32:22 +0200
committerLuigi Toscano <ltoscano@redhat.com>2021-09-08 01:05:44 +0200
commit1c0c25babb3d9b13e271e37458cd55b974085901 (patch)
tree77c3a21e75bcdaefb5dc146d4c7bae3dda0596de /roles
parentd81a8386391c8e44055d0df34f48f3b6edf4edcb (diff)
downloadcinder-1c0c25babb3d9b13e271e37458cd55b974085901.tar.gz
Native multibackend-matrix Zuul v3 job
Port the legacy legacy-tempest-dsvm-multibackend-matrix job to the native Zuul v3 syntax, and rename it following the guidelines (cinder-multibackend-matrix-migration). This job tests the migration between two different backends specified through the volume.backend_names configuration key in tempest.conf. Now the job leverages the existing zuul code, namely the run-tempest role, which is called multiple times with all the possible combinations of the 3 tested backends (lvm, ceph, nfs) where the source and the destination differ. The final JUnitXML output summarizes the test results for each of the tested combinations. Change-Id: I34e7e48ee63c4c269f82ae178a7118ed402cad6d
Diffstat (limited to 'roles')
-rw-r--r--roles/configure-run-migration-tests/defaults/main.yaml6
-rw-r--r--roles/configure-run-migration-tests/tasks/main.yaml33
-rw-r--r--roles/save-cinder-migration-results/defaults/main.yaml3
-rw-r--r--roles/save-cinder-migration-results/tasks/main.yaml14
-rw-r--r--roles/save-cinder-migration-results/templates/migration_results_reporter.py.j210
5 files changed, 66 insertions, 0 deletions
diff --git a/roles/configure-run-migration-tests/defaults/main.yaml b/roles/configure-run-migration-tests/defaults/main.yaml
new file mode 100644
index 000000000..d9faae34f
--- /dev/null
+++ b/roles/configure-run-migration-tests/defaults/main.yaml
@@ -0,0 +1,6 @@
+---
+migration_source_backend: lvm
+migration_destination_backend: lvm
+migration_test_regex: "(.*test_volume_retype_with_migration.*|.*test_volume_migrate_attached.*)"
+migration_test_results: []
+tempest_run_result: {}
diff --git a/roles/configure-run-migration-tests/tasks/main.yaml b/roles/configure-run-migration-tests/tasks/main.yaml
new file mode 100644
index 000000000..65a153a97
--- /dev/null
+++ b/roles/configure-run-migration-tests/tasks/main.yaml
@@ -0,0 +1,33 @@
+---
+- name: Reconfigure tempest.conf
+ ini_file:
+ path: "{{ migration_tempest_conf }}"
+ section: volume
+ option: backend_names
+ value: "{{ migration_source_backend }},{{ migration_destination_backend }}"
+ become: true
+ become_user: tempest
+
+- set_fact:
+ tempest_run_result: {}
+
+- name: Run migration ({{ migration_source_backend }} -> {{ migration_destination_backend }})
+ include_role:
+ name: run-tempest
+ apply:
+ # ignore the errors for this run, otherwise the other migration tests
+ # won't be executed
+ ignore_errors: yes
+ vars:
+ tempest_test_regex: "{{ migration_test_regex }}"
+ tox_envlist: all
+
+- set_fact:
+ _migration_result_item:
+ source: "{{ migration_source_backend }}"
+ destination: "{{ migration_destination_backend }}"
+ result: "{{ tempest_run_result.get('rc', 1) }}"
+
+- name: Update the migration test results
+ set_fact:
+ migration_test_results: "{{ migration_test_results + [ _migration_result_item ] }}"
diff --git a/roles/save-cinder-migration-results/defaults/main.yaml b/roles/save-cinder-migration-results/defaults/main.yaml
new file mode 100644
index 000000000..14d1d252a
--- /dev/null
+++ b/roles/save-cinder-migration-results/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+devstack_base_dir: /opt/stack
+tempest_work_dir: "{{ devstack_base_dir }}/tempest"
diff --git a/roles/save-cinder-migration-results/tasks/main.yaml b/roles/save-cinder-migration-results/tasks/main.yaml
new file mode 100644
index 000000000..e2c97943c
--- /dev/null
+++ b/roles/save-cinder-migration-results/tasks/main.yaml
@@ -0,0 +1,14 @@
+---
+- block:
+ - template:
+ src: migration_results_reporter.py.j2
+ dest: "{{ tempest_work_dir }}/migration_results_reporter.py"
+
+ - name: Generate the results using stestr
+ shell: |
+ stestr run --no-discover --test-path . migration_results_reporter
+ args:
+ chdir: "{{ tempest_work_dir }}"
+
+ become: true
+ become_user: tempest
diff --git a/roles/save-cinder-migration-results/templates/migration_results_reporter.py.j2 b/roles/save-cinder-migration-results/templates/migration_results_reporter.py.j2
new file mode 100644
index 000000000..805eb33de
--- /dev/null
+++ b/roles/save-cinder-migration-results/templates/migration_results_reporter.py.j2
@@ -0,0 +1,10 @@
+import unittest
+
+
+class CinderMigrationsMatrixTest(unittest.TestCase):
+
+{% for test_case in migration_test_results %}
+ def test__{{ test_case.source }}_to_{{ test_case.destination }}(self):
+ self.assertEqual({{ test_case.result }}, 0)
+
+{% endfor %}