Do not crash when a check does not provide result
ClosedPublic

Authored by mkrizek on Jan 14 2016, 3:14 PM.

Details

Summary
[libtaskotron] 14:21:18 CRITICAL Traceback (most recent call last):
  File "runtask.py", line 10, in <module>
    main.main()
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/main.py", line 151, in main
    overlord.start()
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/overlord.py", line 95, in start
    runner.execute()
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/executor.py", line 56, in execute
    self._run()
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/executor.py", line 93, in _run
    self._do_actions()
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/executor.py", line 131, in _do_actions
    self._do_single_action(action)
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/executor.py", line 152, in _do_single_action
    self.arg_data)
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/directives/resultsdb_directive.py", line 193, in process
    check_details = check.import_YAML(input_data['results'])
  File "/home/mkrizek/devel/libtaskotron/libtaskotron/check.py", line 332, in import_YAML
    data = yaml.safe_load(source)
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/__init__.py", line 93, in safe_load
    return load(stream, SafeLoader)
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/__init__.py", line 69, in load
    loader = Loader(stream)
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/loader.py", line 24, in __init__
    Reader.__init__(self, stream)
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/reader.py", line 124, in determine_encoding
    self.update_raw()
  File "/home/mkrizek/devel/libtaskotron/env_taskotron/lib/python2.7/site-packages/yaml/reader.py", line 178, in update_raw
    data = self.stream.read(size)
AttributeError: 'NoneType' object has no attribute 'read'
Test Plan

Run a check that does not provide check detail - like the example in Writing tasks section in docs.

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mkrizek retitled this revision from to Do not crash when a check does not provide result.Jan 14 2016, 3:14 PM
mkrizek updated this object.
mkrizek edited the test plan for this revision. (Show Details)
mkrizek added reviewers: tflink, kparal, jskladan.
tflink accepted this revision.Jan 14 2016, 3:21 PM
This revision is now accepted and ready to land.Jan 14 2016, 3:21 PM
mkrizek updated this revision to Diff 1858.Jan 14 2016, 3:45 PM

Add unittest

Thanks for adding the test. Still looks good to me

/me puts "look at test coverage" on his TODO list for the not-so-distant future

This revision was automatically updated to reflect the committed changes.