Skip to content

Commit ff895cc

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add a variable to configure the Tempest venv upper constraints"
2 parents d5a97c1 + 3bdc8f6 commit ff895cc

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

lib/tempest

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ function image_size_in_gib {
111111
echo $size | python3 -c "import math; print(int(math.ceil(float(int(input()) / 1024.0 ** 3))))"
112112
}
113113

114+
function set_tempest_venv_constraints {
115+
local tmp_c
116+
tmp_c=$1
117+
if [[ $TEMPEST_VENV_UPPER_CONSTRAINTS == "master" ]]; then
118+
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > $tmp_c
119+
else
120+
echo "Using $TEMPEST_VENV_UPPER_CONSTRAINTS constraints in Tempest virtual env."
121+
cat $TEMPEST_VENV_UPPER_CONSTRAINTS > $tmp_c
122+
# NOTE: setting both tox env var and once Tempest start using new var
123+
# TOX_CONSTRAINTS_FILE then we can remove the old one.
124+
export UPPER_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS
125+
export TOX_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS
126+
fi
127+
}
128+
114129
# configure_tempest() - Set config files, create data dirs, etc
115130
function configure_tempest {
116131
if [[ "$INSTALL_TEMPEST" == "True" ]]; then
@@ -613,10 +628,9 @@ function configure_tempest {
613628
tox -revenv-tempest --notest
614629
fi
615630

616-
# The requirements might be on a different branch, while tempest needs master requirements.
617631
local tmp_u_c_m
618632
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
619-
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > $tmp_u_c_m
633+
set_tempest_venv_constraints $tmp_u_c_m
620634
tox -evenv-tempest -- pip install -c $tmp_u_c_m -r requirements.txt
621635
rm -f $tmp_u_c_m
622636

@@ -697,26 +711,30 @@ function install_tempest {
697711
# TEMPEST_DIR already exist until RECLONE is true.
698712
git checkout $TEMPEST_BRANCH
699713

714+
local tmp_u_c_m
715+
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
716+
set_tempest_venv_constraints $tmp_u_c_m
717+
700718
tox -r --notest -efull
701719
# TODO: remove the trailing pip constraint when a proper fix
702720
# arrives for bug https://bugs.launchpad.net/devstack/+bug/1906322
703721
$TEMPEST_DIR/.tox/tempest/bin/pip install -U -r $RC_DIR/tools/cap-pip.txt
704722
# NOTE(mtreinish) Respect constraints in the tempest full venv, things that
705723
# are using a tox job other than full will not be respecting constraints but
706724
# running pip install -U on tempest requirements
707-
$TEMPEST_DIR/.tox/tempest/bin/pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
725+
$TEMPEST_DIR/.tox/tempest/bin/pip install -c $tmp_u_c_m -r requirements.txt
708726
PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/tempest
727+
rm -f $tmp_u_c_m
709728
popd
710729
}
711730

712731
# install_tempest_plugins() - Install any specified plugins into the tempest venv
713732
function install_tempest_plugins {
714733
pushd $TEMPEST_DIR
715734
if [[ $TEMPEST_PLUGINS != 0 ]] ; then
716-
# The requirements might be on a different branch, while tempest & tempest plugins needs master requirements.
717735
local tmp_u_c_m
718736
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
719-
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > $tmp_u_c_m
737+
set_tempest_venv_constraints $tmp_u_c_m
720738
tox -evenv-tempest -- pip install -c $tmp_u_c_m $TEMPEST_PLUGINS
721739
rm -f $tmp_u_c_m
722740
echo "Checking installed Tempest plugins:"

stackrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ REQUIREMENTS_BRANCH=${REQUIREMENTS_BRANCH:-$TARGET_BRANCH}
298298
# Tempest test suite
299299
TEMPEST_REPO=${TEMPEST_REPO:-${GIT_BASE}/openstack/tempest.git}
300300
TEMPEST_BRANCH=${TEMPEST_BRANCH:-$BRANCHLESS_TARGET_BRANCH}
301+
TEMPEST_VENV_UPPER_CONSTRAINTS=${TEMPEST_VENV_UPPER_CONSTRAINTS:-master}
301302

302303

303304
##############

0 commit comments

Comments
 (0)