OTS 0.1 has 2 ways of handling error information. The testrun has a specific "set_error_info() and set_error_code()" mechanism for critical errors. This is the main mechanism. In addition to that error messages are printed to http log. The error info mechanism is a legacy thing from the old days we didn't have global http logging or amqp.
In OTS 0.8 we have the same http logging. The set_error_info() stuff is gone but it is replaced by exceptions that can be sent over the wire with amqp.
These cause the testrun to end with result ERROR
self.testrun.set_error_info("No test packages defined nor found.")
self.testrun.set_error_info("Results missing from: %s" \
try:
return ots_config.default_options[sw_product]
except (KeyError, ValueError):
raise Exception("Unknown sw_product %s" % sw_product)
for package in test_packages:
if not (package.endswith("-tests")\
or package.endswith("-test")\
or package.endswith("-benchmark")):
invalid_packages.append(package)
if not (self.testrun.get_rootstrap_url() \
or self.testrun.get_image_url()):
if not self.testrun.get_image_url() and \
self.testrun.get_host_testpackages():
error_msg = "Image url missing. Executing host based tests "+\
"requires image url."
valid_values = ['default', 'perpackage']
for model in custom_models:
valid_values.append(model[0])
model = self.testrun.get_option('distribution_model')
if model not in valid_values:
if model == 'perpackage' and len(self.testrun.get_testpackages()) == 0:
error_msg = "Test packages must be defined for specified "\
+"distribution model '%s'" % model
except OtsQueueDoesNotExistError:
error_info = "Queue '%s' does not exist" \
% (self._routing_key)
error_info = ("Server side timeout. (Worker went offline during "+\
"testrun or some tasks were not started in time)")
except OtsConnectionError:
error_info = "A connectivity issue was encountered"
except OtsQueueTimeoutError, exception:
error_info = ("The job was not started within %s minutes. "+\
"A worker in that devicegroup may be down or there may be "+\
"exceptional demand") % str(exception.timeout_length / 60)
except Exception:
error_info = "A miscellaneous error was encountered"
def _test_execution_error_handler(self, error_info, error_code):
"""
Handler for testrun timed out errors and ConductorError exceptions
that are raised during test execution.
"""
self.log.error("Test execution error: %s " % error_info)
if not self.stand_alone:
self.responseclient.set_error(error_info, error_code)
except ConductorError, exc:
log.error("%s (ots error code: %s)" % (exc.error_info, exc.error_code))
if not stand_alone:
responseclient.set_error(exc.error_info, exc.error_code)
except:
log.error("Unknown error when trying to execute tests.")
log.error("Traceback follows:", exc_info = True)
if not stand_alone:
responseclient.set_error(str(sys.exc_info()[1]), "999")
try:
self._dispatch(command)
except (CommandFailed):
LOGGER.error("Process failed")
error_info = "Task execution failed"
These produce an error message to log but do not affect the testrun result. These should be warnings.
try:
if not ots_config.debug_mode:
for text, url in self.testrun.get_result_links():
self.input_plugin.store_url(url, text)
except:
self.log.error("Publishing result url failed. "\
"Traceback follows:", exc_info = True)
try:
if self.testrun.email_enabled() and self.emailbackend:
self.emailbackend.send_mail()
self.log.error("Sending result email failed. Traceback follows:",
self.log.info("Publishing testrun log link")
try:
if not ots_config.debug_mode:
self.input_plugin.store_url(url, text)
except:
self.log.error("Publishing testrun log link failed. "\
"Traceback follows:", exc_info = True)
try:
target_packages = self.input_plugin.get_changed_packages(build_id)
except:
self.log.error("Getting target packages failed. "\
"Traceback follows:", exc_info = True)
target_packages = []
try:
attach_as_zip_file(msg, result_files, unique_id)
except:
LOG.error("Something went wrong when creating email attachment. "\
"Traceback follows:", exc_info = True)
if not (type(to_address_list) == type(list()) \
or type(to_address_list) == type("")):
self.log.error("Error in sending mail: expected list or string in "\
"to_address_list: %s " % str(to_address_list))
return
self.log.error("Error in sending mail to following addresses:")
self.log.error(str(failed_addresses))
LOG.error("Upload failed. Server returned: %s" % response)