Commit 5aadeec4 authored by Xiaowu Zhang's avatar Xiaowu Zhang

longrequest_promise: more comprehensible message

parent d5b915b6
...@@ -46,9 +46,9 @@ class RunPromise(GenericPromise): ...@@ -46,9 +46,9 @@ class RunPromise(GenericPromise):
break break
error_amount += 1 error_amount += 1
if error_amount > error_threshold: if error_amount > error_threshold:
self.logger.error('ERROR=%s' % error_amount) self.logger.error('ERROR: Site has %s long request' % error_amount)
else: else:
self.logger.info('INFO=%s' % error_amount) self.logger.info('INFO: Site has %s long request' % error_amount)
def test(self): def test(self):
return self._test(result_count=1, failure_amount=1) return self._test(result_count=1, failure_amount=1)
......
...@@ -73,7 +73,7 @@ extra_config_dict = { ...@@ -73,7 +73,7 @@ extra_config_dict = {
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['message'], "ERROR=6") self.assertEquals(result['result']['message'], "ERROR: Site has 6 long request")
def test_02_no_delay_error_threshold(self): def test_02_no_delay_error_threshold(self):
content = """from slapos.promise.plugin.check_error_on_zope_longrequest_log import RunPromise content = """from slapos.promise.plugin.check_error_on_zope_longrequest_log import RunPromise
...@@ -89,7 +89,7 @@ extra_config_dict = { ...@@ -89,7 +89,7 @@ extra_config_dict = {
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['message'], "INFO=6") self.assertEquals(result['result']['message'], "INFO: Site has 6 long request")
def test_03_delay_no_error_threshold(self): def test_03_delay_no_error_threshold(self):
content = """from slapos.promise.plugin.check_error_on_zope_longrequest_log import RunPromise content = """from slapos.promise.plugin.check_error_on_zope_longrequest_log import RunPromise
...@@ -105,7 +105,7 @@ extra_config_dict = { ...@@ -105,7 +105,7 @@ extra_config_dict = {
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['message'], "ERROR=3") self.assertEquals(result['result']['message'], "ERROR: Site has 3 long request")
if __name__ == '__main__': if __name__ == '__main__':
......
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