Merge "Add config option to enable/disable alarm creation during testing"
diff --git a/telemetry_tempest_plugin/aodh/api/test_alarming_api.py b/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
index 4280628..1c42e63 100644
--- a/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
+++ b/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
@@ -9,27 +9,31 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from telemetry_tempest_plugin.aodh.api import base
+CONF = config.CONF
+
class TelemetryAlarmingAPITest(base.BaseAlarmingTest):
@classmethod
def resource_setup(cls):
super(TelemetryAlarmingAPITest, cls).resource_setup()
- cls.rule = {'metrics': ['c0d457b6-957e-41de-a384-d5eb0957de3b'],
- 'comparison_operator': 'gt',
- 'aggregation_method': 'mean',
- 'threshold': 80.0,
- 'granularity': 70}
- for i in range(2):
- cls.create_alarm(
- gnocchi_aggregation_by_metrics_threshold_rule=cls.rule)
+
+ if CONF.alarming_plugin.create_alarms:
+ cls.rule = {'metrics': ['c0d457b6-957e-41de-a384-d5eb0957de3b'],
+ 'comparison_operator': 'gt',
+ 'aggregation_method': 'mean',
+ 'threshold': 80.0,
+ 'granularity': 70}
+ for i in range(2):
+ cls.create_alarm(
+ gnocchi_aggregation_by_metrics_threshold_rule=cls.rule)
@decorators.idempotent_id('1c918e06-210b-41eb-bd45-14676dd77cd7')
def test_alarm_list(self):
diff --git a/telemetry_tempest_plugin/config.py b/telemetry_tempest_plugin/config.py
index ca16931..e076faf 100644
--- a/telemetry_tempest_plugin/config.py
+++ b/telemetry_tempest_plugin/config.py
@@ -92,6 +92,9 @@
choices=['public', 'admin', 'internal',
'publicURL', 'adminURL', 'internalURL'],
help="The endpoint type to use for the alarming service."),
+ cfg.BoolOpt('create_alarms',
+ default=True,
+ help="If create alarms dynamically before testing."),
]
metric_opts = [