blob: 7d2fbac3cae450e7f0947153ca7f139e20669ec0 [file] [log] [blame]
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +00001# Copyright 2014 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.database import base
17from tempest import test
18
19
20class DatabaseLimitsTest(base.BaseDatabaseTest):
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000021
22 @classmethod
23 def resource_setup(cls):
24 super(DatabaseLimitsTest, cls).resource_setup()
25 cls.client = cls.database_limits_client
26
27 @test.attr(type='smoke')
Chris Hoge7579c1a2015-02-26 14:12:15 -080028 @test.idempotent_id('73024538-f316-4829-b3e9-b459290e137a')
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000029 def test_absolute_limits(self):
30 # Test to verify if all absolute limit paramaters are
31 # present when verb is ABSOLUTE
David Kranzb728df72015-02-18 13:40:29 -050032 limits = self.client.list_db_limits()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000033 expected_abs_limits = ['max_backups', 'max_volumes',
34 'max_instances', 'verb']
35 absolute_limit = [l for l in limits
36 if l['verb'] == 'ABSOLUTE']
37 self.assertEqual(1, len(absolute_limit), "One ABSOLUTE limit "
38 "verb is allowed. Fetched %s"
39 % len(absolute_limit))
40 actual_abs_limits = absolute_limit[0].keys()
41 missing_abs_limit = set(expected_abs_limits) - set(actual_abs_limits)
42 self.assertEmpty(missing_abs_limit,
43 "Failed to find the following absolute limit(s)"
44 " in a fetched list: %s" %
45 ', '.join(str(a) for a in missing_abs_limit))