bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 1 | # Copyright 2016 OpenStack Foundation |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
| 16 | from tempest.api.volume import base |
| 17 | from tempest import config |
Ken'ichi Ohmichi | 6b279c7 | 2017-01-27 18:26:59 -0800 | [diff] [blame] | 18 | from tempest.lib import decorators |
bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 19 | |
| 20 | |
| 21 | CONF = config.CONF |
| 22 | |
| 23 | |
Ken'ichi Ohmichi | e8afb8c | 2017-03-27 11:25:37 -0700 | [diff] [blame] | 24 | class AbsoluteLimitsTests(base.BaseVolumeTest): |
bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 25 | |
zhufl | f57132a | 2016-12-16 11:51:52 +0800 | [diff] [blame] | 26 | # avoid existing volumes of pre-defined tenant |
| 27 | force_tenant_isolation = True |
| 28 | |
bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 29 | @classmethod |
| 30 | def resource_setup(cls): |
Ken'ichi Ohmichi | e8afb8c | 2017-03-27 11:25:37 -0700 | [diff] [blame] | 31 | super(AbsoluteLimitsTests, cls).resource_setup() |
bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 32 | # Create a shared volume for tests |
| 33 | cls.volume = cls.create_volume() |
| 34 | |
Ken'ichi Ohmichi | 6b279c7 | 2017-01-27 18:26:59 -0800 | [diff] [blame] | 35 | @decorators.idempotent_id('8e943f53-e9d6-4272-b2e9-adcf2f7c29ad') |
bkopilov | 1419308 | 2016-05-31 10:01:28 +0300 | [diff] [blame] | 36 | def test_get_volume_absolute_limits(self): |
| 37 | # get volume limit for a tenant |
| 38 | absolute_limits = \ |
| 39 | self.volume_limits_client.show_limits( |
| 40 | )['limits']['absolute'] |
| 41 | |
| 42 | # verify volume limits and defaults per tenants |
| 43 | self.assertEqual(absolute_limits['totalGigabytesUsed'], |
| 44 | CONF.volume.volume_size) |
| 45 | self.assertEqual(absolute_limits['totalVolumesUsed'], 1) |
| 46 | self.assertEqual(absolute_limits['totalSnapshotsUsed'], 0) |
| 47 | self.assertEqual(absolute_limits['totalBackupsUsed'], 0) |
| 48 | self.assertEqual(absolute_limits['totalBackupGigabytesUsed'], 0) |