From 3a38e54735fc80973d02b784d7ea5674d6c0b58e Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 21 Apr 2016 15:18:12 +0100 Subject: [PATCH] Install tempest plugins This commit does the following: - updates os_tempest to work in non-integrated environments, giving us the ability to use it in environments where all services may not be installed - adds the ability to install tempest plugins, and installs designate-tempest-plugin for use in the os_designate role Change-Id: I30a877f6c84f66ca05381969d015850078532e1f --- defaults/main.yml | 9 +++++ tasks/tempest_install.yml | 29 ++++++++++++++ tasks/tempest_post_install.yml | 3 ++ tasks/tempest_resources.yml | 52 +++++++++++++++++++++++++- templates/openstack_tempest_gate.sh.j2 | 7 +++- 5 files changed, 97 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index aa464424..989a657f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,6 +24,15 @@ tempest_git_repo: https://git.openstack.org/openstack/tempest tempest_git_install_branch: master tempest_developer_mode: false +## Tempest Plugins +# By default, no tempest plugins are installed. Override ``tempest_plugins`` +# as follows: +# tempest_plugins: +# - name: designate_tempest_plugin +# repo: https://github.com/openstack/designate-tempest-plugin +# branch: master +tempest_plugins: [] + tempest_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/tempest.tgz tempest_fatal_deprecations: False diff --git a/tasks/tempest_install.yml b/tasks/tempest_install.yml index e59302e4..652b96c8 100644 --- a/tasks/tempest_install.yml +++ b/tasks/tempest_install.yml @@ -123,3 +123,32 @@ tags: - tempest-pip-packages - tempest-pip-install + +- name: Get tempest plugins from git + git: + repo: "{{ item.repo }}" + dest: "/opt/{{ item.name }}_{{ item.branch|replace('/', '_') }}" + version: "{{ item.branch }}" + force: yes + with_items: "{{ tempest_plugins) }}" + register: git_clone + until: git_clone|success + retries: 5 + delay: 2 + tags: + - git-clone + +- name: Install tempest plugins + pip: + name: "/opt/{{ item.name }}_{{ item.branch|replace('/', '_') }}" + state: present + virtualenv: "{{ tempest_git_dest }}" + virtualenv_site_packages: "no" + extra_args: "{{ pip_install_options|default('') }}" + with_items: "{{ tempest_plugins }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + tags: + - pip-install diff --git a/tasks/tempest_post_install.yml b/tasks/tempest_post_install.yml index cb302e0b..a736c823 100644 --- a/tasks/tempest_post_install.yml +++ b/tasks/tempest_post_install.yml @@ -57,6 +57,7 @@ dest: "{{ tempest_image_dir }}" sha256sum: "{{ item.sha256 }}" with_items: tempest_images + when: tempest_service_available_glance | bool tags: - tempest-config - tempest-image @@ -65,6 +66,7 @@ shell: | ls -1 {{ tempest_image_dir }} | grep '.gz' register: tempest_archives + when: tempest_service_available_glance | bool tags: - tempest-config - tempest-image @@ -76,6 +78,7 @@ dest: "{{ tempest_image_dir }}" copy: "no" with_items: tempest_archives.stdout + when: tempest_service_available_glance | bool tags: - tempest-config - tempest-image diff --git a/tasks/tempest_resources.yml b/tasks/tempest_resources.yml index 96a759d0..bf5121ec 100644 --- a/tasks/tempest_resources.yml +++ b/tasks/tempest_resources.yml @@ -27,6 +27,7 @@ until: cirros_image_create | success retries: 5 delay: 15 + when: tempest_service_available_glance | bool tags: - tempest-setup - tempest-config @@ -34,6 +35,17 @@ - name: Store cirros image id set_fact: tempest_glance_image_id: "{{ glance_images.cirros.id }}" + when: tempest_service_available_glance | bool + tags: + - tempest-setup + - tempest-config + +# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get +# set above to ensure the template will parse correctly. +- name: Store empty tempest_glance_image_id fact + set_fact: + tempest_glance_image_id: '' + when: not tempest_service_available_glance | bool tags: - tempest-setup - tempest-config @@ -48,6 +60,7 @@ image_disk_format: qcow2 image_is_public: True insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_glance | bool tags: - tempest-setup - tempest-config @@ -55,6 +68,17 @@ - name: Store alt cirros image id set_fact: tempest_glance_image_alt_id: "{{ glance_images.cirros_alt.id }}" + when: tempest_service_available_glance | bool + tags: + - tempest-setup + - tempest-config + +# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get +# set above to ensure the template will parse correctly. +- name: Store empty tempest_glance_image_alt_id fact + set_fact: + tempest_glance_image_alt_id: '' + when: not tempest_service_available_glance | bool tags: - tempest-setup - tempest-config @@ -186,6 +210,7 @@ net_name: private tenant_id: "{{ keystone_demo_tenant_id }}" insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup - tempest-config @@ -193,6 +218,7 @@ - name: Store neutron private network id set_fact: tempest_neutron_private_network_id: "{{ neutron_networks.private.id }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup - tempest-config @@ -206,6 +232,7 @@ provider_physical_network: flat router_external: true insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup - tempest-config @@ -213,6 +240,17 @@ - name: Store neutron public network id set_fact: tempest_neutron_public_network_id: "{{ neutron_networks.public.id }}" + when: tempest_service_available_neutron | bool + tags: + - tempest-setup + - tempest-config + +# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get +# set above to ensure the template will parse correctly. +- name: Store empty tempest_neutron_public_network_id fact + set_fact: + tempest_neutron_public_network_id: '' + when: not tempest_service_available_neutron | bool tags: - tempest-setup - tempest-config @@ -226,6 +264,7 @@ cidr: "{{ tempest_private_subnet_cidr }}" tenant_id: "{{ keystone_demo_tenant_id }}" insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup @@ -238,6 +277,7 @@ cidr: "{{ tempest_public_subnet_cidr }}" insecure: "{{ keystone_service_internaluri_insecure }}" allocation_pools: "{{ tempest_public_subnet_allocation_pools }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup @@ -249,6 +289,7 @@ external_gateway_info: public tenant_id: "{{ keystone_demo_tenant_id }}" insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup @@ -259,6 +300,7 @@ router_name: router subnet_name: private-subnet insecure: "{{ keystone_service_internaluri_insecure }}" + when: tempest_service_available_neutron | bool tags: - tempest-setup @@ -269,6 +311,7 @@ register: tempest1 failed_when: False changed_when: tempest1.rc != 0 + when: tempest_service_available_nova | bool tags: - tempest-setup @@ -276,7 +319,9 @@ shell: | . /root/openrc nova flavor-create tempest1 201 256 1 1 - when: tempest1.rc != 0 + when: + - tempest_service_available_nova | bool + - tempest1.rc != 0 tags: - tempest-setup @@ -287,6 +332,7 @@ register: tempest2 failed_when: False changed_when: tempest2.rc != 0 + when: tempest_service_available_nova | bool tags: - tempest-setup @@ -294,6 +340,8 @@ shell: | . /root/openrc nova flavor-create tempest2 202 512 1 1 - when: tempest2.rc != 0 + when: + - tempest_service_available_nova | bool + - tempest2.rc != 0 tags: - tempest-setup diff --git a/templates/openstack_tempest_gate.sh.j2 b/templates/openstack_tempest_gate.sh.j2 index cf420f25..24065c90 100644 --- a/templates/openstack_tempest_gate.sh.j2 +++ b/templates/openstack_tempest_gate.sh.j2 @@ -80,6 +80,11 @@ function gen_test_list_smoke { grep smoke | grep -v tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_update_router_admin_state } +# Run designate scenario tests +function gen_test_list_designate_scenario { + egrep 'designate_tempest_plugin\.tests\.scenario' +} + # Run all tests function gen_test_list_all { cat @@ -171,7 +176,7 @@ set +o pipefail # every test list function. truncate --size 0 tmp_test_list for test_list_name in ${test_lists}; do - grep '^tempest\.' < full_test_list \ + egrep '^(tempest|.*_tempest_plugin)\.' < full_test_list \ | gen_test_list_${test_list_name} >> tmp_test_list \ || exit_msg "Filter $test_list_name failed. Output: $(cat test_list)" 1 done