Merge "Delete Tempest fork, import from tempest and tempest_lib"

This commit is contained in:
Jenkins 2016-01-29 19:07:57 +00:00 committed by Gerrit Code Review
commit 8d6ecd96fe
1 changed files with 1 additions and 39 deletions

View File

@ -14,10 +14,9 @@ import time
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urlparse
from tempest_lib.common.utils import misc
from tempest.common import service_client
from tempest_lib import exceptions as lib_exc
from neutron.tests.tempest.common import service_client
from neutron.tests.tempest import exceptions
@ -220,43 +219,6 @@ class NetworkClientJSON(service_client.ServiceClient):
return True
return False
def wait_for_resource_status(self, fetch, status, interval=None,
timeout=None):
"""
@summary: Waits for a network resource to reach a status
@param fetch: the callable to be used to query the resource status
@type fecth: callable that takes no parameters and returns the resource
@param status: the status that the resource has to reach
@type status: String
@param interval: the number of seconds to wait between each status
query
@type interval: Integer
@param timeout: the maximum number of seconds to wait for the resource
to reach the desired status
@type timeout: Integer
"""
if not interval:
interval = self.build_interval
if not timeout:
timeout = self.build_timeout
start_time = time.time()
while time.time() - start_time <= timeout:
resource = fetch()
if resource['status'] == status:
return
time.sleep(interval)
# At this point, the wait has timed out
message = 'Resource %s' % (str(resource))
message += ' failed to reach status %s' % status
message += ' (current: %s)' % resource['status']
message += ' within the required time %s' % timeout
caller = misc.find_test_caller()
if caller:
message = '(%s) %s' % (caller, message)
raise exceptions.TimeoutException(message)
def deserialize_single(self, body):
return json.loads(body)