From 2988f738b1b2ef99d16a6760e42a7b12253f7599 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Tue, 5 May 2015 23:56:10 +0200 Subject: [PATCH] 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 --- devstack/gate/gate_hook.sh | 31 +++++++++++++++++++++++++ devstack/gate/post_test_hook.sh | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 devstack/gate/gate_hook.sh create mode 100644 devstack/gate/post_test_hook.sh diff --git a/devstack/gate/gate_hook.sh b/devstack/gate/gate_hook.sh new file mode 100644 index 000000000..3d0efac25 --- /dev/null +++ b/devstack/gate/gate_hook.sh @@ -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 diff --git a/devstack/gate/post_test_hook.sh b/devstack/gate/post_test_hook.sh new file mode 100644 index 000000000..c705ac479 --- /dev/null +++ b/devstack/gate/post_test_hook.sh @@ -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