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
Klaus Wölfel
slapos.toolbox
Commits
0d91448e
Commit
0d91448e
authored
Feb 12, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promise: Improve bot status problem reporting in check_surykatka_json
parent
b25e3e3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
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
+26
-0
No files found.
slapos/promise/plugin/check_surykatka_json.py
View file @
0d91448e
...
@@ -65,7 +65,9 @@ class RunPromise(GenericPromise):
...
@@ -65,7 +65,9 @@ class RunPromise(GenericPromise):
return
return
bot_status
=
bot_status_list
[
0
]
bot_status
=
bot_status_list
[
0
]
if
bot_status
.
get
(
'text'
)
!=
'loop'
:
if
bot_status
.
get
(
'text'
)
!=
'loop'
:
appendError
(
"No type loop detected in %r"
,
self
.
json_file
)
appendError
(
"bot_status is %r instead of 'loop' in %r"
,
str
(
bot_status
.
get
(
'text'
)),
self
.
json_file
)
return
return
timetuple
=
email
.
utils
.
parsedate
(
bot_status
[
'date'
])
timetuple
=
email
.
utils
.
parsedate
(
bot_status
[
'date'
])
last_bot_datetime
=
datetime
.
datetime
.
fromtimestamp
(
time
.
mktime
(
timetuple
))
last_bot_datetime
=
datetime
.
datetime
.
fromtimestamp
(
time
.
mktime
(
timetuple
))
...
...
slapos/test/promise/plugin/test_check_surykatka_json.py
View file @
0d91448e
...
@@ -118,6 +118,32 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -118,6 +118,32 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
"UTC now is Wed, 13 Dec 2222 09:11:12 -0000"
"UTC now is Wed, 13 Dec 2222 09:11:12 -0000"
)
)
def
test_no_loop
(
self
):
self
.
writeSurykatkaPromise
(
{
'report'
:
'bot_status'
,
'json-file'
:
self
.
json_file
,
'test-utcnow'
:
'Wed, 13 Dec 2222 09:11:12 -0000'
}
)
self
.
writeSurykatkaJson
(
"""{
"bot_status": [
{
"date": "Wed, 13 Dec 2222 09:10:11 -0000",
"text": "error"
}
]
}
"""
)
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
"bot_status: ERROR bot_status is 'error' instead of 'loop' in '%s'"
%
(
self
.
json_file
,)
)
def
test_bot_status_future
(
self
):
def
test_bot_status_future
(
self
):
self
.
writeSurykatkaPromise
(
self
.
writeSurykatkaPromise
(
{
{
...
...
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