From 0beea18cea300f9c20f3c2c952ee40303886c32e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 31 Jan 2024 19:42:42 +0900 Subject: [PATCH] Refactor options to enabled backends Aodh can use only one database so having multiple options per backend software is very redundant. Also, gnocchi and prometheus are used for the same purpose so can use a single option instead. Change-Id: I134cf61d8137409ef5f5d959177e349781110eaa --- .zuul.yaml | 3 +-- .../aodh/api/gnocchi/test_alarming_api.py | 2 +- .../api/gnocchi/test_alarming_api_negative.py | 2 +- .../aodh/api/sql/test_alarming_api.py | 2 +- telemetry_tempest_plugin/config.py | 21 ++++++++----------- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index de2a73b..cf4c861 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -54,8 +54,7 @@ service_available: sg-core: True telemetry_services: - aodh_gnocchi: True - aodh_prometheus: True + metric_backends: gnocchi,prometheus telemetry: disable_ssl_certificate_validation: True tempest_test_regex: telemetry_tempest_plugin diff --git a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py index b6ccba5..82cb2ea 100644 --- a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py +++ b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py @@ -29,7 +29,7 @@ class TelemetryAlarmingAPIGnocchiTest(base.BaseAlarmingTest): """ super(TelemetryAlarmingAPIGnocchiTest, cls).skip_checks() - if not CONF.telemetry_services.aodh_gnocchi: + if 'gnocchi' not in CONF.telemetry_services.metric_backends: msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" % cls.__name__) raise cls.skipException(msg) diff --git a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api_negative.py b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api_negative.py index b658807..240dd3a 100644 --- a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api_negative.py +++ b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api_negative.py @@ -39,7 +39,7 @@ class TelemetryAlarmingNegativeGnocchiTest(base.BaseAlarmingTest): """ super(TelemetryAlarmingNegativeGnocchiTest, cls).skip_checks() - if not CONF.telemetry_services.aodh_gnocchi: + if 'gnocchi' not in CONF.telemetry_services.metric_backends: msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" % cls.__name__) raise cls.skipException(msg) diff --git a/telemetry_tempest_plugin/aodh/api/sql/test_alarming_api.py b/telemetry_tempest_plugin/aodh/api/sql/test_alarming_api.py index fce5eb5..73ab03d 100644 --- a/telemetry_tempest_plugin/aodh/api/sql/test_alarming_api.py +++ b/telemetry_tempest_plugin/aodh/api/sql/test_alarming_api.py @@ -31,7 +31,7 @@ class TelemetryAlarmingAPIMysqlTest(base.BaseAlarmingTest): """ super(TelemetryAlarmingAPIMysqlTest, cls).skip_checks() - if not CONF.telemetry_services.aodh_mysql: + if CONF.telemetry_services.alarm_backend != 'mysql': msg = ("%s: Skipping mysql specific tests withouth mysql" % cls.__name__) raise cls.skipException(msg) diff --git a/telemetry_tempest_plugin/config.py b/telemetry_tempest_plugin/config.py index 94b6e1b..ad4ea85 100644 --- a/telemetry_tempest_plugin/config.py +++ b/telemetry_tempest_plugin/config.py @@ -14,6 +14,7 @@ # under the License. from oslo_config import cfg +from oslo_config import types service_option = [cfg.BoolOpt('ceilometer', @@ -86,18 +87,14 @@ TelemetryGroup = [ ] telemetry_services_opts = [ - cfg.BoolOpt('aodh_gnocchi', - default=False, - help="Can telemetry plugin expect gnocchi backend"), - cfg.BoolOpt('aodh_mysql', - default=False, - help="Can telemetry plugin expect mysql backend"), - cfg.BoolOpt('aodh_postgre', - default=False, - help="Can telemetry plugin expect postgre backend"), - cfg.BoolOpt('aodh_prometheus', - default=False, - help="Can telemetry plugin expect prometheus backend"), + cfg.ListOpt('metric_backends', + default=[], + item_type=types.String(choices=['gnocchi', 'prometheus']), + help="Backend store used to store metrics"), + cfg.StrOpt('alarm_backend', + default='mysql', + choices=['mysql', 'postgresq'], + help="Database used by the aodh service"), ] event_opts = [