A test may not call the base class setup so may be missing
run_resource_cleanup in which case teardown will fail. Guard against
that and default to False.
Add support for tests having a resource_cleanup method. Whether this
is run or not is dictated by the class variable
'run_resource_cleanup'. By default this will be True but any test
can switch it to False so that resources created by the tests are
preserved. Helpful for debugging failures.
FWIW future work might include automatically disabling resource
cleanup if a test fail is detected.
resource_removed is used in many places to monitor removal of
different kinds of OpenStack resource. It is reasonable to expect a
flavor to be removed in a few seconds where as an image based instance
may take minutes to be removed. With that in mind this change
exposes the retry options used by tenacity allowing the caller to
set reasonable expectations for the resource removal.
The restart_on_changed helper was moved to use the config_change
context manager but the code that checks that the config file is
correctly reverted at the end of the test was accidently left within
the context.