Do not depend on jenkins user in devstack gate

As announced on openstack-dev [1] openstack-infra images no longer have
the jenkins user. The functional (devstack gate based) test suite of the
osc-placement repo depended on the jenkins user in its post_test_hook.
Because of that dependecy all functional test suite runs of
osc-placement started to fail after [2] was merged.

We fix the functional test suite of osc-placement by no longer
hardcoding the jenkins user.

Ideally we would not need root in post_test_hook. However it seems
devstack installs globally (as root) the master branch of osc-placement
(in develop mode) resulting the following directory being owned by root:

/opt/stack/new/osc-placement/osc_placement.egg-info/

When 'tox -e functional' tries to install the commit under test of
osc-placement in the tox functional venv (also in develop mode from the
same repo directory) but as a non-privileged user that conflicts with
the previous global installation.

It'd be nice to remove the need for root altogether, but at the moment
I don't know how to do that.

[1] http://lists.openstack.org/pipermail/openstack-dev/
           2018-February/127800.html
[2] https://review.openstack.org/514485/

Change-Id: I966fb6d16b0086fc5fe345fdb695dbbed2eb4299
This commit is contained in:
Bence Romsics 2018-03-13 11:48:27 +01:00
parent f654329297
commit 253fd92b29
1 changed files with 8 additions and 9 deletions

View File

@ -16,19 +16,18 @@
function generate_testr_results {
if [ -f .testrepository/0 ]; then
sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
sudo gzip -9 $BASE/logs/testrepository.subunit
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
.tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
/usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
gzip -9 $BASE/logs/testrepository.subunit
gzip -9 $BASE/logs/testr_results.html
chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
fi
}
export OSCPLACEMENT_DIR="$BASE/new/osc-placement"
sudo chown -R jenkins:stack $OSCPLACEMENT_DIR
sudo chown -R $USER:stack $OSCPLACEMENT_DIR
# Go to the osc-placement dir
cd $OSCPLACEMENT_DIR
@ -38,7 +37,7 @@ echo "Running osc-placement functional test suite"
set +e
# Preserve env for OS_ credentials
source $BASE/new/devstack/openrc admin admin
sudo -E -H -u jenkins tox -e ${TOX_ENV:-functional}
tox -e ${TOX_ENV:-functional}
EXIT_CODE=$?
set -e