Skip to content

Commit 32fa6a4

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add a variable to configure the Tempest venv upper constraints" into stable/train
2 parents a552057 + 3c92daf commit 32fa6a4

2 files changed

Lines changed: 32 additions & 7 deletions

File tree

‎lib/tempest‎

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,21 @@ function image_size_in_gib {
110110
echo $size | python -c "import math; import six; print(int(math.ceil(float(int(six.moves.input()) / 1024.0 ** 3))))"
111111
}
112112

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

613-
# The requirements might be on a different branch, while tempest needs master requirements.
614-
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > u-c-m.txt
615-
tox -evenv-tempest -- pip install -c u-c-m.txt -r requirements.txt
628+
local tmp_u_c_m
629+
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
630+
set_tempest_venv_constraints $tmp_u_c_m
631+
tox -evenv-tempest -- pip install -c $tmp_u_c_m -r requirements.txt
632+
rm -f $tmp_u_c_m
616633

617634
# Auth:
618635
iniset $TEMPEST_CONFIG auth tempest_roles "member"
@@ -729,22 +746,29 @@ function install_tempest {
729746
# TEMPEST_DIR already exist until RECLONE is true.
730747
git checkout $TEMPEST_BRANCH
731748

749+
local tmp_u_c_m
750+
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
751+
set_tempest_venv_constraints $tmp_u_c_m
752+
732753
tox -r --notest -efull
733754
# NOTE(mtreinish) Respect constraints in the tempest full venv, things that
734755
# are using a tox job other than full will not be respecting constraints but
735756
# running pip install -U on tempest requirements
736-
$TEMPEST_DIR/.tox/tempest/bin/pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
757+
$TEMPEST_DIR/.tox/tempest/bin/pip install -c $tmp_u_c_m -r requirements.txt
737758
PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/tempest
759+
rm -f $tmp_u_c_m
738760
popd
739761
}
740762

741763
# install_tempest_plugins() - Install any specified plugins into the tempest venv
742764
function install_tempest_plugins {
743765
pushd $TEMPEST_DIR
744766
if [[ $TEMPEST_PLUGINS != 0 ]] ; then
745-
# The requirements might be on a different branch, while tempest & tempest plugins needs master requirements.
746-
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > u-c-m.txt
747-
tox -evenv-tempest -- pip install -c u-c-m.txt $TEMPEST_PLUGINS
767+
local tmp_u_c_m
768+
tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
769+
set_tempest_venv_constraints $tmp_u_c_m
770+
tox -evenv-tempest -- pip install -c $tmp_u_c_m $TEMPEST_PLUGINS
771+
rm -f $tmp_u_c_m
748772
echo "Checking installed Tempest plugins:"
749773
tox -evenv-tempest -- tempest list-plugins
750774
fi

‎stackrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ REQUIREMENTS_BRANCH=${REQUIREMENTS_BRANCH:-$TARGET_BRANCH}
315315
# Tempest test suite
316316
TEMPEST_REPO=${TEMPEST_REPO:-${GIT_BASE}/openstack/tempest.git}
317317
TEMPEST_BRANCH=${TEMPEST_BRANCH:-$BRANCHLESS_TARGET_BRANCH}
318+
TEMPEST_VENV_UPPER_CONSTRAINTS=${TEMPEST_VENV_UPPER_CONSTRAINTS:-master}
318319

319320

320321
##############

0 commit comments

Comments
 (0)