From 0e09bf8ce108f3b4689a57fcbe75865eb6aff0ac Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 28 Oct 2021 15:12:15 +0200 Subject: [PATCH] Don't enforce scopes in the API policies UT temporary There is bug in oslo_policy [1] that caused issues with enforcing scopes properly for rules which inherits from the oslo_policy.BaseCheck class (many of Neutron rules are done like that). Now when fix [2] will be merged in oslo_policy we will need to change expected exception type in some of the policies UT from PolicyNotAuthorized to InvalidScope. For now, to make it working with both old and new oslo_policy, let's disable enforcing scopes in those UT. It will be enabled again when new oslo_policy will be fixed and we will us it in Neutron. [1] https://launchpad.net/bugs/1923503 [2] https://review.opendev.org/c/openstack/oslo.policy/+/804980 Related-Bug: #1923503 Change-Id: I5c64eb9315b37379b0899c9d35f2f0d96f9c1579 --- neutron/tests/unit/conf/policies/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/conf/policies/base.py b/neutron/tests/unit/conf/policies/base.py index 33ed7e9d2c1..74e83b7db5b 100644 --- a/neutron/tests/unit/conf/policies/base.py +++ b/neutron/tests/unit/conf/policies/base.py @@ -29,8 +29,11 @@ class PolicyBaseTestCase(tests_base.BaseTestCase): # That tests are testing only new default policies. cfg.CONF.set_override( 'enforce_new_defaults', True, group='oslo_policy') + # TODO(slaweq): Remove that override once fix + # https://review.opendev.org/c/openstack/oslo.policy/+/804980 will be + # merged and released in oslo_policy cfg.CONF.set_override( - 'enforce_scope', True, group='oslo_policy') + 'enforce_scope', False, group='oslo_policy') super(PolicyBaseTestCase, self).setUp() self.project_id = uuidutils.generate_uuid() self.system_user_id = uuidutils.generate_uuid()