blob: 35e0d56d8766d9b2ba0ab0e463173792f7d2417e [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
18from tempest import test
19
20
21CONF = config.CONF
22
23
24class AbsoluteLimitsV2Tests(base.BaseVolumeTest):
25
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):
31 super(AbsoluteLimitsV2Tests, cls).resource_setup()
32 # Create a shared volume for tests
33 cls.volume = cls.create_volume()
34
35 @test.idempotent_id('8e943f53-e9d6-4272-b2e9-adcf2f7c29ad')
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)
49
50
51class AbsoluteLimitsV1Tests(AbsoluteLimitsV2Tests):
52 _api_version = 1