blob: a8a4801d3b66c160477882941d48c125ea8b80f5 [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
gord chung69cdfb22017-01-24 15:57:17 +000046 echo "* Event list:"
47 ceilometer event-list -q 'event_type=string::compute.instance.create.end'
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010048 echo "* Nova instance list:"
Mehdi Abaakouk52844572018-06-14 16:46:45 +020049 openstack server list --all-projects
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010050
51 echo "* Gnocchi instance list:"
52 gnocchi resource list -t instance
Mehdi Abaakouk52844572018-06-14 16:46:45 +020053 for instance_id in $(openstack server list -f value -c ID --all-projects); do
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010054 echo "* Nova instance detail:"
55 openstack server show $instance_id
56 echo "* Gnocchi instance detail:"
57 gnocchi resource show -t instance $instance_id
58 echo "* Gnocchi measures for instance ${instance_id}:"
59 gnocchi measures show -r $instance_id cpu_util
60 done
61
62 gnocchi status
63
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010064 echo "* Unprocessed measures:"
Julien Danjou1be043e2017-10-19 09:52:41 +020065 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 +010066
Mehdi Abaakouk510f3ce2017-05-02 19:23:41 +020067 set -e
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010068 set -x
69}
70
71function generate_reports_and_maybe_exit() {
72 local ret="$1"
73 if [[ $ret != 0 ]]; then
74 # Collect and parse result
75 generate_telemetry_report
76 generate_testr_results
77 exit $ret
78 fi
79}
80
81
Mehdi Abaakoukc5ebe732017-04-19 09:17:58 +020082# Run tests with tempest
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +010083sudo chown -R tempest:stack $BASE/new/tempest
84sudo chown -R tempest:stack $BASE/data/tempest
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +010085cd $BASE/new/tempest
Mehdi Abaakouk16251bb2018-06-13 14:44:13 +020086sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/heat-tempest-plugin /opt/stack/new/telemetry-tempest-plugin
87echo "Checking installed Tempest plugins:"
88sudo -H -u tempest tox -evenv-tempest -- tempest list-plugins
Mehdi Abaakouka8ea3682017-04-27 08:40:21 +020089set +e
Chandan Kumar358c65f2018-02-05 12:17:08 +053090sudo -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 +020091EXIT_CODE=$?
Mehdi Abaakouka8ea3682017-04-27 08:40:21 +020092set -e
Mehdi Abaakoukde7d41e2017-03-22 17:09:51 +010093export_subunit_data "all-plugin"
94generate_reports_and_maybe_exit $EXIT_CODE
Mehdi Abaakouk8ecffaf2016-12-15 11:53:00 +010095
Mehdi Abaakouk80081512015-07-29 19:03:26 +020096exit $EXIT_CODE