Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
5aadeec4
Commit
5aadeec4
authored
Jan 08, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
longrequest_promise: more comprehensible message
parent
d5b915b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
+2
-2
slapos/test/promise/plugin/test_check_error_on_zope_longrequest_log.py
...romise/plugin/test_check_error_on_zope_longrequest_log.py
+3
-3
No files found.
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
View file @
5aadeec4
...
@@ -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
)
...
...
slapos/test/promise/plugin/test_check_error_on_zope_longrequest_log.py
View file @
5aadeec4
...
@@ -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__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment