Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
Matthew Treinish | c49fcbe | 2015-02-05 23:37:34 -0500 | [diff] [blame] | 13 | from tempest_lib import decorators |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 14 | import testtools |
| 15 | |
| 16 | from tempest.api.telemetry import base |
| 17 | from tempest import config |
| 18 | from tempest import test |
| 19 | |
| 20 | CONF = config.CONF |
| 21 | |
| 22 | |
| 23 | class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest): |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 24 | |
| 25 | @classmethod |
Rohan Kanade | d114a13 | 2015-02-07 11:11:16 +0530 | [diff] [blame] | 26 | def skip_checks(cls): |
| 27 | super(TelemetryNotificationAPITestJSON, cls).skip_checks() |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 28 | if CONF.telemetry.too_slow_to_test: |
| 29 | raise cls.skipException("Ceilometer feature for fast work mysql " |
| 30 | "is disabled") |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 31 | |
| 32 | @test.attr(type="gate") |
| 33 | @testtools.skipIf(not CONF.service_available.nova, |
| 34 | "Nova is not available.") |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 35 | def test_check_nova_notification(self): |
| 36 | |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 37 | body = self.create_server() |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 38 | |
| 39 | query = ('resource', 'eq', body['id']) |
| 40 | |
| 41 | for metric in self.nova_notifications: |
| 42 | self.await_samples(metric, query) |
| 43 | |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 44 | @test.attr(type="smoke") |
| 45 | @test.services("image") |
| 46 | @testtools.skipIf(not CONF.image_feature_enabled.api_v1, |
| 47 | "Glance api v1 is disabled") |
Matthew Treinish | c49fcbe | 2015-02-05 23:37:34 -0500 | [diff] [blame] | 48 | @decorators.skip_because(bug='1351627') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 49 | def test_check_glance_v1_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 50 | body = self.create_image(self.image_client) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 51 | self.image_client.update_image(body['id'], data='data') |
| 52 | |
| 53 | query = 'resource', 'eq', body['id'] |
| 54 | |
| 55 | self.image_client.delete_image(body['id']) |
| 56 | |
| 57 | for metric in self.glance_notifications: |
| 58 | self.await_samples(metric, query) |
| 59 | |
| 60 | @test.attr(type="smoke") |
| 61 | @test.services("image") |
| 62 | @testtools.skipIf(not CONF.image_feature_enabled.api_v2, |
| 63 | "Glance api v2 is disabled") |
Matthew Treinish | c49fcbe | 2015-02-05 23:37:34 -0500 | [diff] [blame] | 64 | @decorators.skip_because(bug='1351627') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 65 | def test_check_glance_v2_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 66 | body = self.create_image(self.image_client_v2) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 67 | |
| 68 | self.image_client_v2.store_image(body['id'], "file") |
| 69 | self.image_client_v2.get_image_file(body['id']) |
| 70 | |
| 71 | query = 'resource', 'eq', body['id'] |
| 72 | |
| 73 | for metric in self.glance_v2_notifications: |
| 74 | self.await_samples(metric, query) |