add initial check for nova event in ceilometer
this patch adds the ability to query ceilometer events and includes a check that nova events are recorded. Change-Id: I5ae2aa700ddd0c89255e07fe2f188d7742eb6406
This commit is contained in:
parent
9ae9616d91
commit
ee23ddbae6
@ -1092,6 +1092,16 @@
|
||||
#too_slow_to_test = true
|
||||
|
||||
|
||||
[telemetry-feature-enabled]
|
||||
|
||||
#
|
||||
# From tempest.config
|
||||
#
|
||||
|
||||
# Runs Ceilometer event-related tests (boolean value)
|
||||
#events = false
|
||||
|
||||
|
||||
[validation]
|
||||
|
||||
#
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -826,6 +826,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")
|
||||
|
||||
@ -1157,6 +1167,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),
|
||||
@ -1219,6 +1230,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[
|
||||
|
@ -84,6 +84,10 @@ class TelemetryClientJSON(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)
|
||||
|
Loading…
Reference in New Issue
Block a user