blob: 085b5b1af27d409ed6cab54654b485da46dcf3d7 [file] [log] [blame]
Felipe Monteiro52c55652017-03-06 11:37:25 -05001#!/bin/bash -xe
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15# This script is executed inside post_test_hook function in devstack gate.
16# First argument ($1) expects 'rbac-role' as value for setting appropriate
17# tempest rbac option 'rbac_test_role'.
18
19# Install pip manually.
20PATROLE_DIR=$BASE/new/patrole
21sudo pip install -e $PATROLE_DIR
22
23# Allow tempest.conf to be modified by Jenkins.
24sudo chown -R jenkins:stack $BASE/new/tempest
25sudo chown -R jenkins:stack $BASE/data/tempest
26
27TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf
28TEMPEST_COMMAND="sudo -H -u tempest tox"
Felipe Monteiro90c7eef2017-04-03 14:42:06 +010029
30DEVSTACK_GATE_TEMPEST_REGEX="(?!.*\[.*\bslow\b.*\])(^patrole_tempest_plugin\.tests\.api)"
31DEVSTACK_MULTINODE_GATE_TEMPEST_REGEX="(?=.*\[.*\bslow\b.*\])(^patrole_tempest_plugin\.tests\.api)"
Felipe Monteiro52c55652017-03-06 11:37:25 -050032
33# Import devstack function 'iniset'.
34source $BASE/new/devstack/functions
35
Rick Bartra89f498f2017-03-20 15:54:45 -040036# Use uuid tokens for faster test runs
37KEYSTONE_CONF=/etc/keystone/keystone.conf
38iniset $KEYSTONE_CONF token provider uuid
39sudo service apache2 restart
40
Felipe Monteiro52c55652017-03-06 11:37:25 -050041# First argument is expected to contain value equal either to 'admin' or
42# 'member' (both lower-case).
43RBAC_ROLE=$1
44
45if [[ "$RBAC_ROLE" == "member" ]]; then
46 RBAC_ROLE="Member"
47fi
48
Felipe Monteiro90c7eef2017-04-03 14:42:06 +010049# Second argument is expected to contain value indicating whether the
50# environment is "multinode" or not (empty string).
anthony.lin59c886c2017-03-23 14:33:00 -050051TYPE=$2
52
Samantha Blanco0d880082017-03-23 18:14:37 -040053# Set enable_rbac=True under [rbac] section in tempest.conf
54iniset $TEMPEST_CONFIG rbac enable_rbac True
Felipe Monteiro52c55652017-03-06 11:37:25 -050055# Set rbac_test_role=$RBAC_ROLE under [rbac] section in tempest.conf
56iniset $TEMPEST_CONFIG rbac rbac_test_role $RBAC_ROLE
Samantha Blanco0d880082017-03-23 18:14:37 -040057# Set strict_policy_check=False under [rbac] section in tempest.conf
58iniset $TEMPEST_CONFIG rbac strict_policy_check False
Felipe Monteiro52c55652017-03-06 11:37:25 -050059# Set additional, necessary CONF values
60iniset $TEMPEST_CONFIG auth use_dynamic_credentials True
61iniset $TEMPEST_CONFIG auth tempest_roles Member
Felipe Monteiro86fdd632017-03-13 12:07:38 -040062iniset $TEMPEST_CONFIG identity auth_version v3
Felipe Monteiro52c55652017-03-06 11:37:25 -050063
64# Give permissions back to Tempest.
65sudo chown -R tempest:stack $BASE/new/tempest
66sudo chown -R tempest:stack $BASE/data/tempest
67
68set -o errexit
69
70# cd into Tempest directory before executing tox.
71cd $BASE/new/tempest
72
Felipe Monteiro90c7eef2017-04-03 14:42:06 +010073if [[ "$TYPE" == "multinode" ]]; then
74 $TEMPEST_COMMAND -eall-plugin -- $DEVSTACK_MULTINODE_GATE_TEMPEST_REGEX --concurrency=$TEMPEST_CONCURRENCY
anthony.lin59c886c2017-03-23 14:33:00 -050075else
Felipe Monteiro90c7eef2017-04-03 14:42:06 +010076 $TEMPEST_COMMAND -eall-plugin -- $DEVSTACK_GATE_TEMPEST_REGEX --concurrency=$TEMPEST_CONCURRENCY
anthony.lin59c886c2017-03-23 14:33:00 -050077fi
78
Felipe Monteiro52c55652017-03-06 11:37:25 -050079sudo -H -u tempest .tox/all-plugin/bin/tempest list-plugins