Tests that need policy.json can never find it if run in isolation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Fix Released
|
High
|
David Stanek |
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_
"""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::
~
~/
/
/etc/
Otherwise, these directories::
~/
/etc/
"""
So basically under $HOME or /etc. The ConfigOpts.
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.
Changed in keystone: | |
assignee: | nobody → David Stanek (dstanek) |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in keystone: | |
milestone: | none → mitaka-3 |
Snippet from the server-side traceback:
File "keystone/ common/ wsgi.py" , line 329, in assert_admin policy_ api.enforce( creds, 'admin_required', {}) policy/ backends/ rules.py" , line 77, in enforce credentials, action, target) policy/ backends/ rules.py" , line 69, in enforce enforce( action, target, credentials, **extra) juledwar/ mcopenstack/ keystone/ .tox/debug/ local/lib/ python2. 7/site- packages/ oslo_policy/ policy. py", line 488, in enforce load_rules( ) juledwar/ mcopenstack/ keystone/ .tox/debug/ local/lib/ python2. 7/site- packages/ oslo_policy/ policy. py", line 393, in load_rules policy_ path = self._get_ policy_ path(self. policy_ file) juledwar/ mcopenstack/ keystone/ .tox/debug/ local/lib/ python2. 7/site- packages/ oslo_policy/ policy. py", line 461, in _get_policy_path NotFoundError( (path,) ) oundError: Failed to find some config files: policy.json
self.
File "keystone/
enforce(
File "keystone/
return _ENFORCER.
File "/home/
self.
File "/home/
self.
File "/home/
raise cfg.ConfigFiles
ConfigFilesNotF