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
Eric Zheng
slapos.toolbox
Commits
83f161ae
Commit
83f161ae
authored
Dec 31, 2019
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promise: Test more corner cases of check_surykatka_json
parent
121b28c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
131 additions
and
0 deletions
+131
-0
slapos/test/promise/plugin/test_check_surykatka_json.py
slapos/test/promise/plugin/test_check_surykatka_json.py
+131
-0
No files found.
slapos/test/promise/plugin/test_check_surykatka_json.py
View file @
83f161ae
...
@@ -323,6 +323,137 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -323,6 +323,137 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
"days, UTC now is Fri, 27 Dec 2019 15:11:12 -0000"
"days, UTC now is Fri, 27 Dec 2019 15:11:12 -0000"
)
)
def
test_no_http_query_data
(
self
):
self
.
writeSurykatkaPromise
(
{
'report'
:
'http_query'
,
'json-file'
:
self
.
json_file
,
'url'
:
'https://www.erp5.com/'
,
'status-code'
:
'302'
,
'ip-list'
:
'127.0.0.1 127.0.0.2'
,
'test-utcnow'
:
'Fri, 27 Dec 2019 15:11:12 -0000'
}
)
self
.
writeSurykatkaJson
(
"""{
"http_query": [
],
"ssl_certificate": [
{
"date": "Fri, 27 Dec 2019 14:43:26 -0000",
"hostname": "www.erp5.com",
"ip": "127.0.0.1",
"not_after": "Mon, 13 Jul 2020 12:00:00 -0000"
},
{
"date": "Fri, 27 Dec 2019 14:43:26 -0000",
"hostname": "www.erp5.com",
"ip": "127.0.0.2",
"not_after": "Mon, 13 Jul 2020 12:00:00 -0000"
}
]
}
"""
)
self
.
configureLauncher
()
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
"http_query: No data for https://www.erp5.com/ ssl_certificate: "
"Certificate for https://www.erp5.com/ 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_no_ssl_certificate_data
(
self
):
self
.
writeSurykatkaPromise
(
{
'report'
:
'http_query'
,
'json-file'
:
self
.
json_file
,
'url'
:
'https://www.erp5.com/'
,
'status-code'
:
'302'
,
'ip-list'
:
'127.0.0.1 127.0.0.2'
,
'test-utcnow'
:
'Fri, 27 Dec 2019 15:11:12 -0000'
}
)
self
.
writeSurykatkaJson
(
"""{
"http_query": [
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "127.0.0.1",
"status_code": 302,
"url": "https://www.erp5.com/"
},
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "127.0.0.2",
"status_code": 302,
"url": "https://www.erp5.com/"
},
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "176.31.129.213",
"status_code": 200,
"url": "https://www.erp5.org/"
}
],
"ssl_certificate": [
]
}
"""
)
self
.
configureLauncher
()
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
"ssl_certificate: No data for https://www.erp5.com/ http_query: "
"https://www.erp5.com/ replied correctly with "
"status code 302 on ip list 127.0.0.1 127.0.0.2"
)
def
test_no_ssl_certificate
(
self
):
self
.
writeSurykatkaPromise
(
{
'report'
:
'http_query'
,
'json-file'
:
self
.
json_file
,
'url'
:
'https://www.erp5.com/'
,
'status-code'
:
'302'
,
'ip-list'
:
'127.0.0.1 127.0.0.2'
,
'test-utcnow'
:
'Fri, 27 Dec 2019 15:11:12 -0000'
}
)
self
.
writeSurykatkaJson
(
"""{
"http_query": [
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "127.0.0.1",
"status_code": 302,
"url": "https://www.erp5.com/"
},
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "127.0.0.2",
"status_code": 302,
"url": "https://www.erp5.com/"
},
{
"date": "Wed, 11 Dec 2019 09:35:28 -0000",
"ip": "176.31.129.213",
"status_code": 200,
"url": "https://www.erp5.org/"
}
]
}
"""
)
self
.
configureLauncher
()
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
"ssl_certificate: No data for https://www.erp5.com/ . If the error "
"persist, please update surykatka. http_query: https://www.erp5.com/ "
"replied correctly with status code 302 on ip list 127.0.0.1 127.0.0.2"
)
def
test_bad_code
(
self
):
def
test_bad_code
(
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