Fix tempest venv constraints for target branch tempest run

We fixed the tempest venv constraints setting for tempest test run
on base branch but forgot to do the same for target branch test run.
It cause issue when base and target branch have different Tempest
and constraints to use (for example stable/wallaby use old tmepest
and stable/wallaby constraints but stable/xena use tempest master
and master constraints), in such cases we need to set proper constraints
defined in devstack and then run tempest.

We do not see this issue as none of the job run tempest on target except
heat (https://review.opendev.org/c/openstack/heat/+/872055/5).

I reproduced the issue in grenade stable/xena by enaling the tempest run
on target:
- https://review.opendev.org/c/openstack/grenade/+/878247/1
- https://zuul.opendev.org/t/openstack/build/1b503d359717459c9c77010608068e27/log/controller/logs/grenade.sh_log.txt#17184

Closes-Bug: 2003993
Change-Id: I05fcdb5045a33997bd1a4c340a16458d88399f5f
This commit is contained in:
Ghanshyam Mann 2023-03-30 20:58:04 -05:00
parent 1ce132fdaf
commit 4c9c059883
2 changed files with 41 additions and 33 deletions

View File

@ -135,6 +135,45 @@ function exit_trap {
}
function run_tempest {
local release_dir
release_dir=$1
cd $release_dir/tempest
# unset the constraints as it might have been set earlier
# by base or target test run
unset TEMPEST_VENV_UPPER_CONSTRAINTS
# NOTE(yoctozepto): Grenade does not know about
# TEMPEST_VENV_UPPER_CONSTRAINTS, only DevStack does.
# This sources that one variable from it.
TEMPEST_VENV_UPPER_CONSTRAINTS=$(set +o xtrace &&
source $release_dir/devstack/stackrc &&
echo $TEMPEST_VENV_UPPER_CONSTRAINTS)
# 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.
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
else
# NOTE(gmann): we need to set the below env var pointing to master
# constraints even that is what default in tox.ini. Otherwise it
# can create the issue for grenade run where old and new devstack
# can have different tempest (old and master) to install. For
# detail problem, refer to the
# https://bugs.launchpad.net/devstack/+bug/2003993
export UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/master
export TOX_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/master
fi
tox -esmoke -- --concurrency=$TEMPEST_CONCURRENCY
}
# Force a shorter connect timeout, if networking has gone off the
# rails we could potentially be hanging around for minutes on every
# ssh attempt due to TCP timeouts/retries.

View File

@ -288,37 +288,7 @@ if [[ "$RUN_BASE" == "True" ]]; then
# Validate the install
if [[ "$BASE_RUN_SMOKE" == "True" ]]; then
echo_summary "Running base smoke test"
cd $BASE_RELEASE_DIR/tempest
# NOTE(yoctozepto): Grenade does not know about
# TEMPEST_VENV_UPPER_CONSTRAINTS, only DevStack does.
# This sources that one variable from it.
TEMPEST_VENV_UPPER_CONSTRAINTS=$(set +o xtrace &&
source $BASE_DEVSTACK_DIR/stackrc &&
echo $TEMPEST_VENV_UPPER_CONSTRAINTS)
# 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.
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
else
# NOTE(gmann): we need to set the below env var pointing to master
# constraints even that is what default in tox.ini. Otherwise it
# can create the issue for grenade run where old and new devstack
# can have different tempest (old and master) to install. For
# detail problem, refer to the
# https://bugs.launchpad.net/devstack/+bug/2003993
export UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/master
export TOX_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/master
fi
tox -esmoke -- --concurrency=$TEMPEST_CONCURRENCY
run_tempest $BASE_RELEASE_DIR
if [ "${GRENADE_USE_EXTERNAL_DEVSTACK}" != "True" ]; then
# once we are done, copy our created artifacts to the target
if [[ -e $TARGET_RELEASE_DIR/tempest ]]; then
@ -398,8 +368,7 @@ if [[ "$RUN_TARGET" == "True" ]]; then
# will be run twice against the new cloud.
if [[ "$TARGET_RUN_SMOKE" == "True" ]]; then
echo_summary "Running tempest smoke tests"
cd $TARGET_RELEASE_DIR/tempest
tox -esmoke -- --concurrency=$TEMPEST_CONCURRENCY
run_tempest $TARGET_RELEASE_DIR
stop $STOP run-smoke 330
fi