From 5c3f5d035015af72da8b0320964f13d3092ac44c Mon Sep 17 00:00:00 2001 From: Sergey Belous Date: Tue, 13 Oct 2015 17:50:05 +0300 Subject: [PATCH] Avoid DuplicateOptError in functional tests Some test require to register options with oslo.Config, but now some of them use global cfg.CONF for it. This can cause the DuplicateOptError if two tests tried to register the same option with different values of config. We should use the oslo_config fixture [1] in functional tests to avoid it. [1] http://git.openstack.org/cgit/openstack/oslo.config/tree/oslo_config/fixture.py Closes-bug: #1505715 Change-Id: I5c2340c0af054dfa78788cbc61dfb1fd9feea535 --- .../tests/functional/agent/l3/test_keepalived_state_change.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/agent/l3/test_keepalived_state_change.py b/neutron/tests/functional/agent/l3/test_keepalived_state_change.py index 8c781129de7..107e59ee4ab 100644 --- a/neutron/tests/functional/agent/l3/test_keepalived_state_change.py +++ b/neutron/tests/functional/agent/l3/test_keepalived_state_change.py @@ -16,6 +16,7 @@ import os import mock from oslo_config import cfg +from oslo_config import fixture as fixture_config from oslo_utils import uuidutils from neutron.agent.l3 import keepalived_state_change @@ -25,7 +26,8 @@ from neutron.tests.functional import base class TestKeepalivedStateChange(base.BaseSudoTestCase): def setUp(self): super(TestKeepalivedStateChange, self).setUp() - cfg.CONF.register_opt( + self.conf_fixture = self.useFixture(fixture_config.Config()) + self.conf_fixture.register_opt( cfg.StrOpt('metadata_proxy_socket', default='$state_path/metadata_proxy', help=_('Location of Metadata Proxy UNIX domain '