Add gate hooks to enhance Zaqar's job

Add gate hooks to be able to control the gate workflow easily. This adds
a hook that runs before the test and one that runs after the test.

Change-Id: I1c45a76b2bc0bdec83e5d21aa9657848f069d958
This commit is contained in:
Flavio Percoco 2015-05-05 23:56:10 +02:00
parent 172dd3824a
commit 2988f738b1
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# 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 gate_hook function in devstack gate.
ENABLED_SERVICES="mysql,key,tempest,zaqar-server,"
export DEVSTACK_GATE_ZAQAR=1
export DEVSTACK_GATE_INSTALL_TESTONLY=1
export DEVSTACK_GATE_NO_SERVICES=1
export DEVSTACK_GATE_TEMPEST=1
export DEVSTACK_GATE_EXERCISES=0
export DEVSTACK_GATE_TIMEOUT=90
export KEEP_LOCALRC=1
export DEVSTACK_GATE_ZAQAR_BACKEND=$1
export ENABLED_SERVICES
$BASE/new/devstack-gate/devstack-vm-gate.sh

View File

@ -0,0 +1,41 @@
#!/bin/bash
#
# 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.
source $BASE/new/devstack/openrc admin admin
function generate_test_results {
if [ -f .testrepository/0 ]; then
sudo .tox/py27-gate/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
sudo .tox/py27-gate/bin/python /usr/local/jenkins/slave_scripts/subunit2html.py $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
fi
gzip -9 -c /var/log/zaqar/queues.log > $WORKSPACE/logs/queues.log.txt.gz
}
set -x
export ZAQAR_DIR="$BASE/new/zaqar"
sudo chown -R stack:stack $ZAQAR_DIR
cd $ZAQAR_DIR
# Collect and parse result
generate_test_results
exit $EXIT_CODE