本文整理汇总了Python中reddwarf.tests.util.poll_until函数的典型用法代码示例。如果您正苦于以下问题:Python poll_until函数的具体用法?Python poll_until怎么用?Python poll_until使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了poll_until函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: wait_for_compute_service
def wait_for_compute_service():
pid = test_config.compute_service.find_proc_id()
line = "Creating Consumer connection for Service compute from (pid=%d)" % pid
try:
poll_until(lambda: check_logs_for_message(line), sleep_time=1, time_out=60)
except exception.PollTimeOut:
raise RuntimeError("Could not find the line %s in the logs." % line)
开发者ID:jcru,项目名称:reddwarf-integration,代码行数:7,代码来源:__init__.py
示例2: wait_for_broken_connection
def wait_for_broken_connection(self):
"""Wait until our connection breaks."""
if not USE_IP:
return
poll_until(self.connection.is_connected,
lambda connected: not connected,
time_out=TIME_OUT_TIME)
开发者ID:imsplitbit,项目名称:reddwarf,代码行数:7,代码来源:instances_actions.py
示例3: test_get_init_pid
def test_get_init_pid(self):
def get_the_pid():
out, err = process("pgrep init | vzpid - | awk '/%s/{print $1}'"
% str(instance_info.local_id))
instance_info.pid = out.strip()
return len(instance_info.pid) > 0
poll_until(get_the_pid, sleep_time=10, time_out=(60 * 10))
开发者ID:jeredding,项目名称:reddwarf,代码行数:7,代码来源:instances.py
示例4: restart_compute_service
def restart_compute_service(extra_args=None):
extra_args = extra_args or []
test_config.compute_service.restart(extra_args=extra_args)
# Be absolutely certain the compute manager is ready before passing control
# back to caller.
poll_until(lambda: hosts_up("compute"), sleep_time=1, time_out=60)
wait_for_compute_service()
开发者ID:jcru,项目名称:reddwarf-integration,代码行数:7,代码来源:__init__.py
示例5: wait_for_resize
def wait_for_resize(self):
def is_finished_resizing():
instance = self.instance
if instance.status == "RESIZE":
return False
assert_equal("ACTIVE", instance.status)
return True
poll_until(is_finished_resizing, time_out=TIME_OUT_TIME)
开发者ID:DJohnstone,项目名称:trove,代码行数:8,代码来源:instances_actions.py
示例6: wait_for_successful_restart
def wait_for_successful_restart(self):
"""Wait until status becomes running."""
def is_finished_rebooting():
instance = self.instance
if instance.status == "REBOOT":
return False
assert_equal("ACTIVE", instance.status)
return True
poll_until(is_finished_rebooting, time_out=TIME_OUT_TIME)
开发者ID:DJohnstone,项目名称:trove,代码行数:10,代码来源:instances_actions.py
示例7: wait_for_failure_status
def wait_for_failure_status(self):
"""Wait until status becomes running."""
def is_finished_rebooting():
instance = self.instance
if instance.status == "REBOOT":
return False
assert_equal("SHUTDOWN", instance.status)
return True
poll_until(is_finished_rebooting, time_out=TIME_OUT_TIME)
开发者ID:imsplitbit,项目名称:reddwarf,代码行数:10,代码来源:instances_actions.py
示例8: test_instance_created
def test_instance_created(self):
def check_status_of_instance():
status, err = process("sudo vzctl status %s | awk '{print $5}'"
% str(instance_info.local_id))
if string_in_list(status, ["running"]):
self.assertEqual("running", status.strip())
return True
else:
return False
poll_until(check_status_of_instance, sleep_time=5, time_out=(60 * 8))
开发者ID:jeredding,项目名称:reddwarf,代码行数:10,代码来源:instances.py
示例9: update_and_wait_to_finish
def update_and_wait_to_finish(self):
instance_info.dbaas_admin.management.update(instance_info.id)
def finished():
current_version = self.get_version()
if current_version == self.next_version:
return True
# The only valid thing for it to be aside from next_version is
# old version.
assert_equal(current_version, self.old_version)
poll_until(finished, sleep_time=1, time_out=3 * 60)
开发者ID:DJohnstone,项目名称:trove,代码行数:11,代码来源:instances_actions.py
示例10: test_backup_created
def test_backup_created(self):
# This version just checks the REST API status.
def result_is_active():
backup = instance_info.dbaas.backups.get(backup_info.id)
if backup.status == "COMPLETED":
return True
else:
assert_not_equal("FAILED", backup.status)
return False
poll_until(result_is_active)
开发者ID:riddhi89,项目名称:reddwarf,代码行数:11,代码来源:backups.py
示例11: wait_for_failure_status
def wait_for_failure_status(self):
"""Wait until status becomes running."""
def is_finished_rebooting():
instance = self.instance
if instance.status == "REBOOT" or instance.status == "ACTIVE":
return False
# The reason we check for BLOCKED as well as SHUTDOWN is because
# Upstart might try to bring mysql back up after the borked
# connection and the guest status can be either
assert_true(instance.status in ("SHUTDOWN", "BLOCKED"))
return True
poll_until(is_finished_rebooting, time_out=TIME_OUT_TIME)
开发者ID:DJohnstone,项目名称:trove,代码行数:13,代码来源:instances_actions.py
示例12: test_instance_status_after_double_migrate
def test_instance_status_after_double_migrate(self):
"""
This test is to verify that instance status returned is more
informative than 'Status is {}'. There are several ways to
replicate this error. A double migration is just one of them but
since this is a known way to recreate that error we will use it
here to be sure that the error is fixed. The actual code lives
in reddwarf/instance/models.py in _validate_can_perform_action()
"""
# TODO(imsplitbit): test other instances where this issue could be
# replicated. Resizing a resized instance awaiting confirmation
# can be used as another case. This all boils back to the same
# piece of code so I'm not sure if it's relevant or not but could
# be done.
result = self.client.instances.create('testbox', 1, {'size': 5})
id = result.id
self.instances.append(id)
def verify_instance_is_active():
result = self.client.instances.get(id)
print result.status
return result.status == 'ACTIVE'
def attempt_migrate():
print 'attempting migration'
try:
self.mgmt.migrate(id)
except exceptions.UnprocessableEntity:
return False
return True
# Timing necessary to make the error occur
poll_until(verify_instance_is_active, time_out=120, sleep_time=1)
try:
poll_until(attempt_migrate, time_out=10, sleep_time=1)
except rd_exceptions.PollTimeOut:
fail('Initial migration timed out')
try:
self.mgmt.migrate(id)
except exceptions.UnprocessableEntity as err:
assert('status was {}' not in err.message)
else:
# If we are trying to test what status is returned when an
# instance is in a confirm_resize state and another
# migration is attempted then we also need to
# assert that an exception is raised when running migrate.
# If one is not then we aren't able to test what the
# returned status is in the exception message.
fail('UnprocessableEntity was not thrown')
开发者ID:jeredding,项目名称:reddwarf,代码行数:51,代码来源:instances.py
示例13: create_user
def create_user(self):
"""Create a MySQL user we can use for this test."""
users = [{"name": MYSQL_USERNAME, "password": MYSQL_PASSWORD,
"database": MYSQL_USERNAME}]
self.dbaas.users.create(instance_info.id, users)
def has_user():
users = self.dbaas.users.list(instance_info.id)
return any([user.name == MYSQL_USERNAME for user in users])
poll_until(has_user, time_out=30)
if not FAKE_MODE:
time.sleep(5)
开发者ID:DJohnstone,项目名称:trove,代码行数:14,代码来源:instances_actions.py
示例14: test_backup_delete
def test_backup_delete(self):
"""test delete"""
instance_info.dbaas.backups.delete(backup_info.id)
assert_equal(202, instance_info.dbaas.last_http_code)
def backup_is_gone():
result = instance_info.dbaas.instances.backups(instance_info.id)
if len(result) == 0:
return True
else:
return False
poll_until(backup_is_gone)
assert_raises(exceptions.NotFound, instance_info.dbaas.backups.get,
backup_info.id)
开发者ID:riddhi89,项目名称:reddwarf,代码行数:14,代码来源:backups.py
示例15: test_volume_resize_success
def test_volume_resize_success(self):
def check_resize_status():
instance = instance_info.dbaas.instances.get(instance_info.id)
if instance.status == "ACTIVE":
return True
elif instance.status == "RESIZE":
return False
else:
fail("Status should not be %s" % instance.status)
poll_until(check_resize_status, sleep_time=2, time_out=300)
instance = instance_info.dbaas.instances.get(instance_info.id)
assert_equal(instance.volume['size'], self.new_volume_size)
开发者ID:DJohnstone,项目名称:trove,代码行数:14,代码来源:instances_actions.py
示例16: setUp
def setUp(self):
self.user = test_config.users.find_user(Requirements(is_admin=True))
self.client = create_dbaas_client(self.user)
self.name = 'test_SERVER_ERROR'
# Create an instance with a broken compute instance.
self.response = self.client.instances.create(self.name, 1,
{'size': 1}, [])
poll_until(lambda: self.client.instances.get(self.response.id),
lambda instance: instance.status == 'ERROR',
time_out=10)
self.instance = self.client.instances.get(self.response.id)
print "Status: %s" % self.instance.status
msg = "Instance did not drop to error after server prov failure."
assert_equal(self.instance.status, "ERROR", msg)
开发者ID:jeredding,项目名称:reddwarf,代码行数:14,代码来源:accounts.py
示例17: test_bad_resize_vol_data
def test_bad_resize_vol_data(self):
def _check_instance_status():
inst = self.dbaas.instances.get(self.instance)
if inst.status == "ACTIVE":
return True
else:
return False
poll_until(_check_instance_status)
try:
self.dbaas.instances.resize_volume(self.instance.id, "bad data")
except Exception as e:
resp, body = self.dbaas.client.last_response
httpCode = resp.status
assert_true(httpCode == 400, "Resize instance failed with code %s, exception %s" % (httpCode, e))
开发者ID:rgeethapriya,项目名称:reddwarf,代码行数:15,代码来源:malformed_json.py
示例18: set_up
def set_up(self):
"""Create client for mgmt instance test (2)."""
if not CONFIG.fake_mode:
raise SkipTest("This test only works in fake mode.")
self.client = create_client(is_admin=True)
self.mgmt = self.client.management
# Fake nova will fail a server ending with 'test_SERVER_ERROR'."
# Fake volume will fail if the size is 13.
# TODO(tim.simpson): This would be a lot nicer looking if we used a
# traditional mock framework.
response = self.client.instances.create("test_SERVER_ERROR", 1, {"size": 13}, [])
poll_until(
lambda: self.client.instances.get(response.id), lambda instance: instance.status == "ERROR", time_out=10
)
self.id = response.id
开发者ID:cp16net,项目名称:reddwarf-1,代码行数:15,代码来源:instances.py
示例19: test_verify_backup
def test_verify_backup(self):
result = self._create_backup(BACKUP_NAME, BACKUP_DESC)
assert_equal(BACKUP_NAME, result.name)
assert_equal(BACKUP_DESC, result.description)
assert_equal(instance_info.id, result.instance_id)
assert_equal('NEW', result.status)
instance = instance_info.dbaas.instances.list()[0]
assert_equal('BACKUP', instance.status)
global backup_info
backup_info = result
# print dir(backup_info)
# print backup_info.locationRef
# Timing necessary to make the error occur
poll_until(self._verify_instance_is_active, time_out=120,
sleep_time=1)
开发者ID:dfecker,项目名称:reddwarf,代码行数:15,代码来源:backups.py
示例20: test_bad_change_user_password
def test_bad_change_user_password(self):
users = [{"name": ""}]
def _check_instance_status():
inst = self.dbaas.instances.get(self.instance)
if inst.status == "ACTIVE":
return True
else:
return False
poll_until(_check_instance_status)
try:
self.dbaas.users.change_passwords(self.instance, users)
except Exception as e:
resp, body = self.dbaas.client.last_response
httpCode = resp.status
assert_true(httpCode == 400, "Change usr/passwd failed with code %s, exception %s" % (httpCode, e))
开发者ID:rgeethapriya,项目名称:reddwarf,代码行数:17,代码来源:malformed_json.py
注:本文中的reddwarf.tests.util.poll_until函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论