Merge "add initial check for nova event in ceilometer"

This commit is contained in:
Jenkins 2015-07-31 20:12:08 +00:00 committed by Gerrit Code Review
commit 9458e89ec6
5 changed files with 74 additions and 0 deletions

View File

@ -1098,6 +1098,16 @@
#too_slow_to_test = true
[telemetry-feature-enabled]
#
# From tempest.config
#
# Runs Ceilometer event-related tests (boolean value)
#events = false
[validation]
#

View File

@ -121,3 +121,27 @@ class BaseTelemetryTest(tempest.test.BaseTestCase):
'Sample for metric:%s with query:%s has not been added to the '
'database within %d seconds' % (metric, query,
CONF.compute.build_timeout))
class BaseTelemetryAdminTest(BaseTelemetryTest):
"""Base test case class for admin Telemetry API tests."""
credentials = ['primary', 'admin']
@classmethod
def setup_clients(cls):
super(BaseTelemetryAdminTest, cls).setup_clients()
cls.telemetry_admin_client = cls.os_adm.telemetry_client
def await_events(self, query):
timeout = CONF.compute.build_timeout
start = timeutils.utcnow()
while timeutils.delta_seconds(start, timeutils.utcnow()) < timeout:
body = self.telemetry_admin_client.list_events(query)
if body:
return body
time.sleep(CONF.compute.build_interval)
raise exceptions.TimeoutException(
'Event with query:%s has not been added to the '
'database within %d seconds' % (query, CONF.compute.build_timeout))

View File

@ -71,3 +71,27 @@ class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
for metric in self.glance_v2_notifications:
self.await_samples(metric, query)
class TelemetryNotificationAdminAPITestJSON(base.BaseTelemetryAdminTest):
@classmethod
def skip_checks(cls):
super(TelemetryNotificationAdminAPITestJSON, cls).skip_checks()
if CONF.telemetry.too_slow_to_test:
raise cls.skipException("Ceilometer feature for fast work mysql "
"is disabled")
@test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebe9')
@test.services('compute')
def test_check_nova_notification_event_and_meter(self):
body = self.create_server()
if CONF.telemetry_feature_enabled.events:
query = ('instance_id', 'eq', body['id'])
self.await_events(query)
query = ('resource', 'eq', body['id'])
for metric in self.nova_notifications:
self.await_samples(metric, query)

View File

@ -839,6 +839,16 @@ TelemetryGroup = [
]
telemetry_feature_group = cfg.OptGroup(name='telemetry-feature-enabled',
title='Enabled Ceilometer Features')
TelemetryFeaturesGroup = [
cfg.BoolOpt('events',
default=False,
help="Runs Ceilometer event-related tests"),
]
dashboard_group = cfg.OptGroup(name="dashboard",
title="Dashboard options")
@ -1179,6 +1189,7 @@ _opts = [
(database_group, DatabaseGroup),
(orchestration_group, OrchestrationGroup),
(telemetry_group, TelemetryGroup),
(telemetry_feature_group, TelemetryFeaturesGroup),
(dashboard_group, DashboardGroup),
(data_processing_group, DataProcessingGroup),
(data_processing_feature_group, DataProcessingFeaturesGroup),
@ -1246,6 +1257,7 @@ class TempestConfigPrivate(object):
self.orchestration = _CONF.orchestration
self.messaging = _CONF.messaging
self.telemetry = _CONF.telemetry
self.telemetry_feature_enabled = _CONF['telemetry-feature-enabled']
self.dashboard = _CONF.dashboard
self.data_processing = _CONF.data_processing
self.data_processing_feature_enabled = _CONF[

View File

@ -84,6 +84,10 @@ class TelemetryClient(service_client.ServiceClient):
uri = '%s/meters/%s' % (self.uri_prefix, meter_id)
return self._helper_list(uri, query)
def list_events(self, query=None):
uri = '%s/events' % self.uri_prefix
return self._helper_list(uri, query)
def show_resource(self, resource_id):
uri = '%s/resources/%s' % (self.uri_prefix, resource_id)
resp, body = self.get(uri)