blob: a0256af193289de10fe74833fd777a50082c379d [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")
33 @testtools.skipIf(not CONF.service_available.nova,
34 "Nova is not available.")
Vadim Rovachev7bcea352013-12-26 15:56:17 +040035 def test_check_nova_notification(self):
36
David Kranz0fb14292015-02-11 15:55:20 -050037 body = self.create_server()
Vadim Rovachev7bcea352013-12-26 15:56:17 +040038
39 query = ('resource', 'eq', body['id'])
40
41 for metric in self.nova_notifications:
42 self.await_samples(metric, query)
43
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040044 @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 Treinishc49fcbe2015-02-05 23:37:34 -050048 @decorators.skip_because(bug='1351627')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040049 def test_check_glance_v1_notifications(self):
David Kranza5299eb2015-01-15 17:24:05 -050050 body = self.create_image(self.image_client)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040051 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 Treinishc49fcbe2015-02-05 23:37:34 -050064 @decorators.skip_because(bug='1351627')
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040065 def test_check_glance_v2_notifications(self):
David Kranza5299eb2015-01-15 17:24:05 -050066 body = self.create_image(self.image_client_v2)
Vadim Rovachev80ee4e12014-02-05 16:59:07 +040067
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)