summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/identity
diff options
context:
space:
mode:
authorAnton Frolov <af9740@att.com>2017-09-25 12:31:24 -0700
committerAnton Frolov <af9740@att.com>2017-09-26 14:31:07 -0700
commitf6f5ce03c5b8a03180db24a02dda5b30f40b4cee (patch)
tree2c5355d1dd26e73a284defa810b63fc2563666e7 /openstackclient/tests/unit/identity
parent953d74b5d65b095428c783f80cc61f2d85909841 (diff)
downloadpython-openstackclient-f6f5ce03c5b8a03180db24a02dda5b30f40b4cee.tar.gz
Optimize getting endpoint list
Currently ListEndpoint.take_action method unconditionally iterates over all endpoints and issue GET /v3/services/<ep.service_id> request for each endpoint. In case of HTTPS keystone endpoint this can take significant amout of time, and it only getting worse in case of multiple regions. This commit change this logic to making just two GET requests: first it gets endpoint list, then it gets service list, searching service in the list instead of issuing GET /v3/services/<id> request. Change-Id: I22b61c0b45b0205a2f5a4608c2473cb7814fe3cf Closes-Bug: 1719413
Diffstat (limited to 'openstackclient/tests/unit/identity')
-rw-r--r--openstackclient/tests/unit/identity/v3/test_endpoint.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/identity/v3/test_endpoint.py b/openstackclient/tests/unit/identity/v3/test_endpoint.py
index 765fbedd..fad53fcb 100644
--- a/openstackclient/tests/unit/identity/v3/test_endpoint.py
+++ b/openstackclient/tests/unit/identity/v3/test_endpoint.py
@@ -295,6 +295,7 @@ class TestEndpointList(TestEndpoint):
# This is the return value for common.find_resource(service)
self.services_mock.get.return_value = self.service
+ self.services_mock.list.return_value = [self.service]
# Get the command object to test
self.cmd = endpoint.ListEndpoint(self.app, None)
@@ -726,6 +727,7 @@ class TestEndpointListServiceWithoutName(TestEndpointList):
# This is the return value for common.find_resource(service)
self.services_mock.get.return_value = self.service
+ self.services_mock.list.return_value = [self.service]
# Get the command object to test
self.cmd = endpoint.ListEndpoint(self.app, None)