Fix webhook tempests
Change-Id: I2f5e462d5c05e39cb89da9dd36abf52ff296d4ac Implements: blueprint configurable-notifications
This commit is contained in:
parent
9fce59c4d1
commit
0c3151540c
@ -17,8 +17,7 @@ DEVSTACK_PATH="$BASE/new"
|
||||
|
||||
#Argument is received from Zuul
|
||||
if [ "$1" = "api" ]; then
|
||||
TESTS="topology|test_rca|test_alarms|test_resources|test_template
|
||||
|test_webhook"
|
||||
TESTS="topology|test_rca|test_alarms|test_resources|test_template|webhook"
|
||||
elif [ "$1" = "datasources" ]; then
|
||||
TESTS="datasources|test_events|notifiers|e2e|database"
|
||||
else
|
||||
|
@ -54,18 +54,27 @@ class Webhook(NotifierBase):
|
||||
if event_type == NotifierEventTypes.ACTIVATE_ALARM_EVENT \
|
||||
or event_type == NotifierEventTypes.DEACTIVATE_ALARM_EVENT:
|
||||
|
||||
LOG.info('Webhook API starting to process %s', str(data))
|
||||
LOG.info('Webhook notifier started processing %s', str(data))
|
||||
|
||||
webhooks = self._load_webhooks()
|
||||
|
||||
LOG.debug('There are %d registered webhooks', len(webhooks))
|
||||
|
||||
if webhooks:
|
||||
for webhook in webhooks:
|
||||
webhook_filters = self._get_webhook_filters(webhook)
|
||||
data = self._filter_fields(data)
|
||||
|
||||
LOG.debug('webhook_filter: %s, filtered data: %s',
|
||||
str(webhook_filters), str(data))
|
||||
|
||||
if self._check_against_filter(webhook_filters, data)\
|
||||
and self._check_correct_tenant(webhook, data):
|
||||
LOG.info('Going to post data to webhook %s',
|
||||
str(webhook))
|
||||
self._post_data(webhook, event_type, data)
|
||||
|
||||
LOG.info('Webhook API finished processing %s', str(data))
|
||||
LOG.info('Webhook notifier finished processing %s', str(data))
|
||||
|
||||
def _post_data(self, webhook, event_type, data):
|
||||
try:
|
||||
|
@ -85,6 +85,7 @@ class TestWebhook(TestActionsBase):
|
||||
self._trigger_undo_action(TRIGGER_ALARM_1)
|
||||
self.mock_server.reset_requests_list()
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_webhook_with_no_filter(self):
|
||||
"""Test to see that a webhook with no filter receives all
|
||||
|
||||
@ -119,6 +120,7 @@ class TestWebhook(TestActionsBase):
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
self.mock_server.reset_requests_list()
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_webhook_with_no_match(self):
|
||||
"""Test to check that filters with no match do not send event """
|
||||
|
||||
@ -150,6 +152,7 @@ class TestWebhook(TestActionsBase):
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
self.mock_server.reset_requests_list()
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_multiple_webhooks(self):
|
||||
"""Test to check filter by type and by ID (with 2 different
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user