Add API and nova-manage tests that use the NoopQuotaDriver
These are written in preparation for follow up old-style quotas code removal that moves the logic for the 'reserved' field from the quota internals (where it's no longer used) to the API (where it's expected to be provided until we have a new microversion). These tests will help catch any unintended change in behavior. Change-Id: I1f743a8db7d032e09372587622ab64250a05e0f0
This commit is contained in:
parent
51917f46ac
commit
9a89362364
@ -1612,3 +1612,26 @@ class PrivsepNoHelperFixture(fixtures.Fixture):
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'oslo_privsep.daemon.RootwrapClientChannel',
|
||||
UnHelperfulClientChannel))
|
||||
|
||||
|
||||
class NoopQuotaDriverFixture(fixtures.Fixture):
|
||||
"""A fixture to run tests using the NoopQuotaDriver.
|
||||
|
||||
We can't simply set self.flags to the NoopQuotaDriver in tests to use the
|
||||
NoopQuotaDriver because the QuotaEngine object is global. Concurrently
|
||||
running tests will fail intermittently because they might get the
|
||||
NoopQuotaDriver globally when they expected the default DbQuotaDriver
|
||||
behavior. So instead, we can patch the _driver property of the QuotaEngine
|
||||
class on a per-test basis.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(NoopQuotaDriverFixture, self).setUp()
|
||||
self.useFixture(fixtures.MonkeyPatch('nova.quota.QuotaEngine._driver',
|
||||
nova_quota.NoopQuotaDriver()))
|
||||
# Set the config option just so that code checking for the presence of
|
||||
# the NoopQuotaDriver setting will see it as expected.
|
||||
# For some reason, this does *not* work when TestCase.flags is used.
|
||||
# When using self.flags, the concurrent test failures returned.
|
||||
CONF.set_override('driver', 'nova.quota.NoopQuotaDriver', 'quota')
|
||||
self.addCleanup(CONF.clear_override, 'driver', 'quota')
|
||||
|
Loading…
x
Reference in New Issue
Block a user