Use --non-admin for non admin users in zuul jobs
python-tempestconf-tempest-packstack/devstack-demo zuul job uses generate-tempestconf-file role to generate tempest.conf. Since demo is a non-admin user with non-admin user we cannot use --create option but it was used since it is a bug, so we need to check for admin/demo user then enable the proper option. Used Jinja templates for creating tempest configuration script Create test-demo-user role which prepares resources for a demo user. Change-Id: I727a6cfd154cb3f95c33da02440f25ae1765153f Story: #2001695 Co-Authored-By: Martin Kopec <mkopec@redhat.com>
This commit is contained in:
parent
73cbf531f5
commit
73f0e86f73
|
@ -66,6 +66,10 @@
|
|||
vars:
|
||||
user: demo
|
||||
cloud_user: devstack
|
||||
test_demo_user: True
|
||||
cloud_admin: devstack-admin
|
||||
devstack_plugins:
|
||||
shade: 'git://git.openstack.org/openstack-infra/shade'
|
||||
irrelevant-files:
|
||||
- config_tempest/tests/.*$
|
||||
- ^doc/.*$
|
||||
|
@ -118,6 +122,8 @@
|
|||
vars:
|
||||
scenario: scenario000
|
||||
user: demo
|
||||
test_demo_user: True
|
||||
cloud_admin: packstack-admin
|
||||
irrelevant-files:
|
||||
- config_tempest/tests/.*$
|
||||
- ^doc/.*$
|
||||
|
|
|
@ -21,6 +21,11 @@ is then copied to tempest directory.
|
|||
|
||||
The path to the virtual environment of python-tempestconf tool.
|
||||
|
||||
.. zuul:rolevar:: shade
|
||||
:default: ~/.virtualenvs/.shade
|
||||
|
||||
The path to the virtual environment of shade.
|
||||
|
||||
.. zuul:rolevar:: source_credentials_commands
|
||||
:type: string
|
||||
|
||||
|
@ -58,3 +63,22 @@ is then copied to tempest directory.
|
|||
Additional parameters for tempestconf if more specific parameters are
|
||||
needed, different from the ones which are the same for devstack and tempest.
|
||||
|
||||
.. zuul:rolevar:: test_demo_user
|
||||
:type: Boolean
|
||||
:default: False
|
||||
|
||||
If checking of demo user abilities is desired to be enabled, set this
|
||||
variable to True.
|
||||
When True, a set of tasks, where generation of tempest configuration is
|
||||
intended to fail, is included. The set includes also tasks, which create
|
||||
tempest resources. After that, the generation of the tempest configuration is
|
||||
suppossed to pass.
|
||||
NOTE: If the variable is set to True, it's needed to set cloud_admin variable
|
||||
as well, see info below.
|
||||
|
||||
.. zuul:rolevar:: cloud_admin
|
||||
:type: string
|
||||
:default: None
|
||||
|
||||
Name of credentials from clouds.yaml file, which will be used to create
|
||||
tempest resources in case, test_demo_user variable is set to True.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
devstack_base_dir: /opt/stack
|
||||
virtualenvs:
|
||||
tempestconf: ~/.virtualenvs/.tempestconf
|
||||
shade: ~/.virtualenvs/.shade
|
||||
url_cirros_image: "http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img"
|
||||
aditional_tempestconf_params: ""
|
||||
test_demo_user: False
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# Script to generate tempest.conf
|
||||
set -ex
|
||||
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
||||
source {{ virtualenvs.tempestconf }}/bin/activate
|
||||
{{ source_credentials_commands }}
|
||||
printenv
|
||||
discover-tempest-config \
|
||||
--debug \
|
||||
-v \
|
||||
{% if user == "admin" %}
|
||||
--create \
|
||||
{% else %}
|
||||
--non-admin \
|
||||
{% endif %}
|
||||
identity.uri $OS_AUTH_URL \
|
||||
identity.admin_password $OS_PASSWORD \
|
||||
service_available.swift False \
|
||||
{{ aditional_tempestconf_params }} \
|
||||
image.http_image {{ url_cirros_image }}
|
|
@ -34,25 +34,21 @@
|
|||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Generate tempest configuration script
|
||||
template:
|
||||
src: generate-tempestconf.sh.j2
|
||||
dest: "{{ tempestconf_src_relative_path }}/generate-tempestconf.sh"
|
||||
mode: 0744
|
||||
|
||||
- include: test-demo-user.yaml
|
||||
when: test_demo_user
|
||||
|
||||
- name: Generate tempest configuration file
|
||||
shell: |
|
||||
set -ex
|
||||
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
||||
source {{ virtualenvs.tempestconf }}/bin/activate
|
||||
{{ source_credentials_commands }}
|
||||
printenv
|
||||
discover-tempest-config \
|
||||
--debug \
|
||||
-v \
|
||||
--create \
|
||||
identity.uri $OS_AUTH_URL \
|
||||
identity.admin_password $OS_PASSWORD \
|
||||
service_available.swift False \
|
||||
{{ aditional_tempestconf_params }} \
|
||||
image.http_image {{ url_cirros_image }}
|
||||
./generate-tempestconf.sh
|
||||
args:
|
||||
chdir: "{{ tempestconf_src_relative_path }}"
|
||||
executable: /bin/bash
|
||||
chdir: "{{ tempestconf_src_relative_path }}"
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Print generated tempest.conf and copy it to tempest directory
|
||||
shell: |
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
- name: Generate tempest configuration file as demo user (expected to fail)
|
||||
shell: |
|
||||
./generate-tempestconf.sh
|
||||
args:
|
||||
chdir: "{{ tempestconf_src_relative_path }}"
|
||||
executable: /bin/bash
|
||||
register: result
|
||||
failed_when: result.rc == 0
|
||||
|
||||
- name: Create shade venv
|
||||
pip:
|
||||
virtualenv: "{{ virtualenvs.shade }}"
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
with_items:
|
||||
- pip
|
||||
- setuptools
|
||||
- shade
|
||||
|
||||
- name: Create m1.nano and m1.micro flavors for demo user
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ virtualenvs.shade }}"
|
||||
os_nova_flavor:
|
||||
cloud: "{{ cloud_admin }}"
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
ram: 64
|
||||
vcpus: 1
|
||||
disk: 0
|
||||
with_items:
|
||||
- "m1.nano"
|
||||
- "m1.micro"
|
||||
|
||||
- name: Download cirros image
|
||||
get_url:
|
||||
url: "{{ url_cirros_image }}"
|
||||
dest: "{{ tempestconf_src_relative_path }}/etc/"
|
||||
mode: 0660
|
||||
|
||||
- name: Create image and image alt for demo user
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ virtualenvs.shade }}"
|
||||
os_image:
|
||||
cloud: "{{ cloud_admin }}"
|
||||
name: "{{ item }}"
|
||||
disk_format: qcow2
|
||||
state: present
|
||||
filename: "{{ tempestconf_src_relative_path }}/etc/{{ url_cirros_image | basename }}"
|
||||
with_items:
|
||||
- "{{ url_cirros_image | basename }}"
|
||||
- '{{ url_cirros_image | basename }}_alt'
|
Loading…
Reference in New Issue