Merge "Add cinder-update-and-delete quotas scenario"

This commit is contained in:
Jenkins 2014-08-25 14:50:45 +00:00 committed by Gerrit Code Review
commit 62790692a9
6 changed files with 67 additions and 2 deletions

View File

@ -0,0 +1,20 @@
{
"Quotas.cinder_update_and_delete": [
{
"args": {
"max_quota": 1024
},
"runner": {
"type": "constant",
"times": 10,
"concurrency": 2
},
"context": {
"users": {
"tenants": 3,
"users_per_tenant": 2
}
}
}
]
}

View File

@ -0,0 +1,13 @@
---
Quotas.cinder_update_and_delete:
-
args:
max_quota: 1024
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 3
users_per_tenant: 2

View File

@ -470,6 +470,21 @@
sla:
max_failure_percent: 0
Quotas.cinder_update_and_delete:
-
args:
max_quota: 1024
runner:
type: "constant"
times: 4
concurrency: 1
context:
users:
tenants: 3
users_per_tenant: 2
sla:
max_failure_percent: 0
Quotas.cinder_update:
-
args:

View File

@ -65,9 +65,8 @@ def delete_images(glance, project_uuid):
def delete_quotas(admin_clients, project_uuid):
# TODO(yingjun): We need to add the cinder part for deleting
# quotas when the new cinderclient released.
admin_clients.nova().quotas.delete(project_uuid)
admin_clients.cinder().quotas.delete(project_uuid)
def delete_stacks(heat):

View File

@ -47,3 +47,13 @@ class Quotas(utils.QuotasScenario):
"""
tenant_id = self.context()["user"]["tenant_id"]
self._update_quotas('cinder', tenant_id, max_quota)
@base.scenario(admin_only=True, context={"admin_cleanup": ["quotas"]})
def cinder_update_and_delete(self, max_quota=1024):
"""Tests updating and deleting quotas for cinder.
:param max_quota: Max value to be updated for quota.
"""
tenant_id = self.context()["user"]["tenant_id"]
self._update_quotas('cinder', tenant_id, max_quota)
self._delete_quotas('cinder', tenant_id)

View File

@ -40,3 +40,11 @@ class QuotasTestCase(test.TestCase):
scenario._update_quotas = mock.MagicMock()
scenario.cinder_update(max_quota=1024)
scenario._update_quotas.assert_called_once_with('cinder', 'fake', 1024)
def test_cinder_update_and_delete(self):
scenario = quotas.Quotas(context={"user": {"tenant_id": "fake"}})
scenario._update_quotas = mock.MagicMock()
scenario._delete_quotas = mock.MagicMock()
scenario.cinder_update_and_delete(max_quota=1024)
scenario._update_quotas.assert_called_once_with('cinder', 'fake', 1024)
scenario._delete_quotas.assert_called_once_with('cinder', 'fake')