Initial skeleton for devstack-tempest base job

Setup the initial folder and play to run tempest.
This simply runs tempest full for now, with not support for config
options.

Change-Id: Ifcb4f8f36e5cc0cd0f25b13220146c4d97f7947a
This commit is contained in:
Andrea Frittoli
2017-09-14 15:23:39 -06:00
parent 3d915fe3aa
commit 5f9caa35e2
14 changed files with 125 additions and 1 deletions

View File

@@ -51,13 +51,25 @@
post-run:
playbooks/post
- job:
name: devstack-tempest
parent: devstack
description: Base Tempest job.
required-projects:
- openstack/tempest
timeout: 7200
vars:
devstack_services:
tempest: True
- project:
name: openstack-infra/devstack-gate
check:
jobs:
- devstack:
- devstack-tempest:
files:
- ^playbooks/pre
- ^playbooks/post
- ^playbooks/devstack
- ^playbooks/devstack-tempest
- ^roles/

View File

@@ -0,0 +1,15 @@
# Changes that run through devstack-tempest are likely to have an impact on
# the devstack part of the job, so we keep devstack in the main play to
# avoid zuul retrying on legitimate failures.
- hosts: all
roles:
- run-devstack
# NOTE(andreaf) For now run on all, since we don't have anything in the
# inventory to select a test runner.
- hosts: all
roles:
- setup-tempest-run-dir
- setup-tempest-data-dir
- acl-devstack-files
- run-tempest

View File

@@ -0,0 +1,10 @@
Grant global read access to devstack `files` folder.
This is handy to grant the `tempest` user access to VM images for testing.
**Role Variables**
.. zuul:rolevar:: devstack_data_dir
:default: /opt/stack/data
The devstack data directory.

View File

@@ -0,0 +1 @@
devstack_data_dir: /opt/stack/data

View File

@@ -0,0 +1,6 @@
- name: Grant global read access to devstack files
file:
path: "{{devstack_data_dir}}/files"
mode: "o+rx"
recurse: yes
become: yes

View File

@@ -0,0 +1,13 @@
Run Tempest
**Role Variables**
.. zuul:rolevar:: devstack_base_dir
:default: /opt/stack
The devstack base directory.
.. zuul:rolevar:: tempest_concurrency
:default: 0
The number of parallel test processes.

View File

@@ -0,0 +1 @@
devstack_base_dir: /opt/stack

View File

@@ -0,0 +1,24 @@
# NOTE(andreaf) The number of vcpus is not available on all systems.
# See https://github.com/ansible/ansible/issues/30688
# When not available, we fall back to ansible_processor_cores
- name: Get hw.logicalcpu from sysctl
shell: sysctl hw.logicalcpu | cut -d' ' -f2
register: sysctl_hw_logicalcpu
when: ansible_processor_vcpus is not defined
- name: Get default concurrency
set_fact:
default_concurrency: "{{ansible_processor_vcpus|default(sysctl_hw_logicalcpu.stdout)|int}}"
- name: Limit max concurrency when more than 3 vcpus are available
set_fact:
default_concurrency: "{{default_concurrency|int // 2}}"
when: default_concurrency|int > 3
- name: Run Tempest
command: tox -e full -- --concurrency={{tempest_concurrency|default(default_concurrency)}}
args:
chdir: "{{devstack_base_dir}}/tempest"
become: true
become_user: tempest

View File

@@ -0,0 +1,12 @@
Setup the `tempest` user as owner of Tempest's data folder.
Tempest's devstack plugin creates the data folder, but it has no knowledge
of the `tempest` user, so we need a role to fix ownership on the data folder.
**Role Variables**
.. zuul:rolevar:: devstack_data_dir
:default: /opt/stack/data
The devstack data directory.

View File

@@ -0,0 +1 @@
devstack_data_dir: /opt/stack/data

View File

@@ -0,0 +1,7 @@
- name: Set tempest as owner of Tempest data folder
file:
path: "{{devstack_data_dir}}/tempest"
owner: tempest
group: stack
recurse: yes
become: yes

View File

@@ -0,0 +1,14 @@
Setup Tempest run folder.
To support isolation between multiple runs, separate run folders are required.
Set `tempest` as owner of Tempest's current run folder.
There is an implicit assumption here of a one to one relationship between
devstack versions and Tempest runs.
**Role Variables**
.. zuul:rolevar:: devstack_base_dir
:default: /opt/stack
The devstack base directory.

View File

@@ -0,0 +1 @@
devstack_base_dir: /opt/stack

View File

@@ -0,0 +1,7 @@
- name: Set tempest as owner of Tempest run folder
file:
path: "{{devstack_base_dir}}/tempest"
owner: tempest
group: stack
recurse: yes
become: yes