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") |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 33 | @test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad') |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 34 | @testtools.skipIf(not CONF.service_available.nova, |
| 35 | "Nova is not available.") |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 36 | def test_check_nova_notification(self): |
| 37 | |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 38 | body = self.create_server() |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 39 | |
| 40 | query = ('resource', 'eq', body['id']) |
| 41 | |
| 42 | for metric in self.nova_notifications: |
| 43 | self.await_samples(metric, query) |
| 44 | |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 45 | @test.attr(type="smoke") |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 46 | @test.idempotent_id('04b10bfe-a5dc-47af-b22f-0460426bf498') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 47 | @test.services("image") |
| 48 | @testtools.skipIf(not CONF.image_feature_enabled.api_v1, |
| 49 | "Glance api v1 is disabled") |
Matthew Treinish | c49fcbe | 2015-02-05 23:37:34 -0500 | [diff] [blame] | 50 | @decorators.skip_because(bug='1351627') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 51 | def test_check_glance_v1_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 52 | body = self.create_image(self.image_client) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 53 | self.image_client.update_image(body['id'], data='data') |
| 54 | |
| 55 | query = 'resource', 'eq', body['id'] |
| 56 | |
| 57 | self.image_client.delete_image(body['id']) |
| 58 | |
| 59 | for metric in self.glance_notifications: |
| 60 | self.await_samples(metric, query) |
| 61 | |
| 62 | @test.attr(type="smoke") |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 63 | @test.idempotent_id('c240457d-d943-439b-8aea-85e26d64fe8e') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 64 | @test.services("image") |
| 65 | @testtools.skipIf(not CONF.image_feature_enabled.api_v2, |
| 66 | "Glance api v2 is disabled") |
Matthew Treinish | c49fcbe | 2015-02-05 23:37:34 -0500 | [diff] [blame] | 67 | @decorators.skip_because(bug='1351627') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 68 | def test_check_glance_v2_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 69 | body = self.create_image(self.image_client_v2) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 70 | |
| 71 | self.image_client_v2.store_image(body['id'], "file") |
| 72 | self.image_client_v2.get_image_file(body['id']) |
| 73 | |
| 74 | query = 'resource', 'eq', body['id'] |
| 75 | |
| 76 | for metric in self.glance_v2_notifications: |
| 77 | self.await_samples(metric, query) |