本文整理汇总了Python中zstackwoodpecker.test_util.test_pass函数的典型用法代码示例。如果您正苦于以下问题:Python test_pass函数的具体用法?Python test_pass怎么用?Python test_pass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了test_pass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
def test():
global vm
vm_creation_option = test_util.VmOption()
image_name = os.environ.get('imageName_net')
l3_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vm("test_resize_vm", image_name, l3_name)
test_obj_dict.add_vm(vm)
vm.check()
vm.stop()
vm.check()
vol_size = test_lib.lib_get_root_volume(vm.get_vm()).size
volume_uuid = test_lib.lib_get_root_volume(vm.get_vm()).uuid
set_size = 1024*1024*1024*5
snapshots = test_obj_dict.get_volume_snapshot(volume_uuid)
snapshots.set_utility_vm(vm)
snapshots.create_snapshot('create_snapshot1')
snapshots.check()
vol_ops.resize_volume(volume_uuid, set_size)
vm.update()
vol_size_after = test_lib.lib_get_root_volume(vm.get_vm()).size
if set_size != vol_size_after:
test_util.test_fail('Resize Root Volume failed, size = %s' % vol_size_after)
snapshots.delete()
test_obj_dict.rm_volume_snapshot(snapshots)
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass('Resize VM Snapshot Test Success')
示例2: test
def test():
# Clear ECS instance remained in Aliyun
hybrid.add_datacenter_iz()
hybrid.tear_down()
clean_util.cleanup_all_vms_violently()
clean_util.cleanup_none_vm_volumes_violently()
clean_util.umount_all_primary_storages_violently()
clean_util.cleanup_backup_storage()
#linux.remove_vlan_eth("eth0", 10)
#linux.remove_vlan_eth("eth0", 11)
cmd = host_plugin.DeleteVlanDeviceCmd()
cmd.vlan_ethname = 'eth0.10'
hosts = test_lib.lib_get_all_hosts_from_plan()
if type(hosts) != type([]):
hosts = [hosts]
for host in hosts:
http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)
cmd.vlan_ethname = 'eth0.11'
for host in hosts:
http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)
test_lib.setup_plan.stop_node()
test_lib.lib_cleanup_host_ip_dict()
test_util.test_pass('Hybrid Teardown Success')
示例3: test
def test():
ps_env = test_stub.PSEnvChecker()
if ps_env.is_sb_ceph_env:
env = test_stub.SanAndCephPrimaryStorageEnv(test_object_dict=test_obj_dict,
first_ps_vm_number=VM_COUNT,
second_ps_vm_number=VM_COUNT,
first_ps_volume_number=VOLUME_NUMBER,
second_ps_volume_number=VOLUME_NUMBER)
else:
env = test_stub.TwoPrimaryStorageEnv(test_object_dict=test_obj_dict,
first_ps_vm_number=VM_COUNT,
second_ps_vm_number=VM_COUNT,
first_ps_volume_number=VOLUME_NUMBER,
second_ps_volume_number=VOLUME_NUMBER)
env.check_env()
env.deploy_env()
first_ps_vm_list = env.first_ps_vm_list
second_ps_vm_list = env.second_ps_vm_list
if env.new_ps:
new_ps_list.append(env.second_ps)
test_util.test_dsc('detach random one Primary Storage from cluster')
selected_ps = random.choice([env.first_ps, env.second_ps])
if selected_ps is env.first_ps:
another_ps = env.second_ps
else:
another_ps = env.first_ps
ps_ops.detach_primary_storage(selected_ps.uuid, res_ops.get_resource(res_ops.CLUSTER)[0].uuid)
detached_ps_list.append(selected_ps)
test_util.test_dsc('All vm in selected ps should STOP')
for vm in first_ps_vm_list + second_ps_vm_list:
vm.update()
for vm in env.get_vm_list_from_ps(selected_ps):
assert vm.get_vm().state == inventory.STOPPED
for vm in env.get_vm_list_from_ps(another_ps):
assert vm.get_vm().state == inventory.RUNNING
with test_stub.expected_failure('start vm in ps that not attached to cluster', Exception):
random.choice(env.get_vm_list_from_ps(selected_ps)).start()
with test_stub.expected_failure("Create vm in detached ps", Exception):
test_stub.create_multi_vms(name_prefix='test-vm', count=1, ps_uuid=selected_ps.uuid)
test_util.test_dsc("Create 5 vms and check all should be in enabled PS")
if ps_env.is_sb_ceph_env:
if selected_ps.type == "SharedBlock":
vm_list = test_stub.create_multi_vms(name_prefix='test_vm', count=5, bs_type='Ceph')
else:
vm_list = test_stub.create_multi_vms(name_prefix='test_vm', count=5, bs_type='ImageStoreBackupStorage')
else:
vm_list = test_stub.create_multi_vms(name_prefix='test_vm', count=5)
for vm in vm_list:
test_obj_dict.add_vm(vm)
for vm in vm_list:
assert vm.get_vm().allVolumes[0].primaryStorageUuid == another_ps.uuid
test_util.test_pass('Multi PrimaryStorage Test Pass')
示例4: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
#l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
#vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
#vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
test_util.test_dsc('Add ISO Image')
cond = res_ops.gen_query_conditions("status", '=', "Connected")
bs_uuid = res_ops.query_resource(res_ops.BACKUP_STORAGE, cond)[0].uuid
img_option = test_util.ImageOption()
img_option.set_name('iso')
img_option.set_backup_storage_uuid_list([bs_uuid])
os.system("echo fake iso for test only > %s/apache-tomcat/webapps/zstack/static/test.iso" % (os.environ.get('zstackInstallPath')))
img_option.set_url('http://%s:8080/zstack/static/test.iso' % (os.environ.get('node1Ip')))
image_inv = img_ops.add_iso_template(img_option)
image = test_image.ZstackTestImage()
image.set_image(image_inv)
image.set_creation_option(img_option)
test_obj_dict.add_image(image)
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'maintain')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to maintain state')
vm.set_state(vm_header.STOPPED)
vm.check()
test_util.test_dsc('Attach ISO to VM')
cond = res_ops.gen_query_conditions('name', '=', 'iso')
iso_uuid = res_ops.query_resource(res_ops.IMAGE, cond)[0].uuid
img_ops.attach_iso(iso_uuid, vm.vm.uuid)
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
#vm_ops.reconnect_vr(vr_uuid)
vrs = test_lib.lib_get_all_vrs()
for vr in vrs:
vm_ops.start_vm(vr.uuid)
vm.start()
vm.check()
vm.destroy()
vm.check()
#vm.expunge()
#vm.check()
test_util.test_pass('PS maintain mode Test Success')
示例5: test
def test():
test_util.test_dsc('''
Will doing random test operations, including vm create/stop/start/reboot
/destroy, volume create/attach/detach/delete. It doesn't include SG
VIP and snapshots operations. If reach max 4 coexisting running vm,
testing will success and quit.
''')
target_running_vm = 4
test_util.test_dsc('Random Test Begin. Test target: 4 coexisting running VM (not include VR).')
robot_test_obj = test_util.Robot_Test_Object()
robot_test_obj.set_test_dict(test_dict)
robot_test_obj.set_exclusive_actions_list(\
test_state.TestAction.sg_actions \
+ test_state.TestAction.vip_actions \
+ test_state.TestAction.snapshot_actions)
priority_actions = test_state.TestAction.volume_actions * 4
priority_action_obj = action_select.ActionPriority()
priority_action_obj.add_priority_action_list(priority_actions)
robot_test_obj.set_priority_actions(priority_action_obj)
rounds = 1
while len(test_dict.get_vm_list(vm_header.RUNNING)) < target_running_vm:
print "test_dict: %s" % test_dict
test_util.test_dsc('New round %s starts: random operation pickup.' % rounds)
test_lib.lib_vm_random_operation(robot_test_obj)
test_util.test_dsc('Round %s finished. Begin status checking.' % rounds)
rounds += 1
test_lib.lib_robot_status_check(test_dict)
test_util.test_dsc('Reach test pass exit criterial.')
test_lib.lib_robot_cleanup(test_dict)
test_util.test_pass('Create random VM Test Success')
示例6: test
def test():
system_time1 = int(time.time())
current_time = schd_ops.get_current_time().currentTime
system_time2 = int(time.time())
if system_time1 != current_time.Seconds and system_time2 != current_time.Seconds:
test_util.test_fail('get_current_time not get expected time')
test_util.test_pass('Create VM Test Success')
示例7: test
def test():
test_util.test_dsc('Test storage capacity when using expunge vm')
if conf_ops.get_global_config_value('vm', 'deletionPolicy') != 'Delay' :
test_util.test_skip('vm delete_policy is not Delay, skip test.')
return
zone_uuid = res_ops.query_resource(res_ops.ZONE)[0].uuid
cond = res_ops.gen_query_conditions('state', '=', 'Enabled')
cond = res_ops.gen_query_conditions('status', '=', 'Connected', cond)
host = res_ops.query_resource_with_num(res_ops.HOST, cond, limit = 1)
if not host:
test_util.test_skip('No Enabled/Connected host was found, skip test.' )
return True
ps = res_ops.query_resource_with_num(res_ops.PRIMARY_STORAGE, cond, limit = 1)
if not ps:
test_util.test_skip('No Enabled/Connected primary storage was found, skip test.' )
return True
host = host[0]
ps = ps[0]
host_res = vol_ops.get_local_storage_capacity(host.uuid, ps.uuid)[0]
avail_cap = host_res.availableCapacity
vm = test_stub.create_vm(vm_name = 'basic-test-vm', host_uuid = host.uuid)
test_obj_dict.add_vm(vm)
time.sleep(1)
vm.destroy()
vm.expunge()
host_res2 = vol_ops.get_local_storage_capacity(host.uuid, ps.uuid)[0]
avail_cap2 = host_res.availableCapacity
if avail_cap != avail_cap2:
test_util.test_fail('PS capacity is not same after create/expunge vm on host: %s. Capacity before create vm: %s, after expunge vm: %s ' % (host.uuid, avail_cap, avail_cap2))
test_util.test_pass('Expunge VM Test Success')
示例8: test
def test():
global test_obj_dict
global delete_policy
delete_policy = test_lib.lib_set_delete_policy('vm', 'Delay')
l3_name = os.environ.get('l3VlanNetworkName1')
#l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
image_name = os.environ.get('imageName_net')
vm = test_stub.create_vm(l3_name=l3_name, image_name=image_name, vm_name='basic-test-vm')
test_obj_dict.add_vm(vm)
vm.check()
vm_nic_uuid = vm.vm.vmNics[0].uuid
net_ops.detach_l3(vm_nic_uuid)
vm.destroy()
vm.set_state(vm_header.DESTROYED)
vm.check()
vm.recover()
vm.set_state(vm_header.STOPPED)
vm.check()
test_lib.lib_set_delete_policy('vm', delete_policy)
try:
vm.start()
except Exception, e:
#if "please attach a nic and try again" in str(e):
test_util.test_pass('test detach l3 check vm passed.')
示例9: test
def test():
pxe_servers = res_ops.query_resource(res_ops.PXE_SERVER)
if pxe_servers != None:
for pxe in pxe_servers:
bare_ops.delete_pxe(pxe.uuid)
test_stub.create_pxe()
test_util.test_pass('Create PXE Test Success')
示例10: test
def test():
h1_name = os.environ.get("hostName")
cond = res_ops.gen_query_conditions('name', '=', h1_name)
h1 = res_ops.query_resource(res_ops.HOST, cond)
ag1 = ag_ops.create_affinity_group(name="ag1", policy="antiHard")
vm1 = test_stub.create_ag_vm(host_uuid=h1[0].uuid)
assert vm1.get_vm().hostUuid == h1[0].uuid
test_obj_dict.add_vm(vm1)
new_vm = vm1.clone(names=["clone-vm1", "clone-vm2", "clone-vm3"], systemtag=["affinityGroupUuid::%s" % ag1.uuid])
test_obj_dict.add_vm(new_vm[0])
test_obj_dict.add_vm(new_vm[1])
test_obj_dict.add_vm(new_vm[2])
vmuuids = []
ag = test_lib.lib_get_affinity_group_by_name(name="ag1")
for usage in ag.usages:
vmuuids.append(usage.resourceUuid)
assert new_vm[0].get_vm().uuid in vmuuids
assert new_vm[1].get_vm().uuid in vmuuids
assert new_vm[2].get_vm().uuid in vmuuids
assert len(vmuuids) == 3
try:
ag_ops.add_vm_to_affinity_group(ag1.uuid, vm1.get_vm().uuid)
except:
test_util.test_logger("vm1 is not expected to add into affinity group [uuid: %s]" % ag1.uuid)
vmuuids = []
ag = test_lib.lib_get_affinity_group_by_name(name="ag1")
for usage in ag.usages:
vmuuids.append(usage.resourceUuid)
assert vm1.get_vm().uuid not in vmuuids
test_lib.lib_error_cleanup(test_obj_dict)
ag_ops.delete_affinity_group(ag1.uuid)
test_util.test_pass("Affinity Group antiHard policy pass")
示例11: test
def test():
global vcenter_uuid, vm
vcenter1_name = os.environ['vcenter2_name']
vcenter1_domain_name = os.environ['vcenter2_ip']
vcenter1_username = os.environ['vcenter2_domain_name']
vcenter1_password = os.environ['vcenter2_password']
ova_image_name = os.environ['vcenter2_template_exist']
network_pattern1 = os.environ['vcenter2_network_pattern1']
zone_uuid = res_ops.get_resource(res_ops.ZONE)[0].uuid
inv = vct_ops.add_vcenter(vcenter1_name, vcenter1_domain_name, vcenter1_username, vcenter1_password, True, zone_uuid)
vcenter_uuid = inv.uuid
if vcenter_uuid == None:
test_util.test_fail("vcenter_uuid is None")
vm = test_stub.create_vm_in_vcenter(vm_name = 'vm-start-stop-test', image_name = ova_image_name, l3_name = network_pattern1)
vm.check()
vm.stop()
vm.check()
vm.start()
vm.check()
vm.destroy()
vm.check()
vm.expunge()
vct_ops.delete_vcenter(vcenter_uuid)
test_util.test_pass("vm start and stop of vcenter test passed.")
示例12: test
def test():
global vm_inv
test_util.test_dsc('Create test vm to test zstack upgrade by -u.')
image_name = os.environ.get('imageName_i_c7_z_1.9')
#iso_path = os.environ.get('iso_path')
zstack_latest_version = os.environ.get('zstackLatestVersion')
zstack_latest_path = os.environ.get('zstackLatestInstaller')
vm_name = os.environ.get('vmName')
#upgrade_script_path = os.environ.get('upgradeScript')
vm_inv = test_stub.create_vm_scenario(image_name, vm_name)
vm_ip = vm_inv.vmNics[0].ip
test_lib.lib_wait_target_up(vm_ip, 22)
test_stub.make_ssh_no_password(vm_ip, tmp_file)
test_util.test_logger('Update MN IP')
test_stub.update_mn_hostname(vm_ip, tmp_file)
test_stub.update_mn_ip(vm_ip, tmp_file)
test_stub.start_mn(vm_ip, tmp_file)
test_stub.check_installation(vm_ip, tmp_file)
test_util.test_logger('Upgrade zstack to latest with repo')
#test_stub.update_iso(vm_ip, tmp_file, iso_path, upgrade_script_path)
test_stub.update_repo(vm_ip, tmp_file)
test_stub.upgrade_zstack(vm_ip, zstack_latest_path, tmp_file)
test_stub.check_zstack_version(vm_ip, tmp_file, zstack_latest_version)
test_stub.start_mn(vm_ip, tmp_file)
test_stub.check_mn_running(vm_ip, tmp_file)
test_stub.check_installation(vm_ip, tmp_file)
os.system('rm -f %s' % tmp_file)
test_stub.destroy_vm_scenario(vm_inv.uuid)
test_util.test_pass('ZStack upgrade Test Success')
示例13: test
def test():
imagestore_backup_storage = test_lib.lib_get_image_store_backup_storage()
if not imagestore_backup_storage:
test_util.test_skip('Not find image store type backup storage.')
img_option = test_util.ImageOption()
img_option.set_name('iso')
root_disk_uuid = test_lib.lib_get_disk_offering_by_name(os.environ.get('rootDiskOfferingName')).uuid
bs_uuid = imagestore_backup_storage.uuid
img_option.set_backup_storage_uuid_list([bs_uuid])
command = "command -v genisoimage"
result = test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
if not result:
command = "yum -y install genisoimage --disablerepo=* --enablerepo=zstack-local"
test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
command = "genisoimage -o %s/apache-tomcat/webapps/zstack/static/zstack-repo/7/x86_64/os/test.iso /tmp/" % os.environ.get('zstackInstallPath')
test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
img_option.set_url('http://%s:8080/zstack/static/zstack-repo/7/x86_64/os/test.iso' % (os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP']))
image_inv = img_ops.add_iso_template(img_option)
image = test_image.ZstackTestImage()
image.set_image(image_inv)
image.set_creation_option(img_option)
test_obj_dict.add_image(image)
image_url = image.export()
image.delete_exported_image()
test_lib.lib_robot_cleanup(test_obj_dict)
if image_url.endswith('.iso'):
test_util.test_pass('Export ISO Image Test Success')
else:
test_util.test_fail('Export ISO Image Test Fail, exported ISO image ends with %s' % (image_url.split('.')[-1]))
示例14: test
def test():
global vm
create_vm_option = test_util.VmOption()
create_vm_option.set_rootVolume_systemTags(["volumeProvisioningStrategy::ThinProvisioning"])
create_vm_option.set_name('test_resize_vm_root_volume')
vm = test_lib.lib_create_vm(create_vm_option)
vm.check()
vm.stop()
vm.check()
vol_size = test_lib.lib_get_root_volume(vm.get_vm()).size
volume_uuid = test_lib.lib_get_root_volume(vm.get_vm()).uuid
set_size = 1024*1024*1024*5
vol_ops.resize_volume(volume_uuid, set_size)
vm.update()
vol_size_after = test_lib.lib_get_root_volume(vm.get_vm()).size
if set_size != vol_size_after:
test_util.test_fail('Resize Root Volume failed, size = %s' % vol_size_after)
vm.start()
set_size = 1024*1024*1024*6
vol_ops.resize_volume(volume_uuid, set_size)
vm.update()
vol_size_after = test_lib.lib_get_root_volume(vm.get_vm()).size
if set_size != vol_size_after:
test_util.test_fail('Resize Root Volume failed, size = %s' % vol_size_after)
vm.destroy()
test_util.test_pass('Resize VM Test Success')
示例15: test
def test():
system_time1 = int(time.time())
current_time = schd_ops.get_current_time().currentTime
system_time2 = int(time.time())
if system_time1 > current_time.Seconds and system_time2 < current_time.Seconds:
test_util.test_fail('get_current_time not get expected time[%s, %s]: %s' % (system_time1, system_time2, current_time.Seconds))
test_util.test_pass('Create VM Test Success')