From 27ba41b40b57faaacd2ef7470d4db5710776e632 Mon Sep 17 00:00:00 2001 From: Joe Keen Date: Tue, 10 Feb 2015 13:51:33 -0700 Subject: [PATCH] Added retry topic and webhook config for smoke test Change-Id: I75892cd8792eee1646df4752ccbefcbe435e795f --- mini-mon.yml | 1 + tests/cli_wrapper.py | 6 ++++-- tests/smoke.py | 6 ++++-- tests/smoke_configs.py | 43 +++++++++++++++++++++++++++++++++++------- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/mini-mon.yml b/mini-mon.yml index d03b28c..c556950 100644 --- a/mini-mon.yml +++ b/mini-mon.yml @@ -49,6 +49,7 @@ transformed-events: { replicas: 1, partitions: 4 } alarm-state-transitions: { replicas: 1, partitions: 4 } alarm-notifications: { replicas: 1, partitions: 4 } + retry-notifications: { replicas: 1, partitions: 4 } kafka_hosts: "{{mini_mon_host}}:9092" keystone_url: http://192.168.10.5:35357/v3 monasca_agent: diff --git a/tests/cli_wrapper.py b/tests/cli_wrapper.py index 1fe28bf..b49a4dc 100644 --- a/tests/cli_wrapper.py +++ b/tests/cli_wrapper.py @@ -50,10 +50,12 @@ def run_mon_cli(args, useJson=True): sys.exit(1) -def create_notification(notification_name, notification_email_addr): +def create_notification(notification_name, + notification_addr, + notification_type): print('Creating notification') result_json = run_mon_cli(['notification-create', notification_name, - 'EMAIL', notification_email_addr]) + notification_type, notification_addr]) # Parse out id notification_id = result_json['id'] diff --git a/tests/smoke.py b/tests/smoke.py index 9edafe6..4094365 100755 --- a/tests/smoke.py +++ b/tests/smoke.py @@ -156,7 +156,8 @@ def wait_for_alarm_creation(alarm_def_id): def smoke_test(): notification_name = config['notification']['name'] - notification_email_addr = config['notification']['email_addr'] + notification_addr = config['notification']['addr'] + notification_type = config['notification']['type'] alarm_definition_name = config['alarm']['name'] metric_name = config['metric']['name'] metric_dimensions = config['metric']['dimensions'] @@ -188,7 +189,8 @@ def smoke_test(): # Create Notification through CLI notif_id = cli_wrapper.create_notification(notification_name, - notification_email_addr) + notification_addr, + notification_type) # Create Alarm through CLI expression = config['alarm']['expression'] diff --git a/tests/smoke_configs.py b/tests/smoke_configs.py index 3c2147c..c561000 100644 --- a/tests/smoke_configs.py +++ b/tests/smoke_configs.py @@ -5,10 +5,10 @@ import subprocess system_vars = { 'default': { # the default configuration, assumes monasca-vagrant setup 'expected_processes': ('monasca-persister', 'monasca-notification', - 'kafka', 'zookeeper.jar', 'monasca-api', - 'influxdb', 'apache-storm', 'mysqld'), + 'kafka', 'zookeeper.jar', 'monasca-api', + 'influxdb', 'apache-storm', 'mysqld'), 'mail_host': 'localhost', - 'metric_host': subprocess.check_output(['hostname', '-f']).strip()} + 'metric_host': subprocess.check_output(['hostname', '-f']).strip()}, } @@ -19,7 +19,8 @@ test_config = { 'notification': { 'name': 'Monasca Smoke Test', - 'email_addr': 'root@'+system_vars['default']['mail_host']}, + 'addr': 'root@'+system_vars['default']['mail_host'], + 'type': 'EMAIL'}, 'alarm': { 'name': 'high cpu and load', @@ -33,11 +34,39 @@ test_config = { 'metric': { 'name': 'load.avg_1_min', 'dimensions': {'hostname': - system_vars['default']['metric_host']}}, + system_vars['default']['metric_host']}}, 'statsd_metric': { 'name': 'monasca.sent_smtp_count', 'dimensions': {'hostname': - system_vars['default']['metric_host']}} + system_vars['default']['metric_host']}} + }, + + 'webhook': { + 'system_vars': system_vars['default'], + + 'notification': { + 'name': 'Smoke Test Webhook', + 'addr': 'http://127.0.0.1:8080', + 'type': 'WEBHOOK'}, + + 'alarm': { + 'name': 'high cpu and load', + 'expression': 'max(cpu.system_perc) > 0 and ' + + 'max(load.avg_1_min{hostname=' + + system_vars['default']['metric_host'] + + '}) > 0', + 'description': 'System CPU Utilization exceeds 1% and ' + + 'Load exceeds 3 per measurement period'}, + 'metric': { + 'name': 'load.avg_1_min', + 'dimensions': {'hostname': + system_vars['default']['metric_host']}}, + + 'statsd_metric': { + 'name': 'monasca.sent_smtp_count', + 'dimensions': {'hostname': + system_vars['default']['metric_host']}} + } -} \ No newline at end of file +}