From a8afbe03b860460cc61b4634f5aeaeab2ffd97a0 Mon Sep 17 00:00:00 2001 From: Ghanshyam Mann Date: Fri, 21 Jan 2022 15:33:54 -0600 Subject: [PATCH] Configure correct Tempest venv upper constraints We use Tempest master for testing the supported stable branches, so using master upper constraints works fine for such master or stable branch testing, but when we need to use old Tempest in the below cases then master upper constraints do not work for Tempest venv: - Testing Extended Maintenance branch Example: stable/train tempest cap - https://review.opendev.org/c/openstack/manila/+/825246 manila run tempest tests via contrib/ci/post_test_hook.sh and it use master constraints even for stable branches when we need to use stable constraints. using master constraints end up recreating the Tempest venv and flush the already installed tempest plugins and their deps. This commit set the compatible upper constraint according to TEMPEST_VENV_UPPER_CONSTRAINTS variable, which is what used in devstack while creating the Tempest venv and install tempest plugins in that venv. This fixes the script until stable/ussuri as later stable has deprecated this script. [stable-only] Related-Bug: #1922597 Change-Id: If2a68f9f12e163fccffbf1c70946e5c97d7063d1 (cherry picked from commit 3ba39e38b8fc0c865e8a7696ece927a5b122db6c) --- contrib/ci/post_test_hook.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/contrib/ci/post_test_hook.sh b/contrib/ci/post_test_hook.sh index 3e5c7b232c..ba6df026f6 100755 --- a/contrib/ci/post_test_hook.sh +++ b/contrib/ci/post_test_hook.sh @@ -346,6 +346,24 @@ source $BASE/new/devstack/openrc admin admin manila service-list cd $BASE/new/tempest/ +# NOTE(gmann): If gate explicitly set the non master +# constraints to use for Tempest venv then use the same +# while running the tests too otherwise, it will recreate +# the Tempest venv due to constraints mismatch. +# recreation of Tempest venv can flush the initially installed +# tempest plugins and their deps. +# We cap EMstate stable branch with older Tempest and stable +# constraints. +TEMPEST_VENV_UPPER_CONSTRAINTS=$(set +o xtrace && + source $BASE/new/devstack/stackrc && + echo $TEMPEST_VENV_UPPER_CONSTRAINTS) +if [[ "$TEMPEST_VENV_UPPER_CONSTRAINTS" != "master" ]]; then + echo "Using $TEMPEST_VENV_UPPER_CONSTRAINTS constraints in Tempest virtual env." + # NOTE: setting both tox env var and once Tempest start using new var + # TOX_CONSTRAINTS_FILE then we can remove the old one. + export UPPER_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS + export TOX_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS +fi echo "Running manila tempest tests:" tox -evenv-tempest -- tempest run -r $MANILA_TESTS -w $MANILA_TEMPEST_CONCURRENCY RETVAL=$?