← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1520383] [NEW] Tests that need policy.json can never find it

 

Public bug reported:

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.

** Affects: keystone
     Importance: Undecided
         Status: New

-- 
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

Status in OpenStack Identity (keystone):
  New

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


Follow ups