Add ability to add rally cleanup script

This patch set provides a way to specify clean up scripts for rally tests
to clean up orphaned resources in the event of rally test failures.

Change-Id: Ifc988002711d34186975988abb33ecd8a9a2fba4
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2019-09-21 00:55:37 -05:00
parent eacf937221
commit a6b1bd293d

View File

@ -21,15 +21,16 @@ set -ex
: "${RALLY_ENV_NAME:="openstack-helm"}" : "${RALLY_ENV_NAME:="openstack-helm"}"
: "${OS_INTERFACE:="public"}" : "${OS_INTERFACE:="public"}"
: "${AUTO_REMOVE_USER:="true"}" : "${RALLY_CLEANUP:="true"}"
if [ "x$AUTO_REMOVE_USER" == "xtrue" ]; then if [ "x$RALLY_CLEANUP" == "xtrue" ]; then
function remove_rally_user { function rally_cleanup {
openstack user delete \ openstack user delete \
--domain="${SERVICE_OS_USER_DOMAIN_NAME}" \ --domain="${SERVICE_OS_USER_DOMAIN_NAME}" \
"${SERVICE_OS_USERNAME}" "${SERVICE_OS_USERNAME}"
{{ $rallyTests.clean_up | default "" | indent 4 }}
} }
trap remove_rally_user EXIT trap rally_cleanup EXIT
fi fi
function create_or_update_db () { function create_or_update_db () {