зеркало из https://github.com/mozilla/MozDef.git
Update alert test suite to use tests config file
This commit is contained in:
Родитель
7d2affb28f
Коммит
106101a5d0
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче