82a571c486
Currently, Manila CI Tempest jobs use deprecated options of Tempest. Recently, latest version of Tempest dropped them [1]. Manila CI jobs work ok, because they check out specific version of Tempest. But it will work until first Devstack update for some one more Tempest feature and then we will be forced to use latest Tempest again. Switch to supported approach of setting up users in Tempest, to avoid such sudden blockers. [1] I8c24cd17f643083dde71ab2bd2a38417c54aeccb Change-Id: I5b3ebab52ea1401f6f7a116d1260268eb10ebe0c Closes-Bug: #1586129
215 lines
8.9 KiB
Bash
Executable File
215 lines
8.9 KiB
Bash
Executable File
#!/bin/bash -xe
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
# This script is executed inside post_test_hook function in devstack gate.
|
|
# First argument ($1) expects 'multibackend' as value for setting appropriate
|
|
# tempest conf opts, all other values will assume singlebackend installation.
|
|
|
|
sudo chown -R jenkins:stack $BASE/new/tempest
|
|
sudo chown -R jenkins:stack $BASE/data/tempest
|
|
sudo chmod -R o+rx $BASE/new/devstack/files
|
|
|
|
# Import devstack functions 'iniset', 'iniget' and 'trueorfalse'
|
|
source $BASE/new/devstack/functions
|
|
|
|
export TEMPEST_CONFIG=${TEMPEST_CONFIG:-$BASE/new/tempest/etc/tempest.conf}
|
|
|
|
# === Handle script arguments ===
|
|
|
|
# First argument is expected to contain value equal either to 'singlebackend'
|
|
# or 'multibackend' that defines how many back-ends are used.
|
|
BACK_END_TYPE=$1
|
|
|
|
# Second argument is expected to have codename of a share driver.
|
|
DRIVER=$2
|
|
|
|
# Third argument is expected to contain either 'api' or 'scenario' values
|
|
# that define test suites to be run.
|
|
TEST_TYPE=$3
|
|
|
|
# Fourth argument is expected to be boolean-like and it should be 'true'
|
|
# when PostgreSQL DB back-end is used and 'false' when MySQL.
|
|
POSTGRES_ENABLED=$4
|
|
POSTGRES_ENABLED=$(trueorfalse True POSTGRES_ENABLED)
|
|
|
|
if [[ "$BACK_END_TYPE" == "multibackend" ]]; then
|
|
iniset $TEMPEST_CONFIG share multi_backend True
|
|
iniset $TEMPEST_CONFIG share run_migration_tests $(trueorfalse True RUN_MANILA_MIGRATION_TESTS)
|
|
|
|
# Set share backends names, they are defined within pre_test_hook
|
|
export BACKENDS_NAMES="LONDON,PARIS"
|
|
else
|
|
export BACKENDS_NAMES="LONDON"
|
|
fi
|
|
iniset $TEMPEST_CONFIG share backend_names $BACKENDS_NAMES
|
|
|
|
# Set two retries for CI jobs
|
|
iniset $TEMPEST_CONFIG share share_creation_retry_number 2
|
|
|
|
# Suppress errors in cleanup of resources
|
|
SUPPRESS_ERRORS=${SUPPRESS_ERRORS_IN_CLEANUP:-True}
|
|
iniset $TEMPEST_CONFIG share suppress_errors_in_cleanup $SUPPRESS_ERRORS
|
|
|
|
USERNAME_FOR_USER_RULES=${USERNAME_FOR_USER_RULES:-"manila"}
|
|
PASSWORD_FOR_SAMBA_USER=${PASSWORD_FOR_SAMBA_USER:-$USERNAME_FOR_USER_RULES}
|
|
|
|
RUN_MANILA_CG_TESTS=${RUN_MANILA_CG_TESTS:-True}
|
|
RUN_MANILA_MANAGE_TESTS=${RUN_MANILA_MANAGE_TESTS:-True}
|
|
RUN_MANILA_MANAGE_SNAPSHOT_TESTS=${RUN_MANILA_MANAGE_SNAPSHOT_TESTS:-False}
|
|
|
|
MANILA_CONF=${MANILA_CONF:-/etc/manila/manila.conf}
|
|
|
|
# Enable replication tests
|
|
RUN_MANILA_REPLICATION_TESTS=${RUN_MANILA_REPLICATION_TESTS:-False}
|
|
iniset $TEMPEST_CONFIG share run_replication_tests $RUN_MANILA_REPLICATION_TESTS
|
|
|
|
if [[ -z "$MULTITENANCY_ENABLED" ]]; then
|
|
# Define whether share drivers handle share servers or not.
|
|
# Requires defined config option 'driver_handles_share_servers'.
|
|
NO_SHARE_SERVER_HANDLING_MODES=0
|
|
WITH_SHARE_SERVER_HANDLING_MODES=0
|
|
|
|
# Convert backend names to config groups using lowercase translation
|
|
CONFIG_GROUPS=${BACKENDS_NAMES,,}
|
|
|
|
for CG in ${CONFIG_GROUPS//,/ }; do
|
|
DRIVER_HANDLES_SHARE_SERVERS=$(iniget $MANILA_CONF $CG driver_handles_share_servers)
|
|
if [[ $DRIVER_HANDLES_SHARE_SERVERS == False ]]; then
|
|
NO_SHARE_SERVER_HANDLING_MODES=$((NO_SHARE_SERVER_HANDLING_MODES+1))
|
|
elif [[ $DRIVER_HANDLES_SHARE_SERVERS == True ]]; then
|
|
WITH_SHARE_SERVER_HANDLING_MODES=$((WITH_SHARE_SERVER_HANDLING_MODES+1))
|
|
else
|
|
echo "Config option 'driver_handles_share_servers' either is not defined or \
|
|
defined with improper value - '$DRIVER_HANDLES_SHARE_SERVERS'."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [[ $NO_SHARE_SERVER_HANDLING_MODES -ge 1 && $WITH_SHARE_SERVER_HANDLING_MODES -ge 1 || \
|
|
$NO_SHARE_SERVER_HANDLING_MODES -eq 0 && $WITH_SHARE_SERVER_HANDLING_MODES -eq 0 ]]; then
|
|
echo 'Allowed only same driver modes for all backends to be run with Tempest job.'
|
|
exit 1
|
|
elif [[ $NO_SHARE_SERVER_HANDLING_MODES -ge 1 ]]; then
|
|
MULTITENANCY_ENABLED='False'
|
|
elif [[ $WITH_SHARE_SERVER_HANDLING_MODES -ge 1 ]]; then
|
|
MULTITENANCY_ENABLED='True'
|
|
else
|
|
echo 'Should never get here unless an error occurred.'
|
|
exit 1
|
|
fi
|
|
else
|
|
MULTITENANCY_ENABLED=$(trueorfalse True MULTITENANCY_ENABLED)
|
|
fi
|
|
|
|
# Set multitenancy configuration for Tempest
|
|
iniset $TEMPEST_CONFIG share multitenancy_enabled $MULTITENANCY_ENABLED
|
|
if [[ "$MULTITENANCY_ENABLED" == "False" ]]; then
|
|
# Using approach without handling of share servers we have bigger load for
|
|
# volume creation in Cinder using Generic driver. So, reduce amount of
|
|
# threads to avoid errors for Cinder volume creations that appear
|
|
# because of lack of free space.
|
|
MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-8}
|
|
iniset $TEMPEST_CONFIG auth create_isolated_networks False
|
|
fi
|
|
|
|
# let us control if we die or not
|
|
set +o errexit
|
|
cd $BASE/new/tempest
|
|
|
|
export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-6}
|
|
export MANILA_TESTS=${MANILA_TESTS:-'manila_tempest_tests.tests.api'}
|
|
|
|
if [[ "$TEST_TYPE" == "scenario" ]]; then
|
|
echo "Set test set to scenario only"
|
|
MANILA_TESTS='manila_tempest_tests.tests.scenario'
|
|
elif [[ "$DRIVER" == "generic" ]]; then
|
|
RUN_MANILA_MANAGE_SNAPSHOT_TESTS=True
|
|
if [[ "$POSTGRES_ENABLED" == "True" ]]; then
|
|
# Run only CIFS tests on PostgreSQL DB backend
|
|
# to reduce amount of tests per job using 'generic' share driver.
|
|
iniset $TEMPEST_CONFIG share enable_protocols cifs
|
|
else
|
|
# Run only NFS tests on MySQL DB backend to reduce amount of tests
|
|
# per job using 'generic' share driver.
|
|
iniset $TEMPEST_CONFIG share enable_protocols nfs
|
|
fi
|
|
MANILA_TESTS="(^manila_tempest_tests.tests.api)(?=.*\[.*\bbackend\b.*\])"
|
|
fi
|
|
|
|
if [[ "$DRIVER" == "lvm" ]]; then
|
|
MANILA_TEMPEST_CONCURRENCY=8
|
|
RUN_MANILA_CG_TESTS=False
|
|
RUN_MANILA_MANAGE_TESTS=False
|
|
iniset $TEMPEST_CONFIG share run_shrink_tests False
|
|
iniset $TEMPEST_CONFIG share enable_ip_rules_for_protocols 'nfs'
|
|
iniset $TEMPEST_CONFIG share enable_user_rules_for_protocols 'cifs'
|
|
if ! grep $USERNAME_FOR_USER_RULES "/etc/passwd"; then
|
|
sudo useradd $USERNAME_FOR_USER_RULES
|
|
fi
|
|
(echo $PASSWORD_FOR_SAMBA_USER; echo $PASSWORD_FOR_SAMBA_USER) | sudo smbpasswd -s -a $USERNAME_FOR_USER_RULES
|
|
sudo smbpasswd -e $USERNAME_FOR_USER_RULES
|
|
samba_daemon_name=smbd
|
|
if is_fedora; then
|
|
samba_daemon_name=smb
|
|
fi
|
|
sudo service $samba_daemon_name restart
|
|
elif [[ "$DRIVER" == "zfsonlinux" ]]; then
|
|
MANILA_TEMPEST_CONCURRENCY=8
|
|
RUN_MANILA_CG_TESTS=False
|
|
RUN_MANILA_MANAGE_TESTS=False
|
|
iniset $TEMPEST_CONFIG share run_migration_tests False
|
|
iniset $TEMPEST_CONFIG share run_quota_tests True
|
|
iniset $TEMPEST_CONFIG share run_replication_tests True
|
|
iniset $TEMPEST_CONFIG share run_shrink_tests True
|
|
iniset $TEMPEST_CONFIG share enable_ip_rules_for_protocols 'nfs'
|
|
iniset $TEMPEST_CONFIG share enable_user_rules_for_protocols ''
|
|
iniset $TEMPEST_CONFIG share enable_cert_rules_for_protocols ''
|
|
iniset $TEMPEST_CONFIG share enable_ro_access_level_for_protocols 'nfs'
|
|
iniset $TEMPEST_CONFIG share build_timeout 180
|
|
iniset $TEMPEST_CONFIG share share_creation_retry_number 0
|
|
iniset $TEMPEST_CONFIG share capability_storage_protocol 'NFS'
|
|
iniset $TEMPEST_CONFIG share enable_protocols 'nfs'
|
|
iniset $TEMPEST_CONFIG share suppress_errors_in_cleanup False
|
|
iniset $TEMPEST_CONFIG share multitenancy_enabled False
|
|
iniset $TEMPEST_CONFIG share multi_backend True
|
|
iniset $TEMPEST_CONFIG share backend_replication_type 'readable'
|
|
fi
|
|
|
|
# Enable consistency group tests
|
|
iniset $TEMPEST_CONFIG share run_consistency_group_tests $RUN_MANILA_CG_TESTS
|
|
|
|
# Enable manage/unmanage tests
|
|
iniset $TEMPEST_CONFIG share run_manage_unmanage_tests $RUN_MANILA_MANAGE_TESTS
|
|
|
|
# Enable manage/unmanage snapshot tests
|
|
iniset $TEMPEST_CONFIG share run_manage_unmanage_snapshot_tests $RUN_MANILA_MANAGE_SNAPSHOT_TESTS
|
|
|
|
iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
|
|
iniset $TEMPEST_CONFIG validation network_for_ssh ${PRIVATE_NETWORK_NAME:-"private"}
|
|
|
|
# check if tempest plugin was installed correctly
|
|
echo 'import pkg_resources; print list(pkg_resources.iter_entry_points("tempest.test_plugins"))' | python
|
|
|
|
ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-"Default"}
|
|
export OS_PROJECT_DOMAIN_NAME=$ADMIN_DOMAIN_NAME
|
|
export OS_USER_DOMAIN_NAME=$ADMIN_DOMAIN_NAME
|
|
|
|
# Also, we should wait until service VM is available
|
|
# before running Tempest tests using Generic driver in DHSS=False mode.
|
|
source $BASE/new/manila/contrib/ci/common.sh
|
|
manila_wait_for_drivers_init $MANILA_CONF
|
|
|
|
echo "Running tempest manila test suites"
|
|
sudo -H -u jenkins tox -eall-plugin $MANILA_TESTS -- --concurrency=$MANILA_TEMPEST_CONCURRENCY
|