blob: 6862401d69111bedf9cddee46c5218a2aba6d742 [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 Treinishc49fcbe2015-02-05 23:37:34 -050013from 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
25 @classmethod
Rohan Kanaded114a132015-02-07 11:11:16 +053026 def skip_checks(cls):
27 super(TelemetryNotificationAPITestJSON, cls).skip_checks()
Vadim Rovachev7bcea352013-12-26 15:56:17 +040028 if CONF.telemetry.too_slow_to_test:
29 raise cls.skipException("Ceilometer feature for fast work mysql "
30 "is disabled")
Vadim Rovachev7bcea352013-12-26 15:56:17 +040031
32 @test.attr(type="gate")
Chris Hoge7579c1a2015-02-26 14:12:15 -080033 @test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad')
Vadim Rovachev7bcea352013-12-26 15:56:17 +040034 @testtools.skipIf(not CONF.service_available.nova,
35 "Nova is not available.")
Vadim Rovachev7bcea352013-12-26 15:56:17 +040036 def test_check_nova_notification(self):
37
David Kranz0fb14292015-02-11 15:55:20 -050038 body = self.create_server()
Vadim Rovachev7bcea352013-12-26 15:56:17 +040039
40 query = ('resource', 'eq', body['id'])
41
42 for metric in self.nova_notifications:
43 self.await_samples(metric, query)
44
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040045 @test.attr(type="smoke")
Chris Hoge7579c1a2015-02-26 14:12:15 -080046 @test.idempotent_id('04b10bfe-a5dc-47af-b22f-0460426bf498')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040047 @test.services("image")
48 @testtools.skipIf(not CONF.image_feature_enabled.api_v1,
49 "Glance api v1 is disabled")
Matthew Treinishc49fcbe2015-02-05 23:37:34 -050050 @decorators.skip_because(bug='1351627')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040051 def test_check_glance_v1_notifications(self):
David Kranza5299eb2015-01-15 17:24:05 -050052 body = self.create_image(self.image_client)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040053 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 Hoge7579c1a2015-02-26 14:12:15 -080063 @test.idempotent_id('c240457d-d943-439b-8aea-85e26d64fe8e')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040064 @test.services("image")
65 @testtools.skipIf(not CONF.image_feature_enabled.api_v2,
66 "Glance api v2 is disabled")
Matthew Treinishc49fcbe2015-02-05 23:37:34 -050067 @decorators.skip_because(bug='1351627')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040068 def test_check_glance_v2_notifications(self):
David Kranza5299eb2015-01-15 17:24:05 -050069 body = self.create_image(self.image_client_v2)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040070
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)