Set policy_opt defaults in placement gabbi fixture

Without this change, tests can intermittently fail with NoSuchOptError
when a single process does not have other tests running prior to
gabbi tests. This change ensure the opts are registered and defaulted.

Change-Id: I1c7e347b6e788928bef96e32c3365d0fdc5ba00f
Related-Bug: #1786498
Closes-Bug: #1788176
This commit is contained in:
Chris Dent
2018-08-21 14:23:41 +01:00
parent 722d5b4772
commit 2b46354d5a

View File

@@ -16,6 +16,7 @@ from gabbi import fixture
from oslo_config import cfg from oslo_config import cfg
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_middleware import cors from oslo_middleware import cors
from oslo_policy import opts as policy_opts
from oslo_utils import uuidutils from oslo_utils import uuidutils
from oslotest import output from oslotest import output
@@ -75,6 +76,9 @@ class APIFixture(fixture.GabbiFixture):
# deploy.py. Without setting some config the group will not # deploy.py. Without setting some config the group will not
# be present. # be present.
CONF.register_opts(cors.CORS_OPTS, 'cors') CONF.register_opts(cors.CORS_OPTS, 'cors')
# Set default policy opts, otherwise the deploy module can
# NoSuchOptError.
policy_opts.set_defaults(CONF)
# Make sure default_config_files is an empty list, not None. # Make sure default_config_files is an empty list, not None.
# If None /etc/nova/nova.conf is read and confuses results. # If None /etc/nova/nova.conf is read and confuses results.