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 3ba39e38b8)
This commit is contained in:
Ghanshyam Mann 2022-01-21 15:33:54 -06:00
parent 2cebaa9d0b
commit a8afbe03b8
1 changed files with 18 additions and 0 deletions

View File

@ -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=$?