def test_terminate_via_rest(setup_provider_funcscope, provider, testing_instance, soft_assert, verify_vm_running, rest_api, from_detail): assert "terminate" in rest_api.collections.instances.action.all if provider.type == 'ec2' and GH("ManageIQ/manageiq:6955").blocks: pytest.skip("Termination ec2 is blocked by" "manageiq/issues/6955") testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720, from_details=True) vm = rest_api.collections.instances.get(name=testing_instance.name) if from_detail: vm.action.terminate() else: rest_api.collections.instances.action.terminate(vm) if provider.type == 'openstack': testing_instance.wait_to_disappear(timeout=800) soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: wait_for(lambda: vm.power_state == testing_instance.STATE_TERMINATED, num_sec=600, delay=10, fail_func=vm.reload) # Bug https://bugzilla.redhat.com/show_bug.cgi?id=1310067 # That's why we skip soft_assert for aws if provider.type != 'ec2': sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_terminate(setup_provider_funcscope, provider, test_instance, soft_assert, verify_vm_running): """ Tests instance terminate Metadata: test_flag: power_control, provision """ test_instance.wait_for_vm_state_change( desired_state=test_instance.STATE_ON, timeout=720, from_details=True) test_instance.power_control_from_cfme(option=test_instance.TERMINATE, cancel=False, from_details=True) flash.assert_message_contain("Terminate initiated") wait_for( test_instance.does_vm_exist_in_cfme, fail_condition=True, num_sec=600, delay=30, fail_func=test_instance.provider_crud.refresh_provider_relationships, message="VM no longer exists in cfme UI") if provider.type == 'openstack': soft_assert(not provider.mgmt.does_vm_exist(test_instance.name), "instance still exists") else: soft_assert( provider.mgmt.is_vm_state(test_instance.name, provider.mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert(test_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_terminate(setup_provider_funcscope, provider, testing_instance, soft_assert, verify_vm_running): """ Tests instance terminate Metadata: test_flag: power_control, provision """ testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720, from_details=True) testing_instance.power_control_from_cfme(option=testing_instance.TERMINATE, cancel=False, from_details=True) flash.assert_message_contain({ version.LOWEST: "Terminate initiated", "5.5": "Vm Destroy initiated" }) testing_instance.wait_to_disappear(timeout=600) if provider.type == 'openstack': soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: soft_assert( provider.mgmt.is_vm_state(testing_instance.name, provider.mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_terminate_via_rest(setup_provider_funcscope, provider, testing_instance, soft_assert, verify_vm_running, rest_api, from_detail): assert "terminate" in rest_api.collections.instances.action.all if provider.type == 'ec2' and GH("ManageIQ/manageiq:6955").blocks: pytest.skip("Termination ec2 is blocked by""manageiq/issues/6955") testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720, from_details=True) vm = rest_api.collections.instances.get(name=testing_instance.name) if from_detail: vm.action.terminate() else: rest_api.collections.instances.action.terminate(vm) if provider.type == 'openstack': testing_instance.wait_to_disappear(timeout=800) soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: wait_for(lambda: vm.power_state == testing_instance.STATE_TERMINATED, num_sec=600, delay=10, fail_func=vm.reload) # Bug https://bugzilla.redhat.com/show_bug.cgi?id=1310067 # That's why we skip soft_assert for aws if provider.type != 'ec2': sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_terminate(setup_provider_funcscope, provider, testing_instance, soft_assert, verify_vm_running): """ Tests instance terminate Metadata: test_flag: power_control, provision """ testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720, from_details=True) testing_instance.power_control_from_cfme( option=testing_instance.TERMINATE, cancel=False, from_details=True) flash.assert_message_contain({ version.LOWEST: "Terminate initiated", "5.5": "Vm Destroy initiated"}) testing_instance.wait_to_disappear(timeout=600) if provider.type == 'openstack': soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: soft_assert( provider.mgmt.is_vm_state(testing_instance.name, provider.mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_quadicon_terminate(setup_provider_funcscope, provider, testing_instance, verify_vm_running, soft_assert): """ Tests terminate instance Metadata: test_flag: power_control, provision """ testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720) testing_instance.power_control_from_cfme(option=testing_instance.TERMINATE, cancel=False) if provider.type == 'azure': # It takes at least 300 for azure to delete it. testing_instance.wait_to_disappear(timeout=720) else: testing_instance.wait_to_disappear(timeout=300) if provider.type == 'openstack': soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: soft_assert( provider.mgmt.is_vm_state(testing_instance.name, provider.mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_terminate(setup_provider_funcscope, provider_type, provider_mgmt, test_instance, soft_assert, verify_vm_running): """ Tests instance terminate Metadata: test_flag: power_control, provision """ test_instance.wait_for_vm_state_change( desired_state=test_instance.STATE_ON, timeout=720, from_details=True) test_instance.power_control_from_cfme( option=test_instance.TERMINATE, cancel=False, from_details=True) flash.assert_message_contain("Terminate initiated") wait_for(test_instance.does_vm_exist_in_cfme, fail_condition=True, num_sec=600, delay=30, fail_func=test_instance.provider_crud.refresh_provider_relationships, message="VM no longer exists in cfme UI") if provider_type == 'openstack': soft_assert(not provider_mgmt.does_vm_exist(test_instance.name), "instance still exists") else: soft_assert( provider_mgmt.is_vm_state(test_instance.name, provider_mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert( test_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")
def test_quadicon_terminate(setup_provider_funcscope, provider, testing_instance, verify_vm_running, soft_assert): """ Tests terminate instance Metadata: test_flag: power_control, provision """ testing_instance.wait_for_vm_state_change( desired_state=testing_instance.STATE_ON, timeout=720) testing_instance.power_control_from_cfme(option=testing_instance.TERMINATE, cancel=False) testing_instance.wait_to_disappear(timeout=300) if provider.type == 'openstack': soft_assert(not testing_instance.does_vm_exist_on_provider(), "instance still exists") else: soft_assert( provider.mgmt.is_vm_state(testing_instance.name, provider.mgmt.states['deleted']), "instance still exists") sel.force_navigate("clouds_instances_archived_branch") soft_assert( testing_instance.name in get_all_instances(do_not_navigate=True), "instance is not among archived instances")