Automate generation of quotas api-ref samples

This patch adds the following tests:
1) quota sets
2) quota classes

Change-Id: Ie52071c0b69b49eee340ebf4b06446e824c4b5fe
Partially-Implements: blueprint generating-sample-files
This commit is contained in:
whoami-rajat 2019-09-30 11:44:32 +05:30
parent 66638a0e78
commit de3f8e2bff
24 changed files with 354 additions and 136 deletions

View File

@ -60,7 +60,7 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quota-classes-show-response.json
.. literalinclude:: ./samples/quota_classes/quota-classes-show-response.json
:language: javascript
Update quota classes for a project
@ -103,7 +103,7 @@ Request
Request Example
---------------
.. literalinclude:: ./samples/quota-classes-update-request.json
.. literalinclude:: ./samples/quota_classes/quota-classes-update-request.json
:language: javascript
@ -127,5 +127,5 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quota-classes-update-response.json
.. literalinclude:: ./samples/quota_classes/quota-classes-update-response.json
:language: javascript

View File

@ -55,7 +55,7 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quotas-show-response.json
.. literalinclude:: ./samples/quota_sets/quotas-show-response.json
:language: javascript
@ -106,7 +106,7 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quotas-show-usage-response.json
.. literalinclude:: ./samples/quota_sets/quotas-show-usage-response.json
:language: javascript
@ -149,7 +149,7 @@ Request
Request Example
---------------
.. literalinclude:: ./samples/quotas-update-request.json
.. literalinclude:: ./samples/quota_sets/quotas-update-request.json
:language: javascript
@ -173,7 +173,7 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quotas-update-response.json
.. literalinclude:: ./samples/quota_sets/quotas-update-response.json
:language: javascript
Delete quotas for a project
@ -248,7 +248,7 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/quotas-show-defaults-response.json
.. literalinclude:: ./samples/quota_sets/quotas-show-defaults-response.json
:language: javascript

View File

@ -0,0 +1,15 @@
{
"quota_class_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "test_class",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,7 @@
{
"quota_class_set": {
"volumes": 10,
"gigabytes": 1000,
"snapshots": 10
}
}

View File

@ -0,0 +1,14 @@
{
"quota_class_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,15 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "fake_tenant",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,15 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "fake_tenant",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,55 @@
{
"quota_set": {
"backup_gigabytes": {
"in_use": 0,
"limit": 1000,
"reserved": 0
},
"backups": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"gigabytes": {
"in_use": 0,
"limit": 1000,
"reserved": 0
},
"gigabytes___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"groups": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"id": "fake_tenant",
"per_volume_gigabytes": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"snapshots": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"snapshots___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"volumes": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"volumes___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
}
}
}

View File

@ -2,7 +2,6 @@
"quota_set":{
"groups": 11,
"volumes": 5,
"volumes_ceph": 3,
"backups": 4
}
}

View File

@ -0,0 +1,14 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 4,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 11,
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 5,
"volumes___DEFAULT__": -1
}
}

View File

@ -1,21 +0,0 @@
{
"quota_set": {
"id": "a7090a26bc554d93aa845a4d41808251",
"volumes": 10,
"volumes_ceph": -1,
"volumes_lvm-thin": -1,
"volumes_lvmdriver-1": -1,
"snapshots": 10,
"snapshots_ceph": -1,
"snapshots_lvm-thin": -1,
"snapshots_lvmdriver-1": -1,
"backups": 10,
"groups": 10,
"per_volume_gigabytes": -1,
"gigabytes": 1000,
"gigabytes_ceph": -1,
"gigabytes_lvm-thin": -1,
"gigabytes_lvmdriver-1": -1,
"backup_gigabytes": 1000
}
}

View File

@ -1,21 +0,0 @@
{
"quota_set": {
"id": "a7090a26bc554d93aa845a4d41808251",
"volumes": 10,
"volumes_ceph": -1,
"volumes_lvm-thin": -1,
"volumes_lvmdriver-1": -1,
"snapshots": 10,
"snapshots_ceph": -1,
"snapshots_lvm-thin": -1,
"snapshots_lvmdriver-1": -1,
"backups": 10,
"groups": 10,
"per_volume_gigabytes": -1,
"gigabytes": 1000,
"gigabytes_ceph": -1,
"gigabytes_lvm-thin": -1,
"gigabytes_lvmdriver-1": -1,
"backup_gigabytes": 1000
}
}

View File

@ -1,65 +0,0 @@
{
"quota_set": {
"id": "a7090a26bc554d93aa845a4d41808251",
"volumes": {
"reserved": 0,
"allocated": 0,
"limit": 10,
"in_use": 0
},
"volumes_lvmdriver-1": {
"reserved": 0,
"allocated": 0,
"limit": -1,
"in_use": 0
},
"snapshots": {
"reserved": 0,
"allocated": 0,
"limit": 10,
"in_use": 0
},
"snapshots_lvmdriver-1": {
"reserved": 0,
"allocated": 0,
"limit": -1,
"in_use": 0
},
"backups": {
"reserved": 0,
"allocated": 0,
"limit": 10,
"in_use": 0
},
"groups": {
"reserved": 0,
"allocated": 0,
"limit": 10,
"in_use": 0
},
"per_volume_gigabytes": {
"reserved": 0,
"allocated": 0,
"limit": -1,
"in_use": 0
},
"gigabytes": {
"reserved": 0,
"allocated": 0,
"limit": 1000,
"in_use": 0
},
"gigabytes_lvmdriver-1": {
"reserved": 0,
"allocated": 0,
"limit": 1000,
"in_use": 0
},
"backup_gigabytes": {
"reserved": 0,
"allocated": 0,
"limit": 1000,
"in_use": 0
}
}
}

View File

@ -1,20 +0,0 @@
{
"quota_set": {
"volumes": 10,
"volumes_ceph": -1,
"volumes_lvm-thin": -1,
"volumes_lvmdriver-1": -1,
"snapshots": 10,
"snapshots_ceph": -1,
"snapshots_lvm-thin": -1,
"snapshots_lvmdriver-1": -1,
"backups": 10,
"groups": 10,
"per_volume_gigabytes": -1,
"gigabytes": 1000,
"gigabytes_ceph": -1,
"gigabytes_lvm-thin": -1,
"gigabytes_lvmdriver-1": -1,
"backup_gigabytes": 1000
}
}

View File

@ -0,0 +1,15 @@
{
"quota_class_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "test_class",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,7 @@
{
"quota_class_set": {
"volumes": 10,
"gigabytes": 1000,
"snapshots": 10
}
}

View File

@ -0,0 +1,14 @@
{
"quota_class_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,15 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "fake_tenant",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,15 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 10,
"id": "fake_tenant",
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 10,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,55 @@
{
"quota_set": {
"backup_gigabytes": {
"in_use": 0,
"limit": 1000,
"reserved": 0
},
"backups": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"gigabytes": {
"in_use": 0,
"limit": 1000,
"reserved": 0
},
"gigabytes___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"groups": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"id": "fake_tenant",
"per_volume_gigabytes": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"snapshots": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"snapshots___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
},
"volumes": {
"in_use": 0,
"limit": 10,
"reserved": 0
},
"volumes___DEFAULT__": {
"in_use": 0,
"limit": -1,
"reserved": 0
}
}
}

View File

@ -0,0 +1,7 @@
{
"quota_set":{
"groups": 11,
"volumes": 5,
"backups": 4
}
}

View File

@ -0,0 +1,14 @@
{
"quota_set": {
"backup_gigabytes": 1000,
"backups": 4,
"gigabytes": 1000,
"gigabytes___DEFAULT__": -1,
"groups": 11,
"per_volume_gigabytes": -1,
"snapshots": 10,
"snapshots___DEFAULT__": -1,
"volumes": 5,
"volumes___DEFAULT__": -1
}
}

View File

@ -0,0 +1,31 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from cinder.tests.functional.api_sample_tests import test_volumes
class QuotaClassesSampleJsonTest(test_volumes.VolumesSampleBase):
sample_dir = "quota_classes"
def setUp(self):
super(QuotaClassesSampleJsonTest, self).setUp()
def test_quota_classes_show(self):
response = self._do_get('os-quota-class-sets/test_class')
self._verify_response('quota-classes-show-response', {},
response, 200)
def test_quotas_update(self):
response = self._do_put('os-quota-class-sets/test_class',
'quota-classes-update-request')
self._verify_response('quota-classes-update-response', {},
response, 200)

View File

@ -0,0 +1,38 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from cinder.tests.functional.api_sample_tests import test_volumes
class QuotaSetsSampleJsonTest(test_volumes.VolumesSampleBase):
sample_dir = "quota_sets"
def setUp(self):
super(QuotaSetsSampleJsonTest, self).setUp()
def test_quotas_show(self):
response = self._do_get('os-quota-sets/fake_tenant')
self._verify_response('quotas-show-response', {}, response, 200)
def test_quotas_show_usage(self):
response = self._do_get('os-quota-sets/fake_tenant?usage=True')
self._verify_response('quotas-show-usage-response', {}, response, 200)
def test_quotas_update(self):
response = self._do_put('os-quota-sets/fake_tenant',
'quotas-update-request')
self._verify_response('quotas-update-response', {}, response, 200)
def test_quotas_defaults(self):
response = self._do_get('os-quota-sets/fake_tenant/defaults')
self._verify_response('quotas-show-defaults-response',
{}, response, 200)