From 89d9ff89fed8f09e5987646b04ccaaa4d34af833 Mon Sep 17 00:00:00 2001 From: Doug Schveninger Date: Mon, 17 Aug 2020 05:59:35 -0500 Subject: [PATCH] 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 --- patrole_tempest_plugin/rbac_rule_validation.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patrole_tempest_plugin/rbac_rule_validation.py b/patrole_tempest_plugin/rbac_rule_validation.py index 288ec293..93c9a1d8 100644 --- a/patrole_tempest_plugin/rbac_rule_validation.py +++ b/patrole_tempest_plugin/rbac_rule_validation.py @@ -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: