def test_retire_stack(provider, provisioning, create_template, catalog, request): """Tests stack provisioning Metadata: test_flag: provision """ set_default_view("Stacks", "Grid View") dialog_name, template = create_template item_name = fauxfactory.gen_alphanumeric() catalog_item = CatalogItem(item_type="Orchestration", name=item_name, description="my catalog", display_in=True, catalog=catalog.name, dialog=dialog_name, orch_template=template.template_name) catalog_item.create() stack_data = prepare_stack_data(provider, provisioning) service_catalogs = ServiceCatalogs("service_name", stack_data) service_catalogs.order_stack_item(catalog.name, catalog_item) logger.info('Waiting for cfme provision request for service %s', item_name) row_description = item_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert row.last_message.text == 'Service Provisioned Successfully' stack = Stack(stack_data['stack_name']) stack.retire_stack() @request.addfinalizer def _cleanup_templates(): template.delete_all_templates() stack_data['vm_name'].delete_from_provider()
def test_retire_stack(provider, provisioning, catalog, catalog_item, request): """Tests stack provisioning Metadata: test_flag: provision """ catalog_item, item_name = catalog_item DefaultView.set_default_view("Stacks", "Grid View") stack_data = prepare_stack_data(provider, provisioning) service_catalogs = ServiceCatalogs(item_name, stack_data) service_catalogs.order() logger.info('Waiting for cfme provision request for service {}'.format(item_name)) row_description = item_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert 'Provisioned Successfully' in row.last_message.text stack = Stack(stack_data['stack_name'], provider=provider) stack.wait_for_appear() stack.retire_stack() @request.addfinalizer def _cleanup_vms(): clean_up(stack_data, provider)
def test_retire_stack(setup_provider, provider, provisioning, dialog, catalog, request): """Tests stack provisioning Metadata: test_flag: provision """ set_default_view("Stacks", "Grid View") dialog_name, template = dialog method = METHOD_TORSO.replace('"Description" : "AWS', '"Description" : "Aamzon Web Services desc') template.create(method) template.create_service_dialog_from_template(dialog_name, template.template_name) item_name = fauxfactory.gen_alphanumeric() catalog_item = CatalogItem(item_type="Orchestration", name=item_name, description="my catalog", display_in=True, catalog=catalog.name, dialog=dialog_name, orch_template=template.template_name, provider_type=provider.name) catalog_item.create() stackname = "test-" + fauxfactory.gen_alphanumeric() stack_data = {'stack_name': stackname} service_catalogs = ServiceCatalogs("service_name", stack_data) service_catalogs.order_stack_item(catalog.name, catalog_item) request.addfinalizer(lambda: template.delete_all_templates()) logger.info('Waiting for cfme provision request for service %s' % item_name) row_description = item_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert row.last_message.text == 'Service Provisioned Successfully' stack = Stack(stackname) stack.retire_stack()
def test_retire_stack(provider, provisioning, catalog, catalog_item, request): """Tests stack provisioning Metadata: test_flag: provision """ catalog_item, item_name = catalog_item DefaultView.set_default_view("Stacks", "Grid View") stack_data = prepare_stack_data(provider, provisioning) service_catalogs = ServiceCatalogs(item_name, stack_data) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', item_name) row_description = item_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert provision_success_message(catalog_item.name) in row.last_message.text stack = Stack(stack_data['stack_name']) stack.wait_for_appear() stack.retire_stack() @request.addfinalizer def _cleanup_templates(): try: stack_data['vm_name'].delete_from_provider() except Exception as ex: logger.warning('Exception while checking/deleting stack, continuing: {}' .format(ex.message)) pass
def stack(setup_provider_modscope, provider): stack = Stack(provider.data['provisioning']['stack'], provider=provider) stack.wait_for_appear() yield stack try: stack.delete() except Exception: pass
def test_delete_stack_appear_after_refresh(setup_provider, provider, provisioning, request): """ Tests delete stack Metadata: test_flag: delete_object """ stack = Stack(provisioning['stack'], provider=provider) refresh_and_wait(provider, stack) stack.delete() navigate_to(stack, 'All') assert lambda: not sel.is_displayed(Quadicon(stack.name, stack.quad_name))
def test_delete_stack(setup_provider, provider, provisioning, request): """ Tests delete stack Metadata: test_flag: delete_object """ stack = Stack(provisioning['stack'], provider=provider) refresh_and_wait(provider, stack) stack.delete() navigate_to(stack, 'All') assert lambda: not sel.is_displayed(Quadicon(stack.name, stack.quad_name))
def test_retire_stack(setup_provider, provider, provisioning, dialog, catalog, request): """Tests stack provisioning Metadata: test_flag: provision """ set_default_view("Stacks", "Grid View") dialog_name, template = dialog method = METHOD_TORSO.replace('"Description" : "AWS', '"Description" : "Amzn Web Services desc') template.create(method) template.create_service_dialog_from_template(dialog_name, template.template_name) item_name = fauxfactory.gen_alphanumeric() catalog_item = CatalogItem(item_type="Orchestration", name=item_name, description="my catalog", display_in=True, catalog=catalog.name, dialog=dialog_name, orch_template=template.template_name, provider_type=provider.name) catalog_item.create() stackname = "test-" + fauxfactory.gen_alphanumeric() stack_data = {'stack_name': stackname} service_catalogs = ServiceCatalogs("service_name", stack_data) service_catalogs.order_stack_item(catalog.name, catalog_item) request.addfinalizer(lambda: template.delete_all_templates()) logger.info('Waiting for cfme provision request for service %s', item_name) row_description = item_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert row.last_message.text == 'Service Provisioned Successfully' stack = Stack(stackname) stack.retire_stack() @request.addfinalizer def _cleanup_templates(): template.delete_all_templates()
def test_retire_stack(provider, provisioning, catalog, catalog_item, request): """Tests stack provisioning Metadata: test_flag: provision """ catalog_item, template = catalog_item DefaultView.set_default_view("Stacks", "Grid View") stack_data = prepare_stack_data(provider, provisioning) service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name, stack_data) service_catalogs.order() logger.info('Waiting for cfme provision request for service {}'.format( catalog_item.name)) row_description = catalog_item.name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=2500, delay=20) assert 'Provisioned Successfully' in row.last_message.text stack = Stack(stack_data['stack_name'], provider=provider) stack.wait_for_exists() stack.retire_stack() @request.addfinalizer def _cleanup_vms(): clean_up(stack_data, provider)
def test_retire_stack(provider, provisioning, catalog, catalog_item, request): """Tests stack provisioning Metadata: test_flag: provision """ catalog_item, template = catalog_item DefaultView.set_default_view("Stacks", "Grid View") stack_data = prepare_stack_data(provider, provisioning) service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name, stack_data) service_catalogs.order() logger.info('Waiting for cfme provision request for service {}'.format( catalog_item.name)) request_description = catalog_item.name provision_request = Request(request_description, partial_check=True) provision_request.wait_for_request() assert provision_request.is_succeeded() stack = Stack(stack_data['stack_name'], provider=provider) stack.wait_for_exists() stack.retire_stack() @request.addfinalizer def _cleanup_vms(): clean_up(stack_data, provider)
def stack(setup_provider_modscope, provider): stack = Stack(provider.data['provisioning']['stacks'][0], provider=provider) stack.wait_for_exists() yield stack try: stack.delete() except Exception: pass
def stack(setup_provider, provisioning): set_grid_view("Stacks") stackname = provisioning['stack'] stack = Stack(stackname) return stack