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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Justin
slapos.toolbox
Commits
4acb179f
Commit
4acb179f
authored
4 years ago
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promise: Treat elapsed_time = 0 specially in check_surykatka_json
It means that the server didn't reply at all.
parent
9974ad80
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
slapos/promise/plugin/check_surykatka_json.py
slapos/promise/plugin/check_surykatka_json.py
+3
-1
slapos/test/promise/plugin/test_check_surykatka_json.py
slapos/test/promise/plugin/test_check_surykatka_json.py
+6
-6
No files found.
slapos/promise/plugin/check_surykatka_json.py
View file @
4acb179f
...
@@ -214,7 +214,9 @@ class RunPromise(GenericPromise):
...
@@ -214,7 +214,9 @@ class RunPromise(GenericPromise):
if
maximum_elapsed_time
:
if
maximum_elapsed_time
:
if
'total_seconds'
in
entry
:
if
'total_seconds'
in
entry
:
maximum_elapsed_time
=
float
(
maximum_elapsed_time
)
maximum_elapsed_time
=
float
(
maximum_elapsed_time
)
if
entry
[
'total_seconds'
]
>
maximum_elapsed_time
:
if
entry
[
'total_seconds'
]
==
0.
:
appendError
(
'IP %s failed to reply'
%
(
entry
[
'ip'
]))
elif
entry
[
'total_seconds'
]
>
maximum_elapsed_time
:
appendError
(
appendError
(
'IP %s replied in %.2fs which is longer than '
'IP %s replied in %.2fs which is longer than '
'maximum %.2fs'
%
'maximum %.2fs'
%
...
...
This diff is collapsed.
Click to expand it.
slapos/test/promise/plugin/test_check_surykatka_json.py
View file @
4acb179f
...
@@ -355,7 +355,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -355,7 +355,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
"ip": "127.0.0.2",
"ip": "127.0.0.2",
"status_code": 302,
"status_code": 302,
"url": "https://www.erp5.com/",
"url": "https://www.erp5.com/",
"total_seconds":
4
"total_seconds":
0
},
},
{
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
...
@@ -387,11 +387,11 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -387,11 +387,11 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
"https://www.erp5.com/ : elapsed_time: ERROR IP 127.0.0.1 replied in "
"https://www.erp5.com/ : elapsed_time: ERROR IP 127.0.0.1 replied in "
"6.00s which is longer than maximum 5.00s
http_query: OK status code
"
"6.00s which is longer than maximum 5.00s
elapsed_time: ERROR IP
"
"
302 on IPs 127.0.0.1 127.0.0.2 ssl_certificate: OK Certificate will
"
"
127.0.0.2 failed to reply http_query: OK status code 302 on IPs
"
"
expire on Mon, 13 Jul 2020 12:00:00 -0000, which is more than 15
"
"
127.0.0.1 127.0.0.2 ssl_certificate: OK Certificate will expire on
"
"
days, UTC now is Fri, 27 Dec 2019 15:11:12 -0000 elapsed_time: OK IP
"
"
Mon, 13 Jul 2020 12:00:00 -0000, which is more than 15 days, UTC now
"
"
127.0.0.2 replied in 4.00s which is shorter than maximum 5.00s
"
"
is Fri, 27 Dec 2019 15:11:12 -0000
"
)
)
def
test_maximum_elapsed_time_no_total_seconds
(
self
):
def
test_maximum_elapsed_time_no_total_seconds
(
self
):
...
...
This diff is collapsed.
Click to expand it.
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