Merge "zuul: change the cinderlib test runner into a role"
This commit is contained in:
commit
94febb386f
@ -66,7 +66,7 @@
|
|||||||
nodeset: centos-7
|
nodeset: centos-7
|
||||||
vars:
|
vars:
|
||||||
tox_environment:
|
tox_environment:
|
||||||
CL_FTEST_CFG: "cinderlib/tests/functional/ceph.yaml"
|
CL_FTEST_CFG: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}/cinderlib/tests/functional/ceph.yaml"
|
||||||
CL_FTEST_ROOT_HELPER: sudo
|
CL_FTEST_ROOT_HELPER: sudo
|
||||||
# These come from great-great-grandparent tox job
|
# These come from great-great-grandparent tox job
|
||||||
NOSE_WITH_HTML_OUTPUT: 1
|
NOSE_WITH_HTML_OUTPUT: 1
|
||||||
|
@ -1,27 +1,4 @@
|
|||||||
# Variables: devstack_base_dir, cinderlib_log_file, cinderlib_ignore_errors
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
become: True
|
become: True
|
||||||
vars:
|
role:
|
||||||
base_dir: "{{ devstack_base_dir | default('/opt/stack/new') }}"
|
- run-cinderlib-tests
|
||||||
default_log_file: "{{ base_dir }}/logs/cinderlib.txt"
|
|
||||||
tasks:
|
|
||||||
- name: Locate unit2 binary location
|
|
||||||
shell:
|
|
||||||
cmd: which unit2
|
|
||||||
register: unit2_which
|
|
||||||
|
|
||||||
- name: Add sudoers role for cinderlib unit2
|
|
||||||
copy:
|
|
||||||
dest: /etc/sudoers.d/zuul-sudo-unit2
|
|
||||||
content: "zuul ALL = NOPASSWD:{{ unit2_which.stdout }} discover -v -s cinderlib/tests/functional\n"
|
|
||||||
mode: 0440
|
|
||||||
|
|
||||||
- name: Validate sudoers config after edits
|
|
||||||
command: "/usr/sbin/visudo -c"
|
|
||||||
|
|
||||||
- name: Run cinderlib functional tests
|
|
||||||
shell:
|
|
||||||
cmd: "set -o pipefail && {{ unit2_which.stdout }} discover -v -s cinderlib/tests/functional 2>&1 | tee {{ cinderlib_log_file | default(default_log_file)}}"
|
|
||||||
chdir: "{{ base_dir }}/cinderlib"
|
|
||||||
executable: /bin/bash
|
|
||||||
ignore_errors: "{{ cinderlib_ignore_errors | default(false) | bool}}"
|
|
||||||
|
23
roles/run-cinderlib-tests/README.rst
Normal file
23
roles/run-cinderlib-tests/README.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Run cinderlib tests
|
||||||
|
|
||||||
|
**Role Variables**
|
||||||
|
|
||||||
|
.. zuul:rolevar:: cinderlib_base_dir
|
||||||
|
:default: /opt/stack/cinderlib
|
||||||
|
|
||||||
|
The cinderlib base directory.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: cinderlib_config_file
|
||||||
|
:default: /etc/cinder/cinder.conf
|
||||||
|
|
||||||
|
The cinder configuration file used by the tests.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: cinderlib_envlist
|
||||||
|
:default: functional
|
||||||
|
|
||||||
|
The tox environment used to run the tests.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: cinderlib_root_helper
|
||||||
|
:default: sudo
|
||||||
|
|
||||||
|
The command used by the tests to gain root capabilities.
|
4
roles/run-cinderlib-tests/defaults/main.yaml
Normal file
4
roles/run-cinderlib-tests/defaults/main.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
cinderlib_base_dir: "{{ devstack_base_dir | default('/opt/stack') }}/cinderlib"
|
||||||
|
cinderlib_config_file: '/etc/cinder/cinder.conf'
|
||||||
|
cinderlib_envlist: functional
|
||||||
|
cinderlib_root_helper: sudo
|
9
roles/run-cinderlib-tests/tasks/main.yaml
Normal file
9
roles/run-cinderlib-tests/tasks/main.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- include_role:
|
||||||
|
name: tox
|
||||||
|
vars:
|
||||||
|
tox_envlist: "{{ cinderlib_envlist }}"
|
||||||
|
zuul_work_dir: "{{ cinderlib_base_dir }}"
|
||||||
|
tox_environment:
|
||||||
|
CL_FTEST_CFG: "{{ cinderlib_config_file }}"
|
||||||
|
CL_FTEST_ROOT_HELPER: "{{ cinderlib_root_helper }}"
|
3
tox.ini
3
tox.ini
@ -33,7 +33,7 @@ passenv = *_proxy *_PROXY
|
|||||||
usedevelop=True
|
usedevelop=True
|
||||||
basepython=python2.7
|
basepython=python2.7
|
||||||
setenv = OS_TEST_PATH=./cinderlib/tests/functional
|
setenv = OS_TEST_PATH=./cinderlib/tests/functional
|
||||||
CL_FTEST_CFG={toxinidir}/{env:CL_FTEST_CFG:cinderlib/tests/functional/lvm.yaml}
|
CL_FTEST_CFG={env:CL_FTEST_CFG:{toxinidir}/cinderlib/tests/functional/lvm.yaml}
|
||||||
CL_FTEST_ROOT_HELPER={env:CL_FTEST_ROOT_HELPER:{toxinidir}/tools/virtualenv-sudo.sh}
|
CL_FTEST_ROOT_HELPER={env:CL_FTEST_ROOT_HELPER:{toxinidir}/tools/virtualenv-sudo.sh}
|
||||||
ADD_PATHS=/usr/local/sbin:/usr/sbin
|
ADD_PATHS=/usr/local/sbin:/usr/sbin
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ commands =
|
|||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
bash
|
bash
|
||||||
find
|
find
|
||||||
|
stestr
|
||||||
|
|
||||||
[testenv:functional-py36]
|
[testenv:functional-py36]
|
||||||
usedevelop=True
|
usedevelop=True
|
||||||
|
Loading…
Reference in New Issue
Block a user