[ostf] Improve logging in OSTF tests

Bug #1258501 reported by Vladimir Kuklin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
Medium
Tatyanka

Bug Description

Currently, traceback of failed OSTF tests is lost because of incorrect raising of exceptions and use of logging.

We need to use traceback python module in all logging cases and also pass exception information to wrapper methods, e.g. 'fail' method, which sends fail message:

    def fail(self, msg=None):
        """Fail immediately, with the given message."""
        raise self.failureException(msg)

This one should also receive traceback from upper exception and log this information. Otherwise, we only have information that an error happened and no traceback.

E.g.:
       except Exception as exc:
            cls.error_msg.append(exc)
            LOG.debug(exc)
 ...

       except Exception as exc:
            cls.error_msg.append(exc)
            LOG.debug(traceback.format_exc())

except Exception as e:
    exc_type, exc_value, exc_tb = sys.exc_info()
    exc_info=traceback.format_exception(exc_type, exc_value, exc_tb)
    self.fail(msg,exc_info)
    ....
    def fail(self, msg=None, exc_info=None):
        """Fail immediately, with the given message."""
        raise self.failureException(msg)

Tags: ostf
Changed in fuel:
status: New → Confirmed
importance: Undecided → Medium
Mike Scherbakov (mihgen)
Changed in fuel:
milestone: none → 4.0
Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
Tatyanka (tatyana-leontovich) wrote :

add traceback.fornat_exc() in logging. As about self.fail - do not agree to change it, according we show on UI all data that we push in fail() method

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Tatyanka (tatyana-leontovich) wrote :
Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.