TestTasksDeserializer class not using FakePolicyEnforcer

Bug #1852354 reported by Brian Rosmaita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Brian Rosmaita

Bug Description

This was uncovered by a patch implementing policy-in-code for Glance:
https://review.opendev.org/#/c/693129/

The TestTasksDeserializer class creates a glance.v2.tasks.RequestDeserializer but doesn't pass it a policy_enforcer. As a result, RequestDeserializer uses a real policy enforcer. The default policy in code that's checked by the RequestDeserializer is "tasks_api_access: role:admin", and with that policy in place, all the unit test requests fail. Need to pass the unit test class the FakePolicyEnforcer so that the deserialization can be tested.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

This should be fixed whether or not the policy-in-code patch is accepted, we shouldn't be using the real policy engine in these tests.

Changed in glance:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Brian Rosmaita (brian-rosmaita)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.opendev.org/693952

Changed in glance:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.opendev.org/693952
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=7c85bdcf837da06463dbea0cd5171b1f5b3e726d
Submitter: Zuul
Branch: master

commit 7c85bdcf837da06463dbea0cd5171b1f5b3e726d
Author: Brian Rosmaita <email address hidden>
Date: Tue Nov 12 18:58:23 2019 -0500

    Use FakePolicyEnforcer for deserialization tests

    The tasks unit tests that test the RequestDeserializer
    are using the real policy engine. They should be using
    a mock because we're testing the deserialization, not the
    policies.

    Closes-bug: #1852354

    Change-Id: I35bdacd154b2c8d18ce268a5e6e8aba710e41108

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 20.0.0.0b1

This issue was fixed in the openstack/glance 20.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.