Make os-quota-class-sets test not break quotas

Ib0cde08dfaa0f6a5e180d247864fb59d76eca903 added a test for nova's
os-quota-class-sets API. To test if the default quota is successfully
changed by bumping all quotas with a by a value of 1, and adding locks
around all quota specific API tests to prevent race conditions.

If the quota is unlimited, -1, then the test sets the quota to 0
(-1+1), causing any concurrent attempt to boot an instance (by a
parallel test) to raise the error 'FixedIpLimitExceeded'.

To address the first issue, +100 instead of +1 to the current quotas.
This addresses the immediate gate issue by preventing us from hitting
any quota limits.

Because this is an admin only test, we expect that the blueprint to
run without admin will just skip this in the production cloud case.

Co-Authored-By: Joe Gordon <joe.gordon0@gmail.com>

Change-Id: I7660037eee2e5b04e5dd1dfa779d15cb361cc939
This commit is contained in:
Sean Dague 2014-07-09 07:11:59 -04:00
parent 20fdc88a9e
commit e3e9da70c6
1 changed files with 8 additions and 2 deletions

View File

@ -169,7 +169,10 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
'default', **original_defaults)
self.assertEqual(200, resp.status)
@test.attr(type='gate')
# NOTE(sdague): this test is problematic as it changes
# global state, and possibly needs to be part of a set of
# tests that get run all by themselves at the end under a
# 'danger' flag.
def test_update_default_quotas(self):
LOG.debug("get the current 'default' quota class values")
resp, body = self.adm_client.get_quota_class_set('default')
@ -180,7 +183,10 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.addCleanup(self._restore_default_quotas, body.copy())
# increment all of the values for updating the default quota class
for quota, default in six.iteritems(body):
body[quota] = default + 1
# NOTE(sdague): we need to increment a lot, otherwise
# there is a real chance that we go from -1 (unlimitted)
# to a very small number which causes issues.
body[quota] = default + 100
LOG.debug("update limits for the default quota class set")
resp, update_body = self.adm_client.update_quota_class_set('default',
**body)