← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1520383] Re: Tests that need policy.json can never find it if run in isolation

 

Reviewed:  https://review.openstack.org/278528
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=10773b79ad7e9738ced9afe65071c60d92c8ca55
Submitter: Jenkins
Branch:    master

commit 10773b79ad7e9738ced9afe65071c60d92c8ca55
Author: David Stanek <dstanek@xxxxxxxxxxx>
Date:   Wed Feb 10 16:06:03 2016 +0000

    Moves policy setup into a fixture.
    
    The original implemention worked only because of the ordering of the
    tests. By the time the tests that needed policy.json to be loaded ran it
    had already been properly loaded. When running certain tests in
    isolation the policy is not propertly setup, leading to a test failure.
    
    Closes-Bug: #1520383
    Change-Id: Icd041eb4ed8ddd580f49b4709ca5f05ab7315292


** Changed in: keystone
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1520383

Title:
  Tests that need policy.json can never find it if run in isolation

Status in OpenStack Identity (keystone):
  Fix Released

Bug description:
  I am writing some tests that inherit from RestfulTestCase.  The
  server-side of the calls that the tests make are doing some checks
  that require policy.json to be read in.

  However, it seems as though the file can't ever be found.

  Looking at oslo_config, it searches these directories:

  def _get_config_dirs(project=None):
      """Return a list of directories where config files may be located.

      :param project: an optional project name

      If a project is specified, following directories are returned::

        ~/.${project}/
        ~/
        /etc/${project}/
        /etc/

      Otherwise, these directories::

        ~/
        /etc/
      """

  So basically under $HOME or /etc.  The ConfigOpts.find_file() func
  also looks in any directory specified with the --config-dir option.

  When running the tests, $HOME is set to a temp dir for each and every
  test, and --config-dir is not set at all.  This currently seems to
  make it impossible for policy.json to be ever discovered in test runs.

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1520383/+subscriptions


References