
With the gate hook changes from Ieeaca1375d68705509f4e05f10cb35c0fa0b9582 and new jobs from I2db939bf99288c0cdec06cdd49fec3bdc72e5253, this commit does several things: * Moves test modules to tests/functional/core/ * Moves VPN test cases to new module & places in tests/functional/adv-svcs * Modifies tox.ini to support 'functional' and 'functional-adv-svcs' test This commit will be used to test the experimental jobs, one that runs the same tests as before, one that runs VPN tests using the VPN DevStack plugin via the gate-hook.sh. Modified post test hook so that test results are properly created (was not seeing results from testr, prior to this). Goal is to place all advanced services into tests/functional/adv-svcs/ and use plugins, as needed in the gate hook. Change-Id: I1e3d19e51a1cbd1bc947bbf9927260cd4d73841a Depends-On: I2db939bf99288c0cdec06cdd49fec3bdc72e5253 Partial-Bug: 1484148
87 lines
2.5 KiB
Bash
Executable File
87 lines
2.5 KiB
Bash
Executable File
#!/bin/bash -xe
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
# This script is executed inside post_test_hook function in devstack gate.
|
|
|
|
SCRIPTS_DIR="/usr/os-testr-env/bin/"
|
|
|
|
function generate_test_logs {
|
|
local path="$1"
|
|
# Compress all $path/*.txt files and move the directories holding those
|
|
# files to /opt/stack/logs. Files with .log suffix have their
|
|
# suffix changed to .txt (so browsers will know to open the compressed
|
|
# files and not download them).
|
|
if [ -d "$path" ]
|
|
then
|
|
sudo find $path -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \;
|
|
sudo mv $path/* /opt/stack/logs/
|
|
fi
|
|
}
|
|
|
|
function generate_testr_results {
|
|
# Give job user rights to access tox logs
|
|
sudo -H -u $owner chmod o+rw .
|
|
sudo -H -u $owner chmod o+rw -R .testrepository
|
|
if [ -f ".testrepository/0" ] ; then
|
|
.tox/$VENV/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
|
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
|
|
gzip -9 ./testrepository.subunit
|
|
gzip -9 ./testr_results.html
|
|
sudo mv ./*.gz /opt/stack/logs/
|
|
fi
|
|
|
|
if [ "$venv" == "functional" ] || [ "$venv" == "functional-adv-svcs" ]
|
|
then
|
|
generate_test_logs "/tmp/${venv}-logs"
|
|
fi
|
|
}
|
|
|
|
export NEUTRONCLIENT_DIR="$BASE/new/python-neutronclient"
|
|
owner=jenkins
|
|
|
|
sudo chown -R $owner:stack $NEUTRONCLIENT_DIR
|
|
|
|
# Get admin credentials
|
|
cd $BASE/new/devstack
|
|
source openrc admin admin
|
|
|
|
# Store these credentials into the config file
|
|
CREDS_FILE=$NEUTRONCLIENT_DIR/functional_creds.conf
|
|
cat <<EOF > $CREDS_FILE
|
|
# Credentials for functional testing
|
|
[auth]
|
|
uri = $OS_AUTH_URL
|
|
|
|
[admin]
|
|
user = $OS_USERNAME
|
|
tenant = $OS_TENANT_NAME
|
|
pass = $OS_PASSWORD
|
|
EOF
|
|
|
|
# Go to the neutronclient dir
|
|
cd $NEUTRONCLIENT_DIR
|
|
|
|
# Run tests
|
|
VENV=${1:-"functional"}
|
|
echo "Running neutronclient functional test suite"
|
|
set +e
|
|
# Preserve env for OS_ credentials
|
|
sudo -E -H -u $owner tox -e $VENV
|
|
EXIT_CODE=$?
|
|
set -e
|
|
|
|
# Collect and parse result
|
|
generate_testr_results
|
|
exit $EXIT_CODE
|