def test_retire_ansible_service(appliance, catalog_item, request, job_type): """Tests retiring of catalog items for Ansible Template and Workflow jobs Metadata: test_flag: provision Polarion: assignee: nachandr casecomponent: Services caseimportance: medium initialEstimate: 1/4h """ service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} order_request = appliance.collections.requests.instantiate( cells=cells, partial_check=True) order_request.wait_for_request(method='ui') msg = "Request failed with the message {}".format( order_request.row.last_message.text) assert order_request.is_succeeded(method='ui'), msg myservice = MyService(appliance, catalog_item.name) myservice.retire()
def test_retire_ansible_workflow(appliance, ansible_workflow_catitem, workflow_type, ansible_api_version_change): """Tests retiring of catalog items for Ansible Workflow templates Metadata: test_flag: provision Polarion: assignee: jhenner casecomponent: Services caseimportance: medium initialEstimate: 1/4h """ service_catalogs = ServiceCatalogs(appliance, ansible_workflow_catitem.catalog, ansible_workflow_catitem.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', ansible_workflow_catitem.name) cells = {'Description': ansible_workflow_catitem.name} order_request = appliance.collections.requests.instantiate( cells=cells, partial_check=True) order_request.wait_for_request(method='ui') msg = f"Request failed with the message {order_request.row.last_message.text}" assert order_request.is_succeeded(method='ui'), msg myservice = MyService(appliance, ansible_workflow_catitem.name) myservice.retire()
def test_retire_service(appliance, setup_provider, context, order_catalog_item_in_ops_ui): """Test retire service.""" service_name = order_catalog_item_in_ops_ui.name with appliance.context.use(context): my_service = MyService(appliance, service_name) my_service.retire()
def test_retire_service(appliance, context, myservice): """Tests my service Metadata: test_flag: provision """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_service(appliance, context, myservice): """Tests my service Metadata: test_flag: provision """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_service_ssui(appliance, setup_provider, context, order_service, request): """Test retire service.""" catalog_item = order_service with appliance.context.use(context): my_service = MyService(appliance, catalog_item.name) my_service.retire() @request.addfinalizer def _finalize(): my_service.delete()
def test_retire_service_ssui(appliance, setup_provider, context, order_service, request): """Test retire service.""" catalog_item = order_service with appliance.context.use(context): my_service = MyService(appliance, catalog_item.name) my_service.retire() @request.addfinalizer def _finalize(): my_service.delete()
def test_retire_service_ui(appliance, context, myservice): """Tests my service Metadata: test_flag: provision Polarion: assignee: sshveta initialEstimate: None """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_service_ui(appliance, context, myservice): """Tests my service Metadata: test_flag: provision Polarion: assignee: sshveta initialEstimate: 1/4h """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_ansible_service(appliance, catalog_item, request): """Tests order catalog item Metadata: test_flag: provision """ catalog_item.create() service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True) order_request.wait_for_request(method='ui') assert order_request.is_succeeded(method='ui') myservice = MyService(appliance, catalog_item.name) myservice.retire()
def test_retire_ansible_service(catalog_item, request): """Tests order catalog item Metadata: test_flag: provision """ catalog_item.create() service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1400, delay=20) assert 'Provisioned Successfully' in row.last_message.text myservice = MyService(catalog_item.name) myservice.retire()
def test_retire_ansible_service(catalog_item, request): """Tests order catalog item Metadata: test_flag: provision """ catalog_item.create() service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} order_request = Request(cells=cells, partial_check=True) order_request.wait_for_request(method='ui') assert order_request.is_succeeded() myservice = MyService(catalog_item.name) myservice.retire()
def test_retire_ansible_service(appliance, catalog_item, request): """Tests order catalog item Metadata: test_flag: provision """ service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True) order_request.wait_for_request(method='ui') msg = "Request failed with the message {}".format(order_request.row.last_message.text) assert order_request.is_succeeded(method='ui'), msg myservice = MyService(appliance, catalog_item.name) myservice.retire()
def test_retire_service_ui(appliance, context, myservice): """Tests my service Metadata: test_flag: provision Polarion: assignee: nansari casecomponent: Services initialEstimate: 1/4h tags: service """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_ansible_service_bundle(request, appliance, ansible_catalog_item, catalog, ansible_tower_dialog): """ Polarion: assignee: nansari casecomponent: Services testtype: functional initialEstimate: 1/4h startsin: 5.5 tags: service Bugzilla: 1363897 """ bundle_name = fauxfactory.gen_alphanumeric(start="bundle_") catalog_bundle = appliance.collections.catalog_bundles.create( bundle_name, description="catalog_bundle", display_in=True, catalog=catalog, dialog=ansible_tower_dialog, catalog_items=ansible_catalog_item, ) request.addfinalizer(catalog_bundle.delete_if_exists) service_catalogs = ServiceCatalogs(appliance, catalog_bundle.catalog, catalog_bundle.name) service_catalogs.order() provision_request = appliance.collections.requests.instantiate( bundle_name, partial_check=True) provision_request.wait_for_request() provision_request.remove_request(method="rest") service = MyService(appliance, ansible_tower_dialog.label) # Retire service retire_request = service.retire() assert retire_request.exists()
def order_retire_service(request, context, appliance, catalog_item): """Common method to order and then retire a service.""" with appliance: # Order the service provision_request = ServiceCatalogs(appliance, catalog=catalog_item.catalog, name=catalog_item.name).order() provision_request.wait_for_request(method='ui') assert provision_request.is_succeeded(method='ui') service = MyService(appliance, catalog_item.dialog.label) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request() if service.exists: service.delete() assert service.exists # Retire the service via UI or REST, depending on context with appliance.context.use(context): retire_request = service.retire() assert retire_request and retire_request.exists() @request.addfinalizer def _remove_retire_request(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=600, fail_func=service.browser.refresh, message="Waiting for service to retire")
def test_retire_service_ui(appliance, context, myservice): """Tests my service Metadata: test_flag: provision Polarion: assignee: nansari casecomponent: Services initialEstimate: 1/4h tags: service """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.retire()
def test_retire_ansible_service(catalog_item, request): """Tests order catalog item Metadata: test_flag: provision """ catalog_item.create() service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1400, delay=20) assert 'Provisioned Successfully' in row.last_message.text myservice = MyService(catalog_item.name) myservice.retire()
def test_service_provision_retire_from_global_region(request, replicated_appliances, provider, context, catalog_item): """From the global appliance in a multi-region appliance configuration, order and then retire a VM provisioning sevice on the remote appliance. Polarion: assignee: tpapaioa caseimportance: high casecomponent: Services initialEstimate: 1/3h """ remote_appliance, global_appliance = replicated_appliances with global_appliance: # Order the service provision_request = ServiceCatalogs(global_appliance, catalog_item.catalog, catalog_item.name).order() provision_request.wait_for_request(method='ui') assert provision_request.is_succeeded(method='ui') service = MyService(global_appliance, catalog_item.dialog.label) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request() if service.exists: service.delete() assert service.exists # Retire the service via UI or REST, depending on context if context.name == 'UI': retire_request = service.retire() assert retire_request and retire_request.exists() else: # TODO: implement retire() via REST using sentaku context services = global_appliance.rest_api.collections.services api_service = services.get(name=service.name) api_retire_requests = services.action.request_retire(api_service) assert len(api_retire_requests) == 1 api_retire_request = api_retire_requests[0] assert api_retire_request and api_retire_request.exists retire_request = global_appliance.collections.requests.instantiate( f'Service Retire for: {service.name}') @request.addfinalizer def _remove_retire_request(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=300, fail_func=service.browser.refresh, message="Waiting for service to retire") vm_name = f"{catalog_item.prov_data['catalog']['vm_name']}0001" vm = global_appliance.provider_based_collection(provider).instantiate(vm_name, provider) assert vm.wait_for_vm_state_change(from_any_provider=True, desired_state='archived')
def test_retire_service_ssui(appliance, setup_provider, context, order_service, request): """Test retire service. Metadata: test_flag: ssui, services Polarion: assignee: sshveta initialEstimate: 1/4h """ catalog_item = order_service with appliance.context.use(context): my_service = MyService(appliance, catalog_item.name) my_service.retire() @request.addfinalizer def _finalize(): my_service.delete()
def test_retire_service_ssui(appliance, setup_provider, context, order_service, request): """Test retire service. Metadata: test_flag: ssui, services Polarion: assignee: sshveta initialEstimate: None """ catalog_item = order_service with appliance.context.use(context): my_service = MyService(appliance, catalog_item.name) my_service.retire() @request.addfinalizer def _finalize(): my_service.delete()
def test_retire_ansible_service(appliance, catalog_item, request, job_type): """Tests retiring of catalog items for Ansible Template and Workflow jobs Metadata: test_flag: provision Polarion: assignee: nachandr casecomponent: Services caseimportance: medium initialEstimate: 1/4h """ service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) cells = {'Description': catalog_item.name} order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True) order_request.wait_for_request(method='ui') msg = "Request failed with the message {}".format(order_request.row.last_message.text) assert order_request.is_succeeded(method='ui'), msg myservice = MyService(appliance, catalog_item.name) myservice.retire()
def test_retire_service(appliance, setup_provider, context, order_catalog_item_in_ops_ui): """Tests retire service""" service_name = order_catalog_item_in_ops_ui.name with appliance.context.use(context): my_service = MyService(appliance, service_name) my_service.retire()
def test_retire_owned_service(request, appliance, context, user_self_service_role, generic_catalog_item): """ Bugzilla: 1628520 Polarion: assignee: nansari startsin: 5.11 casecomponent: SelfServiceUI initialEstimate: 1/6h testSteps: 1. Create a catalog item as User 2. Provision service in regular UI with user 3. Login to Service UI as User 4. Try to retire the service expectedResults: 1. 2. 3. 4. Service should retire """ user, _ = user_self_service_role # login with user having self service role with user: with appliance.context.use(context): appliance.server.login(user) # order service from catalog item serv_cat = ServiceCatalogs( appliance, catalog=generic_catalog_item.catalog, name=generic_catalog_item.name, ) if context == ViaSSUI: serv_cat.add_to_shopping_cart() provision_request = serv_cat.order() provision_request.wait_for_request() service = MyService(appliance, generic_catalog_item.dialog.label) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request(method="rest") if service.exists: service.delete() assert service.exists # Retire service retire_request = service.retire() assert retire_request.exists() @request.addfinalizer def _clear_retire_request(): if retire_request.exists(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=120, fail_func=service.browser.refresh, message="waiting for service retire")
def test_retire_service(appliance, setup_provider, context, provision_request): """Test retire service.""" catalog_item, provision_request = provision_request with appliance.context.use(context): my_service = MyService(appliance, catalog_item.name) my_service.retire()
def test_retire_service_and_bundle_vms(provider, request, appliance, catalog_item_setups): """ Bugzilla: 1654165 Polarion: assignee: nansari casecomponent: Services initialEstimate: 1/6h startsin: 5.10 testSteps: 1. Create catalog and create two catalog items 2. Create bundle with above two catalog items 3. Order the catalog bundle 4. Go to My services 5. Check the Both VMs 6. Retire the services expectedResults: 1. 2. 3. 4. 5. Both VMs should be present 6. Services should retire and vms as well """ cat_list, catalog_item = catalog_item_setups collection = provider.appliance.provider_based_collection(provider) vm_name1 = f'{cat_list[0].prov_data["catalog"]["vm_name"]}0001' vm_name2 = f'{cat_list[1].prov_data["catalog"]["vm_name"]}0002' vm1 = collection.instantiate(vm_name1, provider) vm2 = collection.instantiate(vm_name2, provider) # Creating catalog bundle of two catalog items catalog_bundle = appliance.collections.catalog_bundles.create( name=fauxfactory.gen_alphanumeric(), description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[cat_item.name for cat_item in cat_list], ) request.addfinalizer(catalog_bundle.delete_if_exists) # Ordering service catalog bundle provision_request = ServiceCatalogs(appliance, catalog_bundle.catalog, catalog_bundle.name).order() provision_request.wait_for_request(method='ui') assert provision_request.is_succeeded(method="ui") service = MyService(appliance, catalog_item.dialog.label) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request(method="rest") if service.exists: service.delete() assert service.exists # Retire service retire_request = service.retire() assert retire_request.exists() @request.addfinalizer def _clear_retire_request(): if retire_request.exists(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=120, fail_func=service.browser.refresh, message="waiting for service retire") assert vm1.wait_for_vm_state_change(from_any_provider=True, desired_state='archived') assert vm2.wait_for_vm_state_change(from_any_provider=True, desired_state='archived')
def test_retire_catalog_bundle_service_orchestration_item( appliance, request, catalog_item, stack_data): """ Bugzilla: 1684092 Polarion: assignee: nansari startsin: 5.10 casecomponent: Services initialEstimate: 1/6h testSteps: 1. Add ec2 provider 2. Provisioned the catalog bundle with ServiceOrchestration item 3. Navigate to My service page 4. Retired the bundle expectedResults: 1. 2. 3. 4. Catalog bundle should retire with no error """ bundle_name = fauxfactory.gen_alphanumeric(15, start="cat_bundle_") catalog_bundle = appliance.collections.catalog_bundles.create( bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) request.addfinalizer(catalog_bundle.delete_if_exists) # Ordering service catalog bundle service_catalogs = ServiceCatalogs(appliance, catalog_bundle.catalog, catalog_bundle.name, stack_data) provision_request = service_catalogs.order() provision_request.wait_for_request(method='ui') provision_request.is_succeeded(method="ui") last_message = provision_request.get_request_row_from_ui( )['Last Message'].text service_name = last_message.split()[2].strip('[]') service = MyService(appliance, service_name) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request(method="rest") if service.exists: service.delete() assert service.exists # Retire service retire_request = service.retire() @request.addfinalizer def _clear_retire_request(): if retire_request.exists(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=120, fail_func=service.browser.refresh, message="waiting for service retire")
def test_retire_service_bundle_and_vms(appliance, provider, catalog_item, request): """ Bugzilla: 1660637 Polarion: assignee: nansari startsin: 5.10 casecomponent: Services initialEstimate: 1/6h testSteps: 1. Create service catalog item 2. Create bundle with above catalog item 3. Order the Service bundle 4. Navigate to my service 5. Retire the service expectedResults: 1. 2. 3. 4. 5. the service should be retired and VM should be retired and archived """ collection = provider.appliance.provider_based_collection(provider) vm_name = "{}0001".format(catalog_item.prov_data["catalog"]["vm_name"]) vm = collection.instantiate(f"{vm_name}", provider) bundle_name = fauxfactory.gen_alphanumeric(12, start="bundle_") catalog_bundle = appliance.collections.catalog_bundles.create( bundle_name, description="catalog_bundle", display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog, catalog_items=[catalog_item.name]) request.addfinalizer(catalog_bundle.delete_if_exists) # Ordering service catalog bundle service_catalogs = ServiceCatalogs(appliance, catalog_bundle.catalog, catalog_bundle.name) service_catalogs.order() request_description = ( f'Provisioning Service [{catalog_bundle.name}] from [{catalog_bundle.name}]' ) provision_request = appliance.collections.requests.instantiate( request_description) provision_request.wait_for_request(method='ui') provision_request.is_succeeded(method="ui") service = MyService(appliance, catalog_item.dialog.label) @request.addfinalizer def _clear_request_service(): if provision_request.exists(): provision_request.remove_request(method="rest") if service.exists: service.delete() assert service.exists # Retire service retire_request = service.retire() assert retire_request.exists() @request.addfinalizer def _clear_retire_request(): if retire_request.exists(): retire_request.remove_request() wait_for(lambda: service.is_retired, delay=5, num_sec=120, fail_func=service.browser.refresh, message="waiting for service retire") # Vm should be archived assert vm.wait_for_vm_state_change(from_any_provider=True, desired_state='archived')