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 | 990f484 | 2015-07-31 19:09:34 -0400 | [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 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 25 | @test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad') |
gordon chung | 852446e | 2015-06-29 16:35:02 -0400 | [diff] [blame] | 26 | @test.services('compute') |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 27 | def test_check_nova_notification(self): |
| 28 | |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 29 | body = self.create_server() |
Vadim Rovachev | 7bcea35 | 2013-12-26 15:56:17 +0400 | [diff] [blame] | 30 | |
| 31 | query = ('resource', 'eq', body['id']) |
| 32 | |
| 33 | for metric in self.nova_notifications: |
| 34 | self.await_samples(metric, query) |
| 35 | |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 36 | @test.attr(type="smoke") |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 37 | @test.idempotent_id('04b10bfe-a5dc-47af-b22f-0460426bf498') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 38 | @test.services("image") |
| 39 | @testtools.skipIf(not CONF.image_feature_enabled.api_v1, |
| 40 | "Glance api v1 is disabled") |
| 41 | def test_check_glance_v1_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 42 | body = self.create_image(self.image_client) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 43 | self.image_client.update_image(body['id'], data='data') |
| 44 | |
| 45 | query = 'resource', 'eq', body['id'] |
| 46 | |
| 47 | self.image_client.delete_image(body['id']) |
| 48 | |
| 49 | for metric in self.glance_notifications: |
| 50 | self.await_samples(metric, query) |
| 51 | |
| 52 | @test.attr(type="smoke") |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 53 | @test.idempotent_id('c240457d-d943-439b-8aea-85e26d64fe8e') |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 54 | @test.services("image") |
| 55 | @testtools.skipIf(not CONF.image_feature_enabled.api_v2, |
| 56 | "Glance api v2 is disabled") |
| 57 | def test_check_glance_v2_notifications(self): |
David Kranz | a5299eb | 2015-01-15 17:24:05 -0500 | [diff] [blame] | 58 | body = self.create_image(self.image_client_v2) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 59 | |
Ken'ichi Ohmichi | 66494e9 | 2015-06-08 04:28:10 +0000 | [diff] [blame] | 60 | self.image_client_v2.store_image_file(body['id'], "file") |
Ken'ichi Ohmichi | 6bd6f20 | 2015-11-20 05:29:38 +0000 | [diff] [blame] | 61 | self.image_client_v2.show_image_file(body['id']) |
Vadim Rovachev | 80ee4e1 | 2014-02-05 16:59:07 +0400 | [diff] [blame] | 62 | |
| 63 | query = 'resource', 'eq', body['id'] |
| 64 | |
| 65 | for metric in self.glance_v2_notifications: |
| 66 | self.await_samples(metric, query) |
gordon chung | ee23ddb | 2015-02-11 20:05:07 -0500 | [diff] [blame] | 67 | |
| 68 | |
| 69 | class TelemetryNotificationAdminAPITestJSON(base.BaseTelemetryAdminTest): |
| 70 | |
gordon chung | ee23ddb | 2015-02-11 20:05:07 -0500 | [diff] [blame] | 71 | @test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebe9') |
| 72 | @test.services('compute') |
Matthew Treinish | 990f484 | 2015-07-31 19:09:34 -0400 | [diff] [blame] | 73 | @decorators.skip_because(bug='1480490') |
gordon chung | ee23ddb | 2015-02-11 20:05:07 -0500 | [diff] [blame] | 74 | def test_check_nova_notification_event_and_meter(self): |
| 75 | |
| 76 | body = self.create_server() |
| 77 | |
| 78 | if CONF.telemetry_feature_enabled.events: |
| 79 | query = ('instance_id', 'eq', body['id']) |
| 80 | self.await_events(query) |
| 81 | |
| 82 | query = ('resource', 'eq', body['id']) |
| 83 | for metric in self.nova_notifications: |
| 84 | self.await_samples(metric, query) |