Add extra-test-setup role

Change-Id: Icad9896e524c69e92e9ceabd86c6ca28360887fa
Co-Authored-By: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
James E. Blair 2017-06-08 16:06:51 -07:00
parent 46684654cb
commit 7e0d13d1cb
3 changed files with 26 additions and 0 deletions

View File

@ -1,6 +1,10 @@
Roles
=====
extra-test-setup
----------------
.. include:: ../../roles/extra-test-setup/README.rst
revoke-sudo
-----------
.. include:: ../../roles/revoke-sudo/README.rst

View File

@ -0,0 +1,10 @@
Perform project test setup tasks.
This role assumes that Zuul has checked out a change for a project at
``{{ zuul_workspace_root }}/src/{{ zuul.project.canonical_name }}``
and looks for a file named ``tools/test-setup.sh``. If that file
exists and is executable, it will be run.
This allows projects to specify test-setup steps (such as creating or
initializing a database) in a form that can be easily run by both an
automated testing system and developers.

View File

@ -0,0 +1,12 @@
- name: Check if projects tools/test-setup.sh exists.
stat:
path: "{{ zuul_workspace_root }}/src/{{ zuul.project.canonical_name }}/tools/test-setup.sh"
register: p
- name: Run tools/test-setup.sh.
shell: tools/test-setup.sh
args:
chdir: "{{ zuul_workspace_root }}/src/{{ zuul.project.canonical_name }}"
when:
- p.stat.exists
- p.stat.executable