Mehdi Abaakouk | 8008151 | 2015-07-29 19:03:26 +0200 | [diff] [blame] | 1 | #!/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 Abaakouk | 31291f8 | 2016-11-25 10:56:26 +0100 | [diff] [blame] | 17 | function export_subunit_data { |
| 18 | target="$1" |
Mehdi Abaakouk | 8008151 | 2015-07-29 19:03:26 +0200 | [diff] [blame] | 19 | if [ -f .testrepository/0 ]; then |
Mehdi Abaakouk | 31291f8 | 2016-11-25 10:56:26 +0100 | [diff] [blame] | 20 | sudo testr last --subunit > $WORKSPACE/testrepository.subunit.$target |
Mehdi Abaakouk | 8008151 | 2015-07-29 19:03:26 +0200 | [diff] [blame] | 21 | fi |
| 22 | } |
| 23 | |
Mehdi Abaakouk | 31291f8 | 2016-11-25 10:56:26 +0100 | [diff] [blame] | 24 | function 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 Van | ef853d4 | 2017-10-18 09:11:43 +0700 | [diff] [blame] | 29 | sudo chown $USER:$USER $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz |
Mehdi Abaakouk | 31291f8 | 2016-11-25 10:56:26 +0100 | [diff] [blame] | 30 | sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz |
| 31 | } |
| 32 | |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 33 | function generate_telemetry_report(){ |
| 34 | set +x |
Mehdi Abaakouk | 510f3ce | 2017-05-02 19:23:41 +0200 | [diff] [blame] | 35 | set +e |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 36 | |
| 37 | echo "* Message queue status:" |
| 38 | sudo rabbitmqctl list_queues | grep -e \\.sample -e \\.info |
| 39 | |
Mehdi Abaakouk | a8ea368 | 2017-04-27 08:40:21 +0200 | [diff] [blame] | 40 | source $BASE/new/devstack/openrc admin admin |
| 41 | |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 42 | echo "* Heat stack:" |
| 43 | openstack stack show integration_test |
| 44 | echo "* Alarm list:" |
| 45 | aodh alarm list |
gord chung | 69cdfb2 | 2017-01-24 15:57:17 +0000 | [diff] [blame] | 46 | echo "* Event list:" |
| 47 | ceilometer event-list -q 'event_type=string::compute.instance.create.end' |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 48 | echo "* Nova instance list:" |
Mehdi Abaakouk | 5284457 | 2018-06-14 16:46:45 +0200 | [diff] [blame] | 49 | openstack server list --all-projects |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 50 | |
| 51 | echo "* Gnocchi instance list:" |
| 52 | gnocchi resource list -t instance |
Mehdi Abaakouk | 5284457 | 2018-06-14 16:46:45 +0200 | [diff] [blame] | 53 | for instance_id in $(openstack server list -f value -c ID --all-projects); do |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 54 | 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 Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 64 | echo "* Unprocessed measures:" |
Julien Danjou | 1be043e | 2017-10-19 09:52:41 +0200 | [diff] [blame] | 65 | for key in $(redis-cli --scan --pattern 'incoming*'); do echo -n "$key length = " && redis-cli llen $key; done |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 66 | |
Mehdi Abaakouk | 510f3ce | 2017-05-02 19:23:41 +0200 | [diff] [blame] | 67 | set -e |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 68 | set -x |
| 69 | } |
| 70 | |
| 71 | function 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 Abaakouk | c5ebe73 | 2017-04-19 09:17:58 +0200 | [diff] [blame] | 82 | # Run tests with tempest |
Mehdi Abaakouk | de7d41e | 2017-03-22 17:09:51 +0100 | [diff] [blame] | 83 | sudo chown -R tempest:stack $BASE/new/tempest |
| 84 | sudo chown -R tempest:stack $BASE/data/tempest |
Mehdi Abaakouk | de7d41e | 2017-03-22 17:09:51 +0100 | [diff] [blame] | 85 | cd $BASE/new/tempest |
Mehdi Abaakouk | 16251bb | 2018-06-13 14:44:13 +0200 | [diff] [blame] | 86 | sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/heat-tempest-plugin /opt/stack/new/telemetry-tempest-plugin |
| 87 | echo "Checking installed Tempest plugins:" |
| 88 | sudo -H -u tempest tox -evenv-tempest -- tempest list-plugins |
Mehdi Abaakouk | a8ea368 | 2017-04-27 08:40:21 +0200 | [diff] [blame] | 89 | set +e |
Chandan Kumar | 358c65f | 2018-02-05 12:17:08 +0530 | [diff] [blame] | 90 | sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -evenv-tempest -- tempest run -r telemetry_tempest_plugin --concurrency=$TEMPEST_CONCURRENCY |
Mehdi Abaakouk | 8008151 | 2015-07-29 19:03:26 +0200 | [diff] [blame] | 91 | EXIT_CODE=$? |
Mehdi Abaakouk | a8ea368 | 2017-04-27 08:40:21 +0200 | [diff] [blame] | 92 | set -e |
Mehdi Abaakouk | de7d41e | 2017-03-22 17:09:51 +0100 | [diff] [blame] | 93 | export_subunit_data "all-plugin" |
| 94 | generate_reports_and_maybe_exit $EXIT_CODE |
Mehdi Abaakouk | 8ecffaf | 2016-12-15 11:53:00 +0100 | [diff] [blame] | 95 | |
Mehdi Abaakouk | 8008151 | 2015-07-29 19:03:26 +0200 | [diff] [blame] | 96 | exit $EXIT_CODE |