Fix rate-limit attribute name
Backend NSX changed it. Change-Id: Id5a04538c9416af2640d941715106f768e6bd1aa
This commit is contained in:
parent
df13d53903
commit
2656e43357
@ -1692,7 +1692,7 @@ class NodeHttpServicePropertiesTestCase(BaseTestResource):
|
||||
def test_get_rate_limit(self):
|
||||
mocked_resource = self.get_mocked_resource()
|
||||
rate_limit = 40
|
||||
body = {'service_properties': {'api_rate_limit': rate_limit}}
|
||||
body = {'service_properties': {'client_api_rate_limit': rate_limit}}
|
||||
with mock.patch("vmware_nsxlib.v3.NsxLib.get_version",
|
||||
return_value='2.2.0'),\
|
||||
mock.patch.object(mocked_resource.client, "url_get",
|
||||
@ -1704,13 +1704,15 @@ class NodeHttpServicePropertiesTestCase(BaseTestResource):
|
||||
mocked_resource = self.get_mocked_resource()
|
||||
old_rate_limit = 40
|
||||
new_rate_limit = 50
|
||||
body = {'service_properties': {'api_rate_limit': old_rate_limit}}
|
||||
body = {'service_properties': {
|
||||
'client_api_rate_limit': old_rate_limit}}
|
||||
with mock.patch("vmware_nsxlib.v3.NsxLib.get_version",
|
||||
return_value='2.2.0'),\
|
||||
mock.patch.object(mocked_resource.client, "url_get",
|
||||
return_value=body):
|
||||
mocked_resource.update_rate_limit(new_rate_limit)
|
||||
body['service_properties']['api_rate_limit'] = new_rate_limit
|
||||
body['service_properties'][
|
||||
'client_api_rate_limit'] = new_rate_limit
|
||||
test_client.assert_json_call(
|
||||
'put', mocked_resource,
|
||||
'https://1.2.3.4/api/v1/node/services/http',
|
||||
|
@ -627,7 +627,8 @@ class NodeHttpServiceProperties(utils.NsxLibApiBase):
|
||||
raise exceptions.ManagerError(details=msg)
|
||||
|
||||
properties = self.get_properties()
|
||||
return properties.get('service_properties', {}).get('api_rate_limit')
|
||||
return properties.get('service_properties', {}).get(
|
||||
'client_api_rate_limit')
|
||||
|
||||
def update_rate_limit(self, value):
|
||||
"""update the NSX rate limit. default value is 40. 0 means no limit"""
|
||||
@ -640,7 +641,8 @@ class NodeHttpServiceProperties(utils.NsxLibApiBase):
|
||||
|
||||
properties = self.get_properties()
|
||||
if 'service_properties' in properties:
|
||||
properties['service_properties']['api_rate_limit'] = int(value)
|
||||
properties['service_properties'][
|
||||
'client_api_rate_limit'] = int(value)
|
||||
|
||||
# update the value using a PUT command, which is expected to return 202
|
||||
expected_results = [requests.codes.accepted]
|
||||
|
Loading…
Reference in New Issue
Block a user