Ignore UserWarning for scope checks during test runs

Keystone's API policy rules are defaulting to system scope. Scope checks
are disabled by default in oslo.policy, but if you hit the API with a
token that doesn't match the scope, it generates a UserWarning, for
every policy check on that request. This is pretty annoying, so just
filter those warnings during our test runs.

Change-Id: I150b8fa19d4ec1582234caa4c25db905e6403590
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2022-06-17 12:04:20 +01:00
parent 7c2d0f589c
commit 30fa47f98a
1 changed files with 17 additions and 0 deletions

View File

@ -35,6 +35,23 @@ class WarningsFixture(fixtures.Fixture):
module='^keystone\\.',
)
warnings.filterwarnings(
'ignore',
message=(
'Policy enforcement is depending on the value of '
'(token|group_ids). '
'This key is deprecated. Please update your policy '
'file to use the standard policy values.'
),
)
# NOTE(stephenfin): Ignore scope check UserWarnings from oslo.policy.
warnings.filterwarnings(
'ignore',
message="Policy .* failed scope check",
category=UserWarning,
)
# TODO(stephenfin): This will be fixed once we drop sqlalchemy-migrate
warnings.filterwarnings(
'ignore',