blob: ea4b5e3516e983ce5c64ff2734ce4f6f4958cf73 [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"
29DEVSTACK_GATE_TEMPEST_REGEX="(^patrole_tempest_plugin\.tests\.api)"
30
31# Import devstack function 'iniset'.
32source $BASE/new/devstack/functions
33
34# First argument is expected to contain value equal either to 'admin' or
35# 'member' (both lower-case).
36RBAC_ROLE=$1
37
38if [[ "$RBAC_ROLE" == "member" ]]; then
39 RBAC_ROLE="Member"
40fi
41
42# Set rbac_flag=True under [rbac] section in tempest.conf
43iniset $TEMPEST_CONFIG rbac rbac_flag True
44# Set rbac_test_role=$RBAC_ROLE under [rbac] section in tempest.conf
45iniset $TEMPEST_CONFIG rbac rbac_test_role $RBAC_ROLE
46# Set additional, necessary CONF values
47iniset $TEMPEST_CONFIG auth use_dynamic_credentials True
48iniset $TEMPEST_CONFIG auth tempest_roles Member
49
50# Give permissions back to Tempest.
51sudo chown -R tempest:stack $BASE/new/tempest
52sudo chown -R tempest:stack $BASE/data/tempest
53
54set -o errexit
55
56# cd into Tempest directory before executing tox.
57cd $BASE/new/tempest
58
59$TEMPEST_COMMAND -eall-plugin -- $DEVSTACK_GATE_TEMPEST_REGEX --concurrency=$TEMPEST_CONCURRENCY
60sudo -H -u tempest .tox/all-plugin/bin/tempest list-plugins