Use config fixture to avoid racing on self.flags()

Previously self.flags() set options on the global CONF singleton. This
created races where a test running in parallel would end up with
a flag value intended for another test. By using the fixture we scope
self.flags() to each individual test.

Change-Id: Id317e4b86cf7e66172040c23dc3ccf96e820204a
This commit is contained in:
Artom Lifshitz 2019-02-07 16:42:18 +00:00
parent decd570b53
commit 69492a6b67

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import fixture as config_fixture
from oslotest import base
from tempest import config
@ -20,6 +21,10 @@ CONF = config.CONF
class WhiteboxPluginTestCase(base.BaseTestCase):
def setUp(self):
super(WhiteboxPluginTestCase, self).setUp()
self.useFixture(config_fixture.Config(CONF))
def flags(self, **kw):
"""Override flag variables for a test."""
group = kw.pop('group', None)