Commit abce5180 authored by Jérome Perrin's avatar Jérome Perrin

testing/testcase: don't destroy instance if it was not requested

This should prevent such confusing tracebacks when building software fail:

    INFO Finished software releases.
    ERROR:slapos.testing.testcase:Error during request destruction
    Traceback (most recent call last):
      File "parts/slapos.core-repository/slapos/testing/testcase.py", line 615, in _cleanup
	cls.requestDefaultInstance(state='destroyed')
      File "parts/slapos.core-repository/slapos/testing/testcase.py", line 680, in requestDefaultInstance
	cls._instance_parameter_dict)
    AttributeError: type object 'SlapOSInstanceTestCase for ...' has no attribute '_instance_parameter_dict'
parent fa0ebacf
......@@ -611,7 +611,8 @@ class SlapOSInstanceTestCase(unittest.TestCase):
Catches and log all exceptions and take snapshot named `snapshot_name` + the failing step.
"""
try:
cls.requestDefaultInstance(state='destroyed')
if hasattr(cls, '_instance_parameter_dict'):
cls.requestDefaultInstance(state='destroyed')
except:
cls.logger.exception("Error during request destruction")
cls._storeSystemSnapshot(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment