blob: 836e489c55c1ded57d794a1bf6a43d31594cac36 [file] [log] [blame]
bkopilov14193082016-05-31 10:01:28 +03001# 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
16from tempest.api.volume import base
17from tempest import config
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080018from tempest.lib import decorators
bkopilov14193082016-05-31 10:01:28 +030019
20
21CONF = config.CONF
22
23
Ken'ichi Ohmichie8afb8c2017-03-27 11:25:37 -070024class AbsoluteLimitsTests(base.BaseVolumeTest):
bkopilov14193082016-05-31 10:01:28 +030025
zhuflf57132a2016-12-16 11:51:52 +080026 # avoid existing volumes of pre-defined tenant
27 force_tenant_isolation = True
28
bkopilov14193082016-05-31 10:01:28 +030029 @classmethod
30 def resource_setup(cls):
Ken'ichi Ohmichie8afb8c2017-03-27 11:25:37 -070031 super(AbsoluteLimitsTests, cls).resource_setup()
bkopilov14193082016-05-31 10:01:28 +030032 # Create a shared volume for tests
33 cls.volume = cls.create_volume()
34
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080035 @decorators.idempotent_id('8e943f53-e9d6-4272-b2e9-adcf2f7c29ad')
bkopilov14193082016-05-31 10:01:28 +030036 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)