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
Boxiang Sun
slapos.toolbox
Commits
b25e3e3a
Commit
b25e3e3a
authored
Feb 12, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promise: check_surykatka_json is testless
Result of the promise is not important for instantiation.
parent
6a8f4002
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
slapos/promise/plugin/check_surykatka_json.py
slapos/promise/plugin/check_surykatka_json.py
+2
-0
slapos/test/promise/plugin/test_check_surykatka_json.py
slapos/test/promise/plugin/test_check_surykatka_json.py
+23
-23
No files found.
slapos/promise/plugin/check_surykatka_json.py
View file @
b25e3e3a
...
@@ -29,6 +29,8 @@ class RunPromise(GenericPromise):
...
@@ -29,6 +29,8 @@ class RunPromise(GenericPromise):
self
.
result_count
=
self
.
failure_amount
self
.
result_count
=
self
.
failure_amount
self
.
error_list
=
[]
self
.
error_list
=
[]
self
.
info_list
=
[]
self
.
info_list
=
[]
# Make promise test-less, as it's result is not important for instantiation
self
.
setTestLess
()
def
appendErrorMessage
(
self
,
message
):
def
appendErrorMessage
(
self
,
message
):
self
.
error_list
.
append
(
message
)
self
.
error_list
.
append
(
message
)
...
...
slapos/test/promise/plugin/test_check_surykatka_json.py
View file @
b25e3e3a
...
@@ -46,7 +46,7 @@ class CheckSurykatkaJSONMixin(TestPromisePluginMixin):
...
@@ -46,7 +46,7 @@ class CheckSurykatkaJSONMixin(TestPromisePluginMixin):
class
TestCheckSurykatkaJSON
(
CheckSurykatkaJSONMixin
):
class
TestCheckSurykatkaJSON
(
CheckSurykatkaJSONMixin
):
def
test_no_config
(
self
):
def
test_no_config
(
self
):
self
.
writeSurykatkaPromise
()
self
.
writeSurykatkaPromise
()
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -55,7 +55,7 @@ class TestCheckSurykatkaJSON(CheckSurykatkaJSONMixin):
...
@@ -55,7 +55,7 @@ class TestCheckSurykatkaJSON(CheckSurykatkaJSONMixin):
def
test_not_existing_file
(
self
):
def
test_not_existing_file
(
self
):
self
.
writeSurykatkaPromise
({
'json-file'
:
self
.
json_file
})
self
.
writeSurykatkaPromise
({
'json-file'
:
self
.
json_file
})
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -65,7 +65,7 @@ class TestCheckSurykatkaJSON(CheckSurykatkaJSONMixin):
...
@@ -65,7 +65,7 @@ class TestCheckSurykatkaJSON(CheckSurykatkaJSONMixin):
def
test_empty_file
(
self
):
def
test_empty_file
(
self
):
self
.
writeSurykatkaPromise
({
'json-file'
:
self
.
json_file
})
self
.
writeSurykatkaPromise
({
'json-file'
:
self
.
json_file
})
self
.
writeSurykatkaJson
(
''
)
self
.
writeSurykatkaJson
(
''
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -84,7 +84,7 @@ class TestCheckSurykatkaJSONUnknownReport(CheckSurykatkaJSONMixin):
...
@@ -84,7 +84,7 @@ class TestCheckSurykatkaJSONUnknownReport(CheckSurykatkaJSONMixin):
self
.
writeSurykatkaJson
(
"""{
self
.
writeSurykatkaJson
(
"""{
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -110,7 +110,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -110,7 +110,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -135,7 +135,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -135,7 +135,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -161,7 +161,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -161,7 +161,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -180,7 +180,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -180,7 +180,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
self
.
writeSurykatkaJson
(
"""{
self
.
writeSurykatkaJson
(
"""{
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -198,7 +198,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
...
@@ -198,7 +198,7 @@ class TestCheckSurykatkaJSONBotStatus(CheckSurykatkaJSONMixin):
"bot_status": []
"bot_status": []
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -255,7 +255,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -255,7 +255,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -317,7 +317,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -317,7 +317,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -382,7 +382,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -382,7 +382,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -444,7 +444,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -444,7 +444,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -490,7 +490,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -490,7 +490,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -545,7 +545,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -545,7 +545,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertPassedMessage
(
self
.
assertPassedMessage
(
self
.
getPromiseResult
(
self
.
promise_name
),
self
.
getPromiseResult
(
self
.
promise_name
),
...
@@ -585,7 +585,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -585,7 +585,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -632,7 +632,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -632,7 +632,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -675,7 +675,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -675,7 +675,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -732,7 +732,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -732,7 +732,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -778,7 +778,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -778,7 +778,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
%
status_code
)
"""
%
status_code
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -849,7 +849,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -849,7 +849,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -909,7 +909,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -909,7 +909,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
@@ -963,7 +963,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
...
@@ -963,7 +963,7 @@ class TestCheckSurykatkaJSONHttpQuery(CheckSurykatkaJSONMixin):
]
]
}
}
"""
)
"""
)
self
.
configureLauncher
()
self
.
configureLauncher
(
enable_anomaly
=
True
)
with
self
.
assertRaises
(
PromiseError
):
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
self
.
launcher
.
run
()
self
.
assertFailedMessage
(
self
.
assertFailedMessage
(
...
...
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