Initial code for log analysis
- we agreed to basically throw away the old log checker (as it is
unmaintainable)
- now: provide list of analysis to do
* all checkers in cls_log_analysis, can be unit tested (see also next
commit)
* looked up dynamically to simplify adding of new tests + config
* configured with
<analysis>
<services>DESCRIPTION [DESCRIPTION...]</services>
<service>DESCRIPTION</service>
...
</analysis>
where DESCRIPTION follows service=func[=options]:
- service is name of service to check
- func is function to call, which receives filename
- option are arbitary options to pass to func
<services> is whitespace delimited (so can take multiple service
analysis definitions)
<service> exists to allow service definitions with whitespace
changes that would not work in <services>
- I initially planned to check return code, but most softmodems actually
exit with non-zero return code, so this is still TODO
- Default analyzer (checking for assertions, ...) is always run if a
service is listed
- checks for file size
- add unit tests
This commit is contained in:
@@ -53,5 +53,19 @@ class TestAnalysis(unittest.TestCase):
|
||||
# TODO this one is not found, the CI does not recover this??
|
||||
#self.assertEqual(s['Data']['DL & UL scheduling timing'], ['17', '97', '159371', '1.14'])
|
||||
|
||||
def test_analze_services_no_service(self):
|
||||
service_desc = {} # nothing to analyze
|
||||
to_analyze = ["testserv"] # some service requested to be analyze that does not exist
|
||||
status = cls_analysis.AnalyzeServices(self.html, service_desc, to_analyze)
|
||||
self.assertFalse(status)
|
||||
|
||||
# TODO this does not work: we don't evaluate return codes yet
|
||||
#def test_analze_service_exit_nonnull(self):
|
||||
# service_desc = {}
|
||||
# service_desc["testserv"] = {'returncode': 129, 'logfile': 'tests/log-analysis/empty.log'}
|
||||
# to_analyze = ["testserv"] # some service requested to be analyze that does not exist
|
||||
# status = cls_analysis.AnalyzeServices(self.html, service_desc, to_analyze)
|
||||
# self.assertFalse(status)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user