diff --git a/tests/alerts/alert_test_suite.py b/tests/alerts/alert_test_suite.py index de990de2..27438d7c 100644 --- a/tests/alerts/alert_test_suite.py +++ b/tests/alerts/alert_test_suite.py @@ -18,6 +18,9 @@ import copy import re import json +sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts/lib")) +from lib import alerttask + class AlertTestSuite(UnitTestSuite): def teardown(self): @@ -27,6 +30,21 @@ class AlertTestSuite(UnitTestSuite): self.orig_path = os.getcwd() super(AlertTestSuite, self).setup() + # Overwrite the ES and RABBITMQ configs for alerts + # since it pulls it from alerts/lib/config.py + alerttask.ES = { + 'servers': list('{0}'.format(s) for s in self.options.esservers) + } + alerttask.RABBITMQ = { + 'mquser': self.options.mquser, + 'alertexchange': self.options.alertExchange, + 'alertqueue': self.options.alertqueue, + 'mqport': self.options.mqport, + 'mqserver': self.options.mqserver, + 'mqpassword': self.options.mqpassword, + 'mqalertserver': self.options.mqalertserver + } + alerts_dir = os.path.join(os.path.dirname(__file__), "../../alerts/") os.chdir(alerts_dir) diff --git a/tests/suite_helper.py b/tests/suite_helper.py index 39a6b090..274304d1 100644 --- a/tests/suite_helper.py +++ b/tests/suite_helper.py @@ -36,10 +36,12 @@ def parse_config_file(): options.alertExchange = getConfig('alertexchange', 'alerts', options.configfile) options.queueName = getConfig('alertqueuename', 'alertBot', options.configfile) + options.alertqueue = getConfig('alertqueue', 'mozdef.alert', options.configfile) options.alerttopic = getConfig('alerttopic', 'mozdef.*', options.configfile) options.mquser = getConfig('mquser', 'guest', options.configfile) options.mqalertserver = getConfig('mqalertserver', 'localhost', options.configfile) + options.mqserver = getConfig('mqserver', 'localhost', options.configfile) options.mqpassword = getConfig('mqpassword', 'guest', options.configfile) options.mqport = getConfig('mqport', 5672, options.configfile) options.mqack = getConfig('mqack', True, options.configfile)