Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 2 | |
| 3 | # Copyright 2012 OpenStack, LLC |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 7 | # not use this file except in compliance with the License. You may obtain |
| 8 | # a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 15 | # License for the specific language governing permissions and limitations |
| 16 | # under the License. |
| 17 | |
Chris Yeoh | 9465b0b | 2013-02-09 22:19:15 +1030 | [diff] [blame] | 18 | from tempest.test import attr |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 19 | from tempest.tests.compute import base |
Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 20 | |
| 21 | |
Attila Fazekas | 19044d5 | 2013-02-16 07:35:06 +0100 | [diff] [blame^] | 22 | class QuotasTestJSON(base.BaseComputeTest): |
| 23 | _interface = 'json' |
Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 24 | |
| 25 | @classmethod |
| 26 | def setUpClass(cls): |
Attila Fazekas | 19044d5 | 2013-02-16 07:35:06 +0100 | [diff] [blame^] | 27 | super(QuotasTestJSON, cls).setUpClass() |
Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 28 | cls.client = cls.quotas_client |
| 29 | cls.admin_client = cls._get_identity_admin_client() |
| 30 | resp, tenants = cls.admin_client.list_tenants() |
| 31 | cls.tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] == |
| 32 | cls.client.tenant_name][0] |
| 33 | |
| 34 | @attr(type='smoke') |
| 35 | def test_get_default_quotas(self): |
Sean Dague | 4dd2c0b | 2013-01-03 17:50:28 -0500 | [diff] [blame] | 36 | # User can get the default quota set for it's tenant |
Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 37 | expected_quota_set = {'injected_file_content_bytes': 10240, |
| 38 | 'metadata_items': 128, 'injected_files': 5, |
| 39 | 'ram': 51200, 'floating_ips': 10, |
| 40 | 'key_pairs': 100, |
| 41 | 'injected_file_path_bytes': 255, 'instances': 10, |
| 42 | 'security_group_rules': 20, 'cores': 20, |
| 43 | 'id': self.tenant_id, 'security_groups': 10} |
| 44 | try: |
| 45 | resp, quota_set = self.client.get_quota_set(self.tenant_id) |
| 46 | self.assertEqual(200, resp.status) |
Michael J Fork | ba49e4e | 2013-02-07 21:21:14 +0000 | [diff] [blame] | 47 | self.assertEqual(expected_quota_set, quota_set) |
Matthew Treinish | 05d9fb9 | 2012-12-07 16:14:05 -0500 | [diff] [blame] | 48 | except Exception: |
Rohit Karajgi | 07599c5 | 2012-11-02 05:35:16 -0700 | [diff] [blame] | 49 | self.fail("Quota set for tenant did not have default limits") |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 50 | |
| 51 | |
Attila Fazekas | 19044d5 | 2013-02-16 07:35:06 +0100 | [diff] [blame^] | 52 | class QuotasTestXML(QuotasTestJSON): |
| 53 | _interface = 'xml' |