Set policy_opt defaults in placement deploy unit test

Without this change, tests can intermittently fail with NoSuchOptError
when a single process does not have the ConfigFixture running before
this test. This change ensure the opts are registered and defaulted.

Change-Id: I6a4873726e3e7fe0d4db3d1dea61309702b8f24b
Closes-Bug: #1788176
This commit is contained in:
Chris Dent
2018-08-21 16:56:43 +01:00
parent 2b46354d5a
commit f7c5aca3b2

View File

@@ -14,6 +14,7 @@
"""Unit tests for the deply function used to build the Placement service."""
from oslo_config import cfg
from oslo_policy import opts as policy_opts
import testtools
import webob
@@ -34,6 +35,8 @@ class DeployTest(testtools.TestCase):
group='keystone_authtoken')
# ensure that the auth_token middleware is chosen
CONF.set_override('auth_strategy', 'keystone', group='api')
# register and default policy opts (referenced by deploy)
policy_opts.set_defaults(CONF)
app = deploy.deploy(CONF)
req = webob.Request.blank('/resource_providers', method="GET")