blob: 733d3d1e77d7f4359ef0cfff5fc109efc0f61fdd [file] [log] [blame]
Kenji Yasuid99170f2015-07-29 07:04:01 +00001# 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 Ohmichi50f82952015-09-14 17:04:46 +000015from tempest_lib.tests import fake_auth_provider
16
Kenji Yasuid99170f2015-07-29 07:04:01 +000017from tempest.services.compute.json import limits_client
Marc Kodererdb19acd2015-09-03 16:03:58 +020018from tempest.tests.services.compute import base
Kenji Yasuid99170f2015-07-29 07:04:01 +000019
20
Marc Kodererdb19acd2015-09-03 16:03:58 +020021class TestLimitsClient(base.BaseComputeServiceTest):
Kenji Yasuid99170f2015-07-29 07:04:01 +000022
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):
ghanshyam8a599492015-08-24 15:55:59 +090030 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 Kodererdb19acd2015-09-03 16:03:58 +020053 }
ghanshyam8a599492015-08-24 15:55:59 +090054 }
55 }
Kenji Yasuid99170f2015-07-29 07:04:01 +000056
Marc Kodererdb19acd2015-09-03 16:03:58 +020057 self.check_service_client_function(
58 self.client.show_limits,
Kenji Yasuid99170f2015-07-29 07:04:01 +000059 'tempest.common.service_client.ServiceClient.get',
Marc Kodererdb19acd2015-09-03 16:03:58 +020060 expected,
61 bytes_body)
Kenji Yasuid99170f2015-07-29 07:04:01 +000062
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)