Policy testing checks could be simplified in test_v3_filters

Bug #1271273 reported by Henry Nash
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Wishlist
Adam Young

Bug Description

test_v3_filters resets the policy file repeatedly to perform its various checks. Usinf the current code, if you do this within a given test more than once it seems to break, leading to more complex test code. E.g.:

        # TODO(henry-nash) Ideally the policy setting would happen in the
        # entity for-loop below, using a string substitution of 'plural'.
        # However, that appears to lead to unreliable policy checking - i.e.
        # multiple calls to _set_policy doesn't work properly.

        self._set_policy({"identity:list_users": [],
                          "identity:list_groups": [],
                          "identity:list_projects": [])

        for entity in ['user', 'group', 'project']:
              Do some action that needs the policy above for that type of entity

whereas it would be better to reset the policy every time in the loop.

Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: test-improvement
Changed in keystone:
assignee: nobody → Konstantin Maximov (konstantin-maximov)
Changed in keystone:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/156597

Changed in keystone:
assignee: Konstantin Maximov (konstantin-maximov) → Adam Young (ayoung)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/156597
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=9c797ef41cbe13aa826e9e170628725b6c090e40
Submitter: Jenkins
Branch: master

commit 9c797ef41cbe13aa826e9e170628725b6c090e40
Author: Konstantin Maximov <email address hidden>
Date: Tue Feb 17 16:41:24 2015 +0300

    Improved policy setting in the 'v3 filter' tests

    The test case class IdentityTestListLimitCase (test_v3_filters.py)
    always sets multiple policies for the each test defined in that class.
    However, only one policy is really needed for each test case.
    That appears to lead to unreliable policy checking.
    It would be better to set only one policy required for the particular
    test case (policy with the type of entity used in the test case).

    Change-Id: I7892950b43c56ecce03677d8d592e71359bedf27
    Closes-Bug: #1271273

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → kilo-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: kilo-rc1 → 2015.1.0
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.