Fix Extension gates by supporting Skip Execption in test case.

The test test_delete_auto_allocated_topology is the only
test in patrole that does a Skip test exception in the test_ method
so I had to add support to the rbac_rule_validation decorator
so the framework would allow the skip exception to be thrown
through the decorator and make it through to the unittest
framework as a skip. Let me know if anyone has a better
way to do this.  I am just trying to get all of the gates running.

FYI I am down to one testing in multinode that is only
supported by system scoped token in Nova so I think that
we will have to wait until tempest supports scope token and
then when patrole support them we should be able to get all
voting gate and non voting gates to work.

https://storyboard.openstack.org/#!/story/2008018

Change-Id: Id8a599c8754dfc10ffa5fa18c232a9afff180a8e
Story: 2008018
Task: 40670
This commit is contained in:
Doug Schveninger 2020-08-17 05:59:35 -05:00
parent 8746b77bfe
commit 89d9ff89fe
1 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,8 @@ from tempest import test
from patrole_tempest_plugin import policy_authority
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import requirements_authority
import testtools
CONF = config.CONF
LOG = logging.getLogger(__name__)
@ -480,6 +482,13 @@ def _validate_override_role_called(test_obj, actual_exception):
if not called:
if actual_exception is not None:
# Use testtools skipException in base TestCase
# to support different skip exceptions used.
# Just return so the skip exception will go up
# the stack and be handled by the unit testing framework
if isinstance(actual_exception,
testtools.testcase.TestCase.skipException):
return
msg = ('Caught exception (%s) but it was raised before the '
'`override_role` context. ' % actual_exception.__class__)
else: