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
Łukasz Nowak
slapos.toolbox
Commits
eda22bd9
Commit
eda22bd9
authored
Feb 11, 2020
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
45d2d6d4
Changes
2
Hide 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 @
eda22bd9
...
...
@@ -214,7 +214,9 @@ class RunPromise(GenericPromise):
if
maximum_elapsed_time
:
if
'total_seconds'
in
entry
:
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
(
'IP %s replied in %.2fs which is longer than '
'maximum %.2fs'
%
...
...
slapos/test/promise/plugin/test_check_surykatka_json.py
View file @
eda22bd9
...
...
@@ -355,7 +355,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
"ip": "127.0.0.2",
"status_code": 302,
"url": "https://www.erp5.com/",
"total_seconds":
4
"total_seconds":
0
},
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
...
...
@@ -387,11 +387,11 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
"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
"
"
302 on IPs 127.0.0.1 127.0.0.2 ssl_certificate: OK Certificate will
"
"
expire on Mon, 13 Jul 2020 12:00:00 -0000, which is more than 15
"
"
days, UTC now is Fri, 27 Dec 2019 15:11:12 -0000 elapsed_time: OK IP
"
"
127.0.0.2 replied in 4.00s which is shorter than maximum 5.00s
"
"6.00s which is longer than maximum 5.00s
elapsed_time: ERROR IP
"
"
127.0.0.2 failed to reply http_query: OK status code 302 on IPs
"
"
127.0.0.1 127.0.0.2 ssl_certificate: OK Certificate will expire on
"
"
Mon, 13 Jul 2020 12:00:00 -0000, which is more than 15 days, UTC now
"
"
is Fri, 27 Dec 2019 15:11:12 -0000
"
)
def
test_maximum_elapsed_time_no_total_seconds
(
self
):
...
...
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