Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 1 | # Copyright 2015 NEC Corporation. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Ken'ichi Ohmichi | 50f8295 | 2015-09-14 17:04:46 +0000 | [diff] [blame] | 15 | from tempest_lib.tests import fake_auth_provider |
| 16 | |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 17 | from tempest.services.compute.json import limits_client |
Marc Koderer | db19acd | 2015-09-03 16:03:58 +0200 | [diff] [blame] | 18 | from tempest.tests.services.compute import base |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 19 | |
| 20 | |
Marc Koderer | db19acd | 2015-09-03 16:03:58 +0200 | [diff] [blame] | 21 | class TestLimitsClient(base.BaseComputeServiceTest): |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 22 | |
| 23 | def setUp(self): |
| 24 | super(TestLimitsClient, self).setUp() |
| 25 | fake_auth = fake_auth_provider.FakeAuthProvider() |
| 26 | self.client = limits_client.LimitsClient( |
| 27 | fake_auth, 'compute', 'regionOne') |
| 28 | |
| 29 | def _test_show_limits(self, bytes_body=False): |
ghanshyam | 8a59949 | 2015-08-24 15:55:59 +0900 | [diff] [blame] | 30 | expected = { |
| 31 | "limits": { |
| 32 | "rate": [], |
| 33 | "absolute": { |
| 34 | "maxServerMeta": 128, |
| 35 | "maxPersonality": 5, |
| 36 | "totalServerGroupsUsed": 0, |
| 37 | "maxImageMeta": 128, |
| 38 | "maxPersonalitySize": 10240, |
| 39 | "maxServerGroups": 10, |
| 40 | "maxSecurityGroupRules": 20, |
| 41 | "maxTotalKeypairs": 100, |
| 42 | "totalCoresUsed": 0, |
| 43 | "totalRAMUsed": 0, |
| 44 | "totalInstancesUsed": 0, |
| 45 | "maxSecurityGroups": 10, |
| 46 | "totalFloatingIpsUsed": 0, |
| 47 | "maxTotalCores": 20, |
| 48 | "totalSecurityGroupsUsed": 0, |
| 49 | "maxTotalFloatingIps": 10, |
| 50 | "maxTotalInstances": 10, |
| 51 | "maxTotalRAMSize": 51200, |
| 52 | "maxServerGroupMembers": 10 |
Marc Koderer | db19acd | 2015-09-03 16:03:58 +0200 | [diff] [blame] | 53 | } |
ghanshyam | 8a59949 | 2015-08-24 15:55:59 +0900 | [diff] [blame] | 54 | } |
| 55 | } |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 56 | |
Marc Koderer | db19acd | 2015-09-03 16:03:58 +0200 | [diff] [blame] | 57 | self.check_service_client_function( |
| 58 | self.client.show_limits, |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 59 | 'tempest.common.service_client.ServiceClient.get', |
Marc Koderer | db19acd | 2015-09-03 16:03:58 +0200 | [diff] [blame] | 60 | expected, |
| 61 | bytes_body) |
Kenji Yasui | d99170f | 2015-07-29 07:04:01 +0000 | [diff] [blame] | 62 | |
| 63 | def test_show_limits_with_str_body(self): |
| 64 | self._test_show_limits() |
| 65 | |
| 66 | def test_show_limits_with_bytes_body(self): |
| 67 | self._test_show_limits(bytes_body=True) |