ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 1 | # 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 | |
| 16 | from tempest.api.database import base |
| 17 | from tempest import test |
| 18 | |
| 19 | |
| 20 | class DatabaseLimitsTest(base.BaseDatabaseTest): |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 21 | |
| 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 Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 28 | @test.idempotent_id('73024538-f316-4829-b3e9-b459290e137a') |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 29 | def test_absolute_limits(self): |
| 30 | # Test to verify if all absolute limit paramaters are |
| 31 | # present when verb is ABSOLUTE |
David Kranz | b728df7 | 2015-02-18 13:40:29 -0500 | [diff] [blame] | 32 | limits = self.client.list_db_limits() |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 33 | 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)) |