Commit 35697982 authored by Łukasz Nowak's avatar Łukasz Nowak

monitor: Simplify edge configuration

Minimize amount of parameters passed from master partition to the slaves, as
slave configuration shall be maximally self contained.

Note: This will allow further development (like regionalization) much simpler.
parent 3dc3fdbd
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 9ddae686379e8d747410c1adf82b47d6 md5sum = 25aacd9f1f8139fa1a31516eedc7a5eb
[template-monitor] [template-monitor]
_update_hash_filename_ = instance-monitor.cfg.jinja2 _update_hash_filename_ = instance-monitor.cfg.jinja2
...@@ -30,7 +30,7 @@ md5sum = a57106ee88ff3295b9ffce84105da79b ...@@ -30,7 +30,7 @@ md5sum = a57106ee88ff3295b9ffce84105da79b
[template-monitor-edgebot] [template-monitor-edgebot]
_update_hash_filename_ = instance-monitor-edgebot.cfg.jinja2 _update_hash_filename_ = instance-monitor-edgebot.cfg.jinja2
md5sum = 849608f74dc8c95aea04cadde0bea0e6 md5sum = 92a064916843a92d6c756804cee70248
[network-bench-cfg] [network-bench-cfg]
filename = network_bench.cfg.in filename = network_bench.cfg.in
......
...@@ -8,41 +8,11 @@ ...@@ -8,41 +8,11 @@
"description": "List of name servers to use.", "description": "List of name servers to use.",
"type": "array" "type": "array"
}, },
"check-status-code": {
"default": 200,
"title": "Default Check HTTP Code",
"description": "Default HTTP code to check against (default: 200).",
"type": "number"
},
"check-http-header-dict": {
"default": {},
"title": "HTTP header dict to check",
"description": "JSON object of expected HTTP header, like {\"Cache-Control\": \"max-age=3600, public\", \"Vary\": \"Accept-Encoding\"}. Note: Shall be expressed directly as object, without any additional qouting.",
"type": "object"
},
"check-frontend-ip": { "check-frontend-ip": {
"default": [], "default": [],
"title": "Default list of Frontend IPs to check", "title": "Default list of Frontend IPs to check",
"description": "Default list of Frontend IPs to check, if empty no constraint is used.", "description": "Default list of Frontend IPs to check, if empty no constraint is used.",
"type": "array" "type": "array"
},
"check-certificate-expiration-days": {
"default": 15,
"title": "Default certificate expiration days check",
"description": "Default amount of days to consider certificate as being to-be-expired (default: 15).",
"type": "number"
},
"check-maximum-elapsed-time": {
"default": 2,
"title": "Default maximum elapsed time for a site to reply (seconds)",
"description": "Default maximum elapsed time for a site to reply to be considered good (default: 2s).",
"type": "number"
},
"failure-amount": {
"default": 1,
"title": "Default amount of failures to consider URL as in bad state",
"description": "Default amount of failures to consider URL as in bad state, can be set to higher value for endpoints with accepted short outages (default: 1).",
"type": "number"
} }
} }
} }
...@@ -4,44 +4,48 @@ ...@@ -4,44 +4,48 @@
"properties": { "properties": {
"url": { "url": {
"title": "URL to check", "title": "URL to check",
"description": "URL to check, like https://example.com", "description": "URL to check, like https://example.com/",
"type": "string" "type": "string"
}, },
"check-status-code": { "check-status-code": {
"default": "Master default", "title": "HTTP Code Check",
"title": "Default Check HTTP Code.", "description": "Expected response HTTP Code.",
"description": "HTTP code to check against (default: comes from master partition).", "type": "number",
"type": "number" "default": 200,
"minimum": 100,
"maximum": 599
},
"check-certificate-expiration-days": {
"title": "Certificate Expiration Check (days)",
"description": "Amount of days to consider certificate as being to-be-expired.",
"type": "number",
"default": 15,
"minimum": 1
},
"check-maximum-elapsed-time": {
"title": "Maximum Elapsed Check (seconds)",
"description": "Maximum elapsed time for a site to reply to be considered good.",
"type": "number",
"default": 2,
"minimum": 1
}, },
"check-http-header-dict": { "check-http-header-dict": {
"default": "Master default", "title": "HTTP Header Check",
"title": "HTTP header dict to check",
"description": "JSON object of expected HTTP header, like {\"Cache-Control\": \"max-age=3600, public\", \"Vary\": \"Accept-Encoding\"}. Note: Shall be expressed directly as object, without any additional qouting.", "description": "JSON object of expected HTTP header, like {\"Cache-Control\": \"max-age=3600, public\", \"Vary\": \"Accept-Encoding\"}. Note: Shall be expressed directly as object, without any additional qouting.",
"type": "object" "type": "object",
"default": {}
}, },
"check-frontend-ip": { "check-frontend-ip": {
"default": "Master default", "title": "Frontend IPs to check",
"title": "List of Frontend IPs to check",
"description": "List of Frontend IPs to check, if empty no constraint is used (default: comes from master partition).", "description": "List of Frontend IPs to check, if empty no constraint is used (default: comes from master partition).",
"type": "array" "type": "array"
}, },
"check-certificate-expiration-days": {
"default": "Master default",
"title": "Certificate expiration days check",
"description": "Amount of days to consider certificate as being to-be-expired (default: comes from master partition).",
"type": "number"
},
"check-maximum-elapsed-time": {
"default": "Master default",
"title": "Maximum elapsed time for a site to reply (seconds)",
"description": "Maximum elapsed time for a site to reply to be considered good.(default: comes from master partition).",
"type": "number"
},
"failure-amount": { "failure-amount": {
"default": "Master default", "title": "Failure Amount",
"title": "Amount of failures to consider URL as in bad state", "description": "Amount of failures to consider URL as in bad state, can be set to higher value for endpoints with accepted short outages.",
"description": "Amount of failures to consider URL as in bad state, can be set to higher value for endpoints with accepted short outages (default: comes from master partition).", "type": "number",
"type": "number" "default": 2,
"minimum": 1
} }
} }
} }
...@@ -12,24 +12,12 @@ ...@@ -12,24 +12,12 @@
{%- for slave in json_module.loads(extra_slave_instance_list) | sort(attribute='slave_title') %} {%- for slave in json_module.loads(extra_slave_instance_list) | sort(attribute='slave_title') %}
{%- if '_' in slave %} {%- if '_' in slave %}
{%- do slave.update(json_module.loads(slave.pop('_'))) %} {%- do slave.update(json_module.loads(slave.pop('_'))) %}
{%- if 'check-status-code' not in slave %} {%- do slave.setdefault('check-status-code', 200) %}
{%- do slave.__setitem__('check-status-code', int(CONFIGURATION['check-status-code'])) %} {%- do slave.setdefault('check-http-header-dict', {}) %}
{%- endif %} {%- do slave.setdefault('check-certificate-expiration-days', 15) %}
{%- if 'check-http-header-dict' not in slave %} {%- do slave.setdefault('failure-amount', 2) %}
{%- do slave.__setitem__('check-http-header-dict', CONFIGURATION['check-http-header-dict']) %} {%- do slave.setdefault('check-maximum-elapsed-time', 2) %}
{%- endif %} {%- do slave.setdefault('check-frontend-ip', CONFIGURATION['check-frontend-ip']) %}
{%- if 'check-certificate-expiration-days' not in slave %}
{%- do slave.__setitem__('check-certificate-expiration-days', int(CONFIGURATION['check-certificate-expiration-days'])) %}
{%- endif %}
{%- if 'failure-amount' not in slave %}
{%- do slave.__setitem__('failure-amount', int(CONFIGURATION['failure-amount'])) %}
{%- endif %}
{%- if 'check-maximum-elapsed-time' not in slave %}
{%- do slave.__setitem__('check-maximum-elapsed-time', int(CONFIGURATION['check-maximum-elapsed-time'])) %}
{%- endif %}
{%- if 'check-frontend-ip' not in slave %}
{%- do slave.__setitem__('check-frontend-ip', CONFIGURATION['check-frontend-ip']) %}
{%- endif %}
{%- if 'url' in slave %} {%- if 'url' in slave %}
{%- set class = slave['check-maximum-elapsed-time'] %} {%- set class = slave['check-maximum-elapsed-time'] %}
{%- if class not in slave_instance_dict %} {%- if class not in slave_instance_dict %}
......
...@@ -75,13 +75,8 @@ url = $${slap-connection:server-url} ...@@ -75,13 +75,8 @@ url = $${slap-connection:server-url}
key = $${slap-connection:key-file} key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file} cert = $${slap-connection:cert-file}
# Defaults # Defaults
configuration.check-status-code = 200
configuration.check-http-header-dict = {}
configuration.nameserver = configuration.nameserver =
configuration.check-frontend-ip = configuration.check-frontend-ip =
configuration.check-certificate-expiration-days = 15
configuration.check-maximum-elapsed-time = 2
configuration.failure-amount = 2
# use monitor-base-port to have monitor listening on each instance # use monitor-base-port to have monitor listening on each instance
# on different port and also on different port than other services # on different port and also on different port than other services
# it makes it possible to instantiate it correctly on signle IP, for # it makes it possible to instantiate it correctly on signle IP, for
......
...@@ -270,335 +270,202 @@ class EdgeSlaveMixin(MonitorTestMixin): ...@@ -270,335 +270,202 @@ class EdgeSlaveMixin(MonitorTestMixin):
class TestEdge(EdgeSlaveMixin, SlapOSInstanceTestCase): class TestEdge(EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = { surykatka_dict = {
2: {'expected_ini': """[SURYKATKA] 1: {'expected_ini': """[SURYKATKA]
INTERVAL = 120 INTERVAL = 120
TIMEOUT = 4 TIMEOUT = 3
SQLITE = %(db_file)s SQLITE = %(db_file)s
URL = URL =
https://www.erp5.com/ https://www.checkmaximumelapsedtime1.org/"""},
https://www.erp5.org/"""}
}
def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'status-code': '300'")
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'certificate-expiration-days': '15'")
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'url': 'https://www.erp5.org/'")
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-300-promise.py',
"'failure-amount': '2'"
)
self.assertPromiseContent(
'http-query-backend-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'certificate-expiration-days': '15'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-promise.py',
"'failure-amount': '2'"
)
def requestEdgetestSlaves(self):
self.requestEdgetestSlave(
'backend',
{'url': 'https://www.erp5.com/'},
)
self.requestEdgetestSlave(
'backend-300',
{'url': 'https://www.erp5.org/', 'check-status-code': 300},
)
class TestEdgeNameserverCheckFrontendIp(
EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = {
2: {'expected_ini': """[SURYKATKA] 2: {'expected_ini': """[SURYKATKA]
INTERVAL = 120 INTERVAL = 120
TIMEOUT = 4 TIMEOUT = 4
SQLITE = %(db_file)s SQLITE = %(db_file)s
NAMESERVER =
127.0.1.1
127.0.1.2
URL = URL =
https://www.erp5.com/"""} https://www.checkcertificateexpirationdays.org/
} https://www.checkfrontendip.org/
https://www.checkhttpheaderdict.org/
@classmethod https://www.checkstatuscode.org/
def getInstanceParameterDict(cls): https://www.default.org/
return {'_': json.dumps({ https://www.failureamount.org/"""},
'nameserver': ['127.0.1.1', '127.0.1.2'], 20: {'expected_ini': """[SURYKATKA]
'check-frontend-ip': ['127.0.0.1', '127.0.0.2'],
})}
def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-promise.py',
"'ip-list': '127.0.0.1 127.0.0.2'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'certificate-expiration-days': '15'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-promise.py',
"'failure-amount': '2'"
)
def requestEdgetestSlaves(self):
self.requestEdgetestSlave(
'backend',
{'url': 'https://www.erp5.com/'},
)
class TestEdgeCheckStatusCode(EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = {
2: {'expected_ini': """[SURYKATKA]
INTERVAL = 120 INTERVAL = 120
TIMEOUT = 4 TIMEOUT = 22
SQLITE = %(db_file)s SQLITE = %(db_file)s
URL = URL =
https://www.erp5.com/ https://www.checkmaximumelapsedtime20.org/"""},
https://www.erp5.org/"""}
} }
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({
'check-status-code': 500,
})}
def assertSurykatkaPromises(self): def assertSurykatkaPromises(self):
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-501-promise.py', 'http-query-checkcertificateexpirationdays-promise.py',
"'ip-list': ''") """extra_config_dict = { 'certificate-expiration-days': '20',
self.assertPromiseContent( 'failure-amount': '2',
'http-query-backend-501-promise.py', 'http-header-dict': '{}',
"'report': 'http_query'") 'ip-list': '',
self.assertPromiseContent( 'json-file': '%s',
'http-query-backend-501-promise.py', 'maximum-elapsed-time': '2',
"'status-code': '501'") 'report': 'http_query',
self.assertPromiseContent( 'status-code': '200',
'http-query-backend-501-promise.py', 'url': 'https://www.checkcertificateexpirationdays.org/'}""" % (
"'certificate-expiration-days': '15'") self.surykatka_dict[2]['json-file'],))
self.assertPromiseContent(
'http-query-backend-501-promise.py', self.assertPromiseContent(
"'url': 'https://www.erp5.org/'") 'http-query-checkhttpheaderdict-promise.py',
self.assertPromiseContent( """extra_config_dict = { 'certificate-expiration-days': '15',
'http-query-backend-501-promise.py', 'failure-amount': '2',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],) 'http-header-dict': '{"A": "AAA"}',
) 'ip-list': '',
self.assertPromiseContent( 'json-file': '%s',
'http-query-backend-501-promise.py', 'maximum-elapsed-time': '2',
"'failure-amount': '2'" 'report': 'http_query',
) 'status-code': '200',
'url': 'https://www.checkhttpheaderdict.org/'}""" % (
self.assertPromiseContent( self.surykatka_dict[2]['json-file'],))
'http-query-backend-promise.py',
"'ip-list': ''") self.assertPromiseContent(
self.assertPromiseContent( 'http-query-checkmaximumelapsedtime1-promise.py',
'http-query-backend-promise.py', """extra_config_dict = { 'certificate-expiration-days': '15',
"'report': 'http_query'") 'failure-amount': '2',
self.assertPromiseContent( 'http-header-dict': '{}',
'http-query-backend-promise.py', 'ip-list': '',
"'status-code': '500'") 'json-file': '%s',
self.assertPromiseContent( 'maximum-elapsed-time': '1',
'http-query-backend-promise.py', 'report': 'http_query',
"'certificate-expiration-days': '15'") 'status-code': '200',
self.assertPromiseContent( 'url': 'https://www.checkmaximumelapsedtime1.org/'}""" % (
'http-query-backend-promise.py', self.surykatka_dict[1]['json-file'],))
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-promise.py', 'http-query-checkmaximumelapsedtime20-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],) """extra_config_dict = { 'certificate-expiration-days': '15',
) 'failure-amount': '2',
self.assertPromiseContent( 'http-header-dict': '{}',
'http-query-backend-promise.py', 'ip-list': '',
"'failure-amount': '2'" 'json-file': '%s',
) 'maximum-elapsed-time': '20',
'report': 'http_query',
'status-code': '200',
'url': 'https://www.checkmaximumelapsedtime20.org/'}""" % (
self.surykatka_dict[20]['json-file'],))
self.assertPromiseContent(
'http-query-checkstatuscode-promise.py',
"""extra_config_dict = { 'certificate-expiration-days': '15',
'failure-amount': '2',
'http-header-dict': '{}',
'ip-list': '',
'json-file': '%s',
'maximum-elapsed-time': '2',
'report': 'http_query',
'status-code': '300',
'url': 'https://www.checkstatuscode.org/'}""" % (
self.surykatka_dict[2]['json-file'],))
self.assertPromiseContent(
'http-query-default-promise.py',
"""extra_config_dict = { 'certificate-expiration-days': '15',
'failure-amount': '2',
'http-header-dict': '{}',
'ip-list': '',
'json-file': '%s',
'maximum-elapsed-time': '2',
'report': 'http_query',
'status-code': '200',
'url': 'https://www.default.org/'}""" % (
self.surykatka_dict[2]['json-file'],))
self.assertPromiseContent(
'http-query-failureamount-promise.py',
"""extra_config_dict = { 'certificate-expiration-days': '15',
'failure-amount': '10',
'http-header-dict': '{}',
'ip-list': '',
'json-file': '%s',
'maximum-elapsed-time': '2',
'report': 'http_query',
'status-code': '200',
'url': 'https://www.failureamount.org/'}""" % (
self.surykatka_dict[2]['json-file'],))
self.assertPromiseContent(
'http-query-checkfrontendip-promise.py',
"""extra_config_dict = { 'certificate-expiration-days': '15',
'failure-amount': '2',
'http-header-dict': '{}',
'ip-list': '128.129.130.131 131.134.135.136',
'json-file': '%s',
'maximum-elapsed-time': '2',
'report': 'http_query',
'status-code': '200',
'url': 'https://www.checkfrontendip.org/'}""" % (
self.surykatka_dict[2]['json-file'],))
def requestEdgetestSlaves(self): def requestEdgetestSlaves(self):
self.requestEdgetestSlave( self.requestEdgetestSlave(
'backend', 'default',
{'url': 'https://www.erp5.com/'}, {'url': 'https://www.default.org/'},
) )
self.requestEdgetestSlave( self.requestEdgetestSlave(
'backend-501', 'checkstatuscode',
{'url': 'https://www.erp5.org/', 'check-status-code': 501}, {'url': 'https://www.checkstatuscode.org/', 'check-status-code': 300},
) )
self.requestEdgetestSlave(
'checkhttpheaderdict',
class TestEdgeCheckHTTPHeaderDict(EdgeSlaveMixin, SlapOSInstanceTestCase): {'url': 'https://www.checkhttpheaderdict.org/',
surykatka_dict = { 'check-http-header-dict': {"A": "AAA"}},
2: {'expected_ini': """[SURYKATKA]
INTERVAL = 120
TIMEOUT = 4
SQLITE = %(db_file)s
URL =
https://www.erp5.com/
https://www.erp5.org/"""}
}
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({
'check-http-header-dict': {"B": "BBB"},
})}
def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'http-header-dict': '{\"A\": \"AAA\"}'")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'certificate-expiration-days': '15'")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'url': 'https://www.erp5.org/'")
self.assertPromiseContent(
'http-query-backend-http-header-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
) )
self.assertPromiseContent( self.requestEdgetestSlave(
'http-query-backend-http-header-promise.py', 'checkcertificateexpirationdays',
"'failure-amount': '2'" {'url': 'https://www.checkcertificateexpirationdays.org/',
'check-certificate-expiration-days': '20'},
) )
self.requestEdgetestSlave(
self.assertPromiseContent( 'checkmaximumelapsedtime20',
'http-query-backend-promise.py', {'url': 'https://www.checkmaximumelapsedtime20.org/',
"'ip-list': ''") 'check-maximum-elapsed-time': 20},
self.assertPromiseContent(
'http-query-backend-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'http-header-dict': '{\"B\": \"BBB\"}'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'certificate-expiration-days': '15'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
) )
self.assertPromiseContent( self.requestEdgetestSlave(
'http-query-backend-promise.py', 'checkmaximumelapsedtime1',
"'failure-amount': '2'" {'url': 'https://www.checkmaximumelapsedtime1.org/',
'check-maximum-elapsed-time': 1},
) )
def requestEdgetestSlaves(self):
self.requestEdgetestSlave( self.requestEdgetestSlave(
'backend', 'failureamount',
{'url': 'https://www.erp5.com/'}, {'url': 'https://www.failureamount.org/', 'failure-amount': '10'},
) )
self.requestEdgetestSlave( self.requestEdgetestSlave(
'backend-http-header', 'checkfrontendip',
{'url': 'https://www.erp5.org/', 'check-http-header-dict': {"A": "AAA"}}, {'url': 'https://www.checkfrontendip.org/',
'check-frontend-ip': ['128.129.130.131', '131.134.135.136']},
) )
class TestEdgeCheckCertificateExpirationDays( class TestEdgeNameserverCheckFrontendIp(
EdgeSlaveMixin, SlapOSInstanceTestCase): EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = { surykatka_dict = {
2: {'expected_ini': """[SURYKATKA] 2: {'expected_ini': """[SURYKATKA]
INTERVAL = 120 INTERVAL = 120
TIMEOUT = 4 TIMEOUT = 4
SQLITE = %(db_file)s SQLITE = %(db_file)s
NAMESERVER =
127.0.1.1
127.0.1.2
URL = URL =
https://www.erp5.com/ https://www.erp5.com/"""}
https://www.erp5.org/"""}
} }
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
return {'_': json.dumps({ return {'_': json.dumps({
'check-certificate-expiration-days': 10, 'nameserver': ['127.0.1.1', '127.0.1.2'],
'check-frontend-ip': ['127.0.0.1', '127.0.0.2'],
})} })}
def assertSurykatkaPromises(self): def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'certificate-expiration-days': '20'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'url': 'https://www.erp5.org/'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'failure-amount': '2'"
)
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-promise.py', 'http-query-backend-promise.py',
"'ip-list': ''") "'ip-list': '127.0.0.1 127.0.0.2'")
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-promise.py', 'http-query-backend-promise.py',
"'report': 'http_query'") "'report': 'http_query'")
...@@ -607,7 +474,7 @@ URL = ...@@ -607,7 +474,7 @@ URL =
"'status-code': '200'") "'status-code': '200'")
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-promise.py', 'http-query-backend-promise.py',
"'certificate-expiration-days': '10'") "'certificate-expiration-days': '15'")
self.assertPromiseContent( self.assertPromiseContent(
'http-query-backend-promise.py', 'http-query-backend-promise.py',
"'url': 'https://www.erp5.com/'") "'url': 'https://www.erp5.com/'")
...@@ -625,193 +492,3 @@ URL = ...@@ -625,193 +492,3 @@ URL =
'backend', 'backend',
{'url': 'https://www.erp5.com/'}, {'url': 'https://www.erp5.com/'},
) )
self.requestEdgetestSlave(
'backend-20',
{'url': 'https://www.erp5.org/',
'check-certificate-expiration-days': '20'},
)
class TestEdgeCheckMaximumElapsedTime(
EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = {
5: {'expected_ini': """[SURYKATKA]
INTERVAL = 120
TIMEOUT = 7
SQLITE = %(db_file)s
URL =
https://www.erp5.com/"""},
20: {'expected_ini': """[SURYKATKA]
INTERVAL = 120
TIMEOUT = 22
SQLITE = %(db_file)s
URL =
https://www.erp5.org/"""},
1: {'expected_ini': """[SURYKATKA]
INTERVAL = 120
TIMEOUT = 3
SQLITE = %(db_file)s
URL =
https://www.erp5.net/"""}
}
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({
'check-maximum-elapsed-time': 5,
})}
def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'maximum-elapsed-time': '20'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'url': 'https://www.erp5.org/'")
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[20]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-20-promise.py',
"'failure-amount': '2'"
)
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'maximum-elapsed-time': '5'")
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[5]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-default-promise.py',
"'failure-amount': '2'"
)
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'ip-list': ''")
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'maximum-elapsed-time': '1'")
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'url': 'https://www.erp5.net/'")
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[1]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-1-promise.py',
"'failure-amount': '2'"
)
def requestEdgetestSlaves(self):
self.requestEdgetestSlave(
'backend-default',
{'url': 'https://www.erp5.com/'},
)
self.requestEdgetestSlave(
'backend-20',
{'url': 'https://www.erp5.org/',
'check-maximum-elapsed-time': 20},
)
self.requestEdgetestSlave(
'backend-1',
{'url': 'https://www.erp5.net/',
'check-maximum-elapsed-time': 1},
)
class TestEdgeFailureAmount(
EdgeSlaveMixin, SlapOSInstanceTestCase):
surykatka_dict = {
2: {'expected_ini': """[SURYKATKA]
INTERVAL = 120
TIMEOUT = 4
SQLITE = %(db_file)s
URL =
https://www.erp5.com/
https://www.erp5.org/"""}
}
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({
'failure-amount': 5
})}
def assertSurykatkaPromises(self):
self.assertPromiseContent(
'http-query-backend-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'url': 'https://www.erp5.com/'")
self.assertPromiseContent(
'http-query-backend-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-promise.py',
"'failure-amount': '5'"
)
self.assertPromiseContent(
'http-query-backend-10-promise.py',
"'report': 'http_query'")
self.assertPromiseContent(
'http-query-backend-10-promise.py',
"'status-code': '200'")
self.assertPromiseContent(
'http-query-backend-10-promise.py',
"'url': 'https://www.erp5.org/'")
self.assertPromiseContent(
'http-query-backend-10-promise.py',
"'json-file': '%s'" % (self.surykatka_dict[2]['json-file'],)
)
self.assertPromiseContent(
'http-query-backend-10-promise.py',
"'failure-amount': '10'"
)
def requestEdgetestSlaves(self):
self.requestEdgetestSlave(
'backend',
{'url': 'https://www.erp5.com/'},
)
self.requestEdgetestSlave(
'backend-10',
{'url': 'https://www.erp5.org/', 'failure-amount': '10'},
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment