blob: 624d62e21dd85fd07445ad35c1b453e94a0cec4f [file] [log] [blame]
Mehdi Abaakouk80081512015-07-29 19:03:26 +02001#!/bin/bash -xe
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15# This script is executed inside post_test_hook function in devstack gate.
16
Mehdi Abaakouk31291f82016-11-25 10:56:26 +010017function export_subunit_data {
18 target="$1"
Mehdi Abaakouk80081512015-07-29 19:03:26 +020019 if [ -f .testrepository/0 ]; then
Mehdi Abaakouk31291f82016-11-25 10:56:26 +010020 sudo testr last --subunit > $WORKSPACE/testrepository.subunit.$target
Mehdi Abaakouk80081512015-07-29 19:03:26 +020021 fi
22}
23
Mehdi Abaakouk31291f82016-11-25 10:56:26 +010024function generate_testr_results {
25 cat $WORKSPACE/testrepository.subunit.* | sudo tee $BASE/logs/testrepository.subunit
26 sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
27 sudo gzip -9 $BASE/logs/testrepository.subunit
28 sudo gzip -9 $BASE/logs/testr_results.html
Dai Dang Vanef853d42017-10-18 09:11:43 +070029 sudo chown $USER:$USER $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
Mehdi Abaakouk31291f82016-11-25 10:56:26 +010030 sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
31}
32
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010033function generate_telemetry_report(){
34 set +x
Mehdi Abaakouk510f3ce2017-05-02 19:23:41 +020035 set +e
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010036
37 echo "* Message queue status:"
38 sudo rabbitmqctl list_queues | grep -e \\.sample -e \\.info
39
Mehdi Abaakouka8ea3682017-04-27 08:40:21 +020040 source $BASE/new/devstack/openrc admin admin
41
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010042 echo "* Heat stack:"
43 openstack stack show integration_test
44 echo "* Alarm list:"
45 aodh alarm list
46 echo "* Nova instance list:"
Mehdi Abaakouk52844572018-06-14 16:46:45 +020047 openstack server list --all-projects
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010048
49 echo "* Gnocchi instance list:"
50 gnocchi resource list -t instance
Mehdi Abaakouk52844572018-06-14 16:46:45 +020051 for instance_id in $(openstack server list -f value -c ID --all-projects); do
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010052 echo "* Nova instance detail:"
53 openstack server show $instance_id
54 echo "* Gnocchi instance detail:"
55 gnocchi resource show -t instance $instance_id
56 echo "* Gnocchi measures for instance ${instance_id}:"
57 gnocchi measures show -r $instance_id cpu_util
58 done
59
60 gnocchi status
61
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010062 echo "* Unprocessed measures:"
Julien Danjou1be043e2017-10-19 09:52:41 +020063 for key in $(redis-cli --scan --pattern 'incoming*'); do echo -n "$key length = " && redis-cli llen $key; done
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010064
Mehdi Abaakoukb64d2b02018-09-03 11:50:49 +020065 echo "* locale:"
66 locale
67 echo
68 echo "* tempest locale:"
69 sudo -H -u tempest locale
70 echo
71 echo "* tempest tox locale:"
72 sudo -H -u tempest tox -evenv-tempest -- locale
73 echo
74
Mehdi Abaakouk510f3ce2017-05-02 19:23:41 +020075 set -e
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010076 set -x
77}
78
79function generate_reports_and_maybe_exit() {
80 local ret="$1"
81 if [[ $ret != 0 ]]; then
82 # Collect and parse result
83 generate_telemetry_report
84 generate_testr_results
85 exit $ret
86 fi
87}
88
89
Mehdi Abaakoukc5ebe732017-04-19 09:17:58 +020090# Run tests with tempest
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +010091sudo chown -R tempest:stack $BASE/new/tempest
92sudo chown -R tempest:stack $BASE/data/tempest
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +010093cd $BASE/new/tempest
Mehdi Abaakoukb64d2b02018-09-03 11:50:49 +020094sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/telemetry-tempest-plugin
Mehdi Abaakouk16251bb2018-06-13 14:44:13 +020095echo "Checking installed Tempest plugins:"
96sudo -H -u tempest tox -evenv-tempest -- tempest list-plugins
Mehdi Abaakouka8ea3682017-04-27 08:40:21 +020097set +e
Chandan Kumar358c65f2018-02-05 12:17:08 +053098sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -evenv-tempest -- tempest run -r telemetry_tempest_plugin --concurrency=$TEMPEST_CONCURRENCY
Mehdi Abaakouk80081512015-07-29 19:03:26 +020099EXIT_CODE=$?
Mehdi Abaakouka8ea3682017-04-27 08:40:21 +0200100set -e
Mehdi Abaakoukb64d2b02018-09-03 11:50:49 +0200101export_subunit_data "venv-tempest"
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +0100102generate_reports_and_maybe_exit $EXIT_CODE
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +0100103
Mehdi Abaakouk80081512015-07-29 19:03:26 +0200104exit $EXIT_CODE