def test_all_fields_required_error_validation(provisioning, create_template): flash_msg = "Error during 'Orchestration Template creation': Validation failed: Name can't be blank" template_type = provisioning["stack_provisioning"]["template_type"] template = OrchestrationTemplate(template_type=template_type, template_name=None, description=None) with error.expected(flash_msg): template.create(create_template)
def test_name_required_error_validation(provisioning, create_template): flash_msg = \ "Error during 'Orchestration Template creation': Validation failed: Name can't be blank" template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=None, description="my template") with error.expected(flash_msg): template.create(create_template)
def test_new_template_required_error_validation(provisioning): flash_msg = "Error during Orchestration Template creation: new template content cannot be empty" template_type = provisioning["stack_provisioning"]["template_type"] template = OrchestrationTemplate( template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template" ) with error.expected(flash_msg): template.create("")
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) navigate_to(template, "Details") mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) sel.force_navigate('select_template', context={ 'template_type': template.template_type, 'template_name': template.template_name}) mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def template(provider, provisioning, dialog_name): template_type = provisioning['stack_provisioning']['template_type'] if provider.type == 'azure': template_name = 'azure-single-vm-from-user-image' else: template_name = fauxfactory.gen_alphanumeric() template = OrchestrationTemplate(template_type=template_type, template_name=template_name) if provider.type == "ec2": method = AWS_TEMPLATE.replace('CloudFormation', random_desc()) elif provider.type == "openstack": method = HEAT_TEMPLATE.replace('Simple', random_desc()) template.create(method) if provider.type != "azure": template.create_service_dialog_from_template(dialog_name, template.template_name) yield template try: template.delete() except CandidateNotFound as ex: logger.warning('Exception deleting template fixture, continuing: {}'.format(ex.message)) pass
def template(provider, provisioning, dialog_name, setup_provider): template_type = provisioning['stack_provisioning']['template_type'] template_name = fauxfactory.gen_alphanumeric() template = OrchestrationTemplate(template_type=template_type, template_name=template_name) if provider.type == "ec2": data_file = load_data_file(str(orchestration_path.join('aws_vm_template.json'))) elif provider.type == "openstack": data_file = load_data_file(str(orchestration_path.join('openstack_vm_template.data'))) elif provider.type == "azure": data_file = load_data_file(str(orchestration_path.join('azure_vm_template.json'))) template.create(data_file.read().replace('CFMETemplateName', template_name)) if provider.type != "azure": template.create_service_dialog_from_template(dialog_name, template.template_name) yield template
def test_copy_template(provisioning): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(METHOD_TORSO) template.copy_template(template.template_name + "_copied", METHOD_TORSO_copied) template.delete()
def test_copy_template(provisioning, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) copied_method = METHOD_TORSO_copied.replace('CloudFormation', fauxfactory.gen_alphanumeric()) template.copy_template(template.template_name + "_copied", copied_method) template.delete()
def template(provider, provisioning, setup_provider): template_type = provisioning['stack_provisioning']['template_type'] template_name = fauxfactory.gen_alphanumeric() template = OrchestrationTemplate(template_type=template_type, template_name=template_name) if provider.type == "ec2": data_file = load_data_file( str(orchestration_path.join('aws_vm_template.json'))) elif provider.type == "openstack": data_file = load_data_file( str(orchestration_path.join('openstack_vm_template.data'))) elif provider.type == "azure": data_file = load_data_file( str(orchestration_path.join('azure_vm_template.json'))) template.create(data_file.read().replace('CFMETemplateName', template_name)) if provider.type == "azure": dialog_name = "azure-single-vm-from-user-image" else: dialog_name = "dialog_" + fauxfactory.gen_alphanumeric() if provider.type != "azure": template.create_service_dialog_from_template(dialog_name, template.template_name) yield template, dialog_name
def template(provider, provisioning, setup_provider): template_type = provisioning['stack_provisioning']['template_type'] template_name = fauxfactory.gen_alphanumeric() template = OrchestrationTemplate(template_type=template_type, template_name=template_name) file = provisioning['stack_provisioning']['data_file'] data_file = load_data_file(str(orchestration_path.join(file))) template.create(data_file.read().replace('CFMETemplateName', template_name)) dialog_name = "dialog_" + fauxfactory.gen_alphanumeric() template.create_service_dialog_from_template(dialog_name, template.template_name) yield template, dialog_name template.delete()
def test_orchestration_template_crud(provisioning, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) with update(template): template.description = "my edited description" template.delete()
def template(provider, provisioning, dialog_name, stack): template_type = provisioning['stack_provisioning']['template_type'] template_name = fauxfactory.gen_alphanumeric() template = OrchestrationTemplate(template_type=template_type, template_name=template_name) file = provisioning['stack_provisioning']['data_file'] data_file = load_data_file(str(orchestration_path.join(file))) template.create(data_file.read().replace('CFMETemplateName', template_name)) template.create_service_dialog_from_template(dialog_name, template.template_name) yield template if stack.exists: stack.retire_stack() if template.exists: template.delete()
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate( template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) navigate_to(template, "Details") mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_remove_template_provisioning(setup_provider, provider, provisioning, catalog, request): """Tests stack provisioning Metadata: test_flag: provision """ dialog_name_new = "dialog_" + fauxfactory.gen_alphanumeric() template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate( template_type=template_type, template_name=fauxfactory.gen_alphanumeric()) template.create(METHOD_TORSO) template.create_service_dialog_from_template(dialog_name_new, 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_new, orch_template=template.template_name, provider_type=provider.name) catalog_item.create() if provider.type == 'ec2': stack_data = {'stack_name': "stack" + fauxfactory.gen_alphanumeric()} elif provider.type == 'openstack': stack_data = {'stack_name': "stack" + fauxfactory.gen_alphanumeric()} service_catalogs = ServiceCatalogs("service_name", stack_data) service_catalogs.order_stack_item(catalog.name, catalog_item) flash.assert_no_errors() template.delete() row_description = 'Provisioning Service [{}] from [{}]'.format( item_name, item_name) cells = {'Description': row_description} wait_for(lambda: requests.go_to_request(cells), num_sec=500, delay=20) row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1000, delay=20) assert row.last_message.text == 'Service_Template_Provisioning failed'
def test_tag_orchestration_template(provisioning, tag): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(METHOD_TORSO) sel.force_navigate('select_template', context={ 'template_type': template.template_type, 'template_name': template.template_name}) mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_remove_template_provisioning(setup_provider, provider, provisioning, catalog, request): """Tests stack provisioning Metadata: test_flag: provision """ dialog_name_new = "dialog_" + fauxfactory.gen_alphanumeric() template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric()) template.create(METHOD_TORSO) template.create_service_dialog_from_template(dialog_name_new, 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_new, orch_template=template.template_name, provider_type=provider.name) catalog_item.create() if provider.type == 'ec2': stack_data = { 'stack_name': "stack" + fauxfactory.gen_alphanumeric() } elif provider.type == 'openstack': stack_data = { 'stack_name': "stack" + fauxfactory.gen_alphanumeric() } service_catalogs = ServiceCatalogs("service_name", stack_data) service_catalogs.order_stack_item(catalog.name, catalog_item) flash.assert_no_errors() template.delete() row_description = 'Provisioning Service [{}] from [{}]'.format(item_name, item_name) cells = {'Description': row_description} wait_for(lambda: requests.go_to_request(cells), num_sec=500, delay=20) row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1000, delay=20) assert row.last_message.text == 'Service_Template_Provisioning failed'
def dialog(provisioning): dialog_name = "dialog_" + fauxfactory.gen_alphanumeric() template_type = provisioning['stack_provisioning']['template_type'] orch_dialog = OrchestrationTemplate(template_type=template_type) template_name = orch_dialog.create_service_dialog(dialog_name) return dialog_name, template_name