From 881d16fb42bf117aece2b24743eab2654c5639af Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Mon, 22 Oct 2018 18:11:37 +0530 Subject: [PATCH] Added support for installing tempest plugins from git In order to use it, in any FS, set tempest_format to venv and then set: tempest_plugins_venv: - '' Change-Id: I95a4449ca3976a914faf1ba5f3f4c0e756a6fefc --- roles/validate-tempest/README.md | 9 +++++++++ roles/validate-tempest/defaults/main.yml | 2 +- roles/validate-tempest/tasks/tempest-venv.yml | 9 +++++++++ roles/validate-tempest/templates/configure-tempest.sh.j2 | 4 ++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/roles/validate-tempest/README.md b/roles/validate-tempest/README.md index 4eaef14d0..6cc182c35 100644 --- a/roles/validate-tempest/README.md +++ b/roles/validate-tempest/README.md @@ -35,6 +35,15 @@ Role Variables * `check_tempest_bugs`: true/false - Will check every bugzilla and launchpad bug in the yaml skip file * `tempest_plugins`: list - List of openstack services tempest plugins to be installed +* `tempest_plugins_git`: list - (optional) List of URLs for openstack tempest plugins you want to have installed. + (Required) `tempest_format`: venv + For example: + ``` + tempest_format: venv + tempest_plugins_git: [https://git.openstack.org/openstack/tempest-tripleo-ui, + https://git.openstack.org/openstack/keystone-tempest-plugin, + https://git.openstack.org/openstack/cinder-tempest-plugin] + ``` * `tempest_extra_config`: dict - A dict of tempest configuration which needs to be overridden in tempest.conf, It should be like section.key: value. * `tempest_conf_removal`: dict - A dict of tempest configuration which will be diff --git a/roles/validate-tempest/defaults/main.yml b/roles/validate-tempest/defaults/main.yml index 86efd82cf..4746b2663 100644 --- a/roles/validate-tempest/defaults/main.yml +++ b/roles/validate-tempest/defaults/main.yml @@ -58,7 +58,7 @@ tempest_plugins: >- {%- else -%} [ "python-keystone-tests", "python-neutron-tests" ] {%- endif -%} - +tempest_plugins_git: [] tempest_extra_config: {} # A dict containing values which needs to be overridden in tempest.conf skip_file_src: "skip_file.j2" skip_file: skip_file diff --git a/roles/validate-tempest/tasks/tempest-venv.yml b/roles/validate-tempest/tasks/tempest-venv.yml index c6e0069db..1e0f5c8b9 100644 --- a/roles/validate-tempest/tasks/tempest-venv.yml +++ b/roles/validate-tempest/tasks/tempest-venv.yml @@ -37,6 +37,15 @@ python-virtualenv {% endif %} +- name: Clone tempest plugins + git: + repo: "{{ item }}" + dest: "{{ working_dir }}/{{ item.split('/')[-1] }}" + version: master + with_items: "{{ tempest_plugins_git }}" + when: + - tempest_format == 'venv' + - name: Install packages required for create venv package: state: present diff --git a/roles/validate-tempest/templates/configure-tempest.sh.j2 b/roles/validate-tempest/templates/configure-tempest.sh.j2 index 03dd5d662..6c02563bf 100644 --- a/roles/validate-tempest/templates/configure-tempest.sh.j2 +++ b/roles/validate-tempest/templates/configure-tempest.sh.j2 @@ -56,6 +56,10 @@ virtualenv --system-site-packages {{ working_dir }}/tempest_git/.venv {{ working_dir }}/tempest_git/tools/with_venv.sh pip install -U pip {{ working_dir }}/tempest_git/tools/with_venv.sh pip install -U setuptools {{ working_dir }}/tempest_git/tools/with_venv.sh pip install {{ working_dir }}/tempest_git junitxml +# Install tempest plugins in tempest .venv +{% for tempest_plugin in (tempest_plugins_git|default([])) %} +{{ working_dir }}/tempest_git/tools/with_venv.sh pip install {{ working_dir }}/{{ tempest_plugin.replace('.git', '').split('/')[-1] }} +{% endfor %} # Install python-tempestconf {% if release != 'newton'%}