blob: 7511505b617773d7d26834bc6434443fb00b49ff [file] [log] [blame]
Vadim Rovachev7bcea352013-12-26 15:56:17 +04001# 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 Treinish990f4842015-07-31 19:09:34 -040013from tempest_lib import decorators
Vadim Rovachev7bcea352013-12-26 15:56:17 +040014import testtools
15
16from tempest.api.telemetry import base
17from tempest import config
18from tempest import test
19
20CONF = config.CONF
21
22
23class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
Vadim Rovachev7bcea352013-12-26 15:56:17 +040024
Chris Hoge7579c1a2015-02-26 14:12:15 -080025 @test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad')
gordon chung852446e2015-06-29 16:35:02 -040026 @test.services('compute')
Vadim Rovachev7bcea352013-12-26 15:56:17 +040027 def test_check_nova_notification(self):
28
David Kranz0fb14292015-02-11 15:55:20 -050029 body = self.create_server()
Vadim Rovachev7bcea352013-12-26 15:56:17 +040030
31 query = ('resource', 'eq', body['id'])
32
33 for metric in self.nova_notifications:
34 self.await_samples(metric, query)
35
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040036 @test.attr(type="smoke")
Chris Hoge7579c1a2015-02-26 14:12:15 -080037 @test.idempotent_id('04b10bfe-a5dc-47af-b22f-0460426bf498')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040038 @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 Kranza5299eb2015-01-15 17:24:05 -050042 body = self.create_image(self.image_client)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040043 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 Hoge7579c1a2015-02-26 14:12:15 -080053 @test.idempotent_id('c240457d-d943-439b-8aea-85e26d64fe8e')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040054 @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 Kranza5299eb2015-01-15 17:24:05 -050058 body = self.create_image(self.image_client_v2)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040059
Ken'ichi Ohmichi66494e92015-06-08 04:28:10 +000060 self.image_client_v2.store_image_file(body['id'], "file")
Ken'ichi Ohmichi6bd6f202015-11-20 05:29:38 +000061 self.image_client_v2.show_image_file(body['id'])
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040062
63 query = 'resource', 'eq', body['id']
64
65 for metric in self.glance_v2_notifications:
66 self.await_samples(metric, query)
gordon chungee23ddb2015-02-11 20:05:07 -050067
68
69class TelemetryNotificationAdminAPITestJSON(base.BaseTelemetryAdminTest):
70
gordon chungee23ddb2015-02-11 20:05:07 -050071 @test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebe9')
72 @test.services('compute')
Matthew Treinish990f4842015-07-31 19:09:34 -040073 @decorators.skip_because(bug='1480490')
gordon chungee23ddb2015-02-11 20:05:07 -050074 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)