def test_bundles_in_bundle(catalog_item): bundle_name = "first_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name]) sec_catalog_bundle.create() third_bundle_name = "third_" + fauxfactory.gen_alphanumeric() third_catalog_bundle = CatalogBundle(name=third_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name, sec_bundle_name]) third_catalog_bundle.create() service_catalogs = ServiceCatalogs(third_catalog_bundle.catalog, third_bundle_name) service_catalogs.order() flash.assert_no_errors() logger.info('Waiting for cfme provision request for service %s', bundle_name) row_description = third_bundle_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=900, delay=20) # Success message differs between 5.6 and 5.7 if version.current_version() >= '5.7': assert 'Provisioned Successfully' in row.last_message.text else: assert row.last_message.text == 'Request complete'
def test_service_circular_reference(catalog_item): bundle_name = "first_" + generate_random_string() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, cat_item=catalog_item.name) catalog_bundle.create() sec_bundle_name = "sec_" + generate_random_string() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, cat_item=bundle_name) sec_catalog_bundle.create() with error.expected( "Error during 'Resource Add': Adding resource <%s> to Service <%s> " "will create a circular reference" % (sec_bundle_name, bundle_name)): catalog_bundle.update({ 'description': "edit_desc", 'cat_item': sec_catalog_bundle.name })
def test_bundles_in_bundle(catalog_item): bundle_name = "first_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog) catalog_bundle.create([catalog_item.name]) sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog) sec_catalog_bundle.create([bundle_name]) third_bundle_name = "third_" + fauxfactory.gen_alphanumeric() third_catalog_bundle = CatalogBundle(name=third_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog) third_catalog_bundle.create([bundle_name, sec_bundle_name]) service_catalogs = ServiceCatalogs("service_name") service_catalogs.order(catalog_item.catalog, third_catalog_bundle) flash.assert_no_errors() logger.info('Waiting for cfme provision request for service %s' % bundle_name) row_description = third_bundle_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=900, delay=20) assert row.last_message.text == 'Request complete'
def test_service_circular_reference(catalog_item): bundle_name = "first_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name]) sec_catalog_bundle.create() with error.expected("Error during 'Resource Add': Adding resource <{}> to Service <{}> " "will create a circular reference".format(sec_bundle_name, bundle_name)): catalog_bundle.update({'catalog_items': sec_catalog_bundle.name})
def test_order_catalog_bundle(appliance, provider, setup_provider, catalog_item, request): """Tests ordering a catalog bundle Metadata: test_flag: provision """ vm_name = catalog_item.provisioning_data['catalog']["vm_name"] request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider)) catalog_item.create() bundle_name = fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_bundle.name) service_catalogs.order() logger.info("Waiting for cfme provision request for service {}".format( bundle_name)) request_description = bundle_name provision_request = appliance.collections.requests.instantiate( request_description, partial_check=True) provision_request.wait_for_request() assert provision_request.is_succeeded()
def catalog_bundle(request, dialog, service_catalog_obj, appliance, a_provider): catalog_items = service_templates_ui(request, appliance.rest_api, service_dialog=dialog, service_catalog=service_catalog_obj, a_provider=a_provider, num=4) uid = fauxfactory.gen_alphanumeric() bundle_name = 'test_rest_bundle_{}'.format(uid) bundle = CatalogBundle(name=bundle_name, description='Test REST Bundle {}'.format(uid), display_in=True, catalog=service_catalog_obj, dialog=dialog, catalog_items=[item.name for item in catalog_items]) bundle.create() catalog_rest = appliance.rest_api.collections.service_catalogs.get( name=service_catalog_obj.name) bundle_rest = catalog_rest.service_templates.get(name=bundle_name) yield bundle_rest if bundle.exists: bundle.delete()
def test_order_catalog_bundle(provider, setup_provider, catalog_item, request): """Tests ordering a catalog bundle Metadata: test_flag: provision """ vm_name = catalog_item.provisioning_data["vm_name"] request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider)) catalog_item.create() bundle_name = fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog) catalog_bundle.create([catalog_item.name]) service_catalogs = ServiceCatalogs("service_name") service_catalogs.order(catalog_item.catalog, catalog_bundle) flash.assert_no_errors() logger.info('Waiting for cfme provision request for service %s' % bundle_name) row_description = bundle_name cells = {'Description': row_description} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1200, delay=20) assert row.last_message.text == 'Request complete'
def test_bundles_in_bundle(appliance, catalog_item): bundle_name = "first_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name]) sec_catalog_bundle.create() third_bundle_name = "third_" + fauxfactory.gen_alphanumeric() third_catalog_bundle = CatalogBundle( name=third_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name, sec_bundle_name]) third_catalog_bundle.create() service_catalogs = ServiceCatalogs(appliance, third_catalog_bundle.catalog, third_bundle_name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', bundle_name) request_description = third_bundle_name provision_request = appliance.collections.requests.instantiate( request_description, partial_check=True) provision_request.wait_for_request() msg = "Request failed with the message {}".format( provision_request.rest.message) assert provision_request.is_succeeded(), msg
def test_service_generic_catalog_bundle(appliance, catalog_item): bundle_name = "generic_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, bundle_name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', bundle_name) request_description = bundle_name provision_request = appliance.collections.requests.instantiate(request_description, partial_check=True) provision_request.wait_for_request() assert provision_request.is_succeeded()
def test_bundles_in_bundle(catalog_item): bundle_name = "first_" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) catalog_bundle.create() sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric() sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name]) sec_catalog_bundle.create() third_bundle_name = "third_" + fauxfactory.gen_alphanumeric() third_catalog_bundle = CatalogBundle( name=third_bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[bundle_name, sec_bundle_name]) third_catalog_bundle.create() service_catalogs = ServiceCatalogs(third_catalog_bundle.catalog, third_bundle_name) service_catalogs.order() flash.assert_no_errors() logger.info('Waiting for cfme provision request for service %s', bundle_name) request_description = third_bundle_name provision_request = Request(request_description, partial_check=True) provision_request.wait_for_request() assert provision_request.is_succeeded()
def test_order_catalog_bundle(provider_key, provider_mgmt, setup_providers, catalog_item, request): vm_name = catalog_item.provisioning_data["vm_name"] catalog_item.create() bundle_name = generate_random_string() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, cat_item=catalog_item.name) catalog_bundle.create() service_catalogs = ServiceCatalogs("service_name") service_catalogs.order(catalog_item.catalog, catalog_bundle) flash.assert_no_errors() logger.info('Waiting for cfme provision request for service %s' % bundle_name) row_description = 'Provisioning [%s] for Service [%s]' % (bundle_name, bundle_name) cells = {'Description': row_description} request.addfinalizer(lambda: cleanup_vm(vm_name, provider_key, provider_mgmt)) row, __ = wait_for(requests.wait_for_request, [cells], fail_func=requests.reload, num_sec=600, delay=20) assert row.last_message.text == 'Request complete'
def catalog_bundle(catalog_item): """ Create catalog bundle Args: catalog_item: as resource for bundle creation """ catalog_item.create() bundle_name = "bundle" + fauxfactory.gen_alphanumeric() catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) yield catalog_bundle # fixture cleanup try: catalog_bundle.delete() except NoSuchElementException: logger.warning('test_catalog_item: catalog_item yield fixture cleanup, catalog item "{}" ' 'not found'.format(catalog_bundle.name))
def test_service_ansible_playbook_bundle(ansible_catalog_item): """Ansible playbooks are not designed to be part of a cloudforms service bundle.""" view = navigate_to(CatalogBundle(), "BundleAdd") options = view.resources.select_resource.all_options assert ansible_catalog_item.name not in [o.text for o in options]