def pytest_report_header(config): """Called when pytest session starts""" messages = [] shared_function_enabled = 'OFF' scope = '' storage = 'file' if setting_is_set('shared_function'): if settings.shared_function.enabled: shared_function_enabled = 'ON' scope = settings.shared_function.scope if not scope: scope = '' storage = settings.shared_function.storage messages.append( 'shared_function enabled - {} - scope: {} - storage: {}'.format( shared_function_enabled, scope, storage ) ) # workaround for https://github.com/pytest-dev/pytest/issues/7767 # remove if resolved and set autouse=True for record_testsuite_timestamp_xml fixture if config.pluginmanager.hasplugin("junitxml"): now = datetime.datetime.utcnow() xml = config._store.get(xml_key, None) if xml: xml.add_global_property('start_time', now.strftime(FMT_XUNIT_TIME)) return messages
def get_decorated_bugs(): # pragma: no cover """Using Robozilla parser, get all IDs from skip_if_bug_open decorator and return the dictionary containing fetched data. Important information is stored on `bug_data` key:: bugs[BUG_ID]['bug_data']['resolution|status|flags|whiteboard'] """ if not settings.configured: settings.configure() # look for settings bugzilla credentials # any way Parser bugzilla reader will check for exported environment names # BUGZILLA_USER_NAME and BUGZILLA_USER_PASSWORD if no credentials was # supplied bz_reader_options = {} bz_credentials = {} if setting_is_set('bugzilla'): bz_credentials = settings.bugzilla.get_credentials() bz_reader_options['credentials'] = bz_credentials parser = Parser(BASE_PATH, filters=[BZDecorator], reader_options=bz_reader_options) bugs = parser.parse() return bugs
def client_provisioning( self, activation_key_name, organization_label, package_name='python-kitchen' ): """Provision a Satellite's client. Do the following: 1. Install Katello CA cert on the client 2. Register the client using Activation Key 3. Install a package on the client served by the Satellite server. :param activation_key_name: Name of the Activation Key to register. :param organization_label: Organization label where the Activation Key is available. :param package_name: Name of the package to be installed on the client. """ if not setting_is_set('clients'): return with VirtualMachine(distro=DISTRO_RHEL6) as vm: # Pull rpm from Foreman server and install on client vm.install_katello_ca() # Register client with foreman server using act keys vm.register_contenthost(organization_label, activation_key_name) self.assertTrue(vm.subscribed) # Install rpm on client result = vm.run('yum install -y {0}'.format(package_name)) self.assertEqual(result.return_code, 0) # Verify that the package is installed by querying it result = vm.run('rpm -q {0}'.format(package_name)) self.assertEqual(result.return_code, 0)
def pytest_report_header(config): """Called when pytest session starts""" messages = [] shared_function_enabled = 'OFF' scope = '' storage = 'file' if setting_is_set('shared_function'): if settings.shared_function.enabled: shared_function_enabled = 'ON' scope = settings.shared_function.scope if not scope: scope = '' storage = settings.shared_function.storage if pytest.config.pluginmanager.hasplugin("junitxml"): junit = getattr(config, "_xml", None) if junit is not None: now = datetime.datetime.utcnow() junit.add_global_property("start_time", now.strftime("%Y-%m-%dT%H:%M:%S")) messages.append( 'shared_function enabled - {0} - scope: {1} - storage: {2}'.format( shared_function_enabled, scope, storage)) return messages
def client_provisioning( self, activation_key_name, organization_label, package_name='python-kitchen'): """Provision a Satellite's client. Do the following: 1. Install Katello CA cert on the client 2. Register the client using Activation Key 3. Install a package on the client served by the Satellite server. :param activation_key_name: Name of the Activation Key to register. :param organization_label: Organization label where the Activation Key is available. :param package_name: Name of the package to be installed on the client. """ if not setting_is_set('clients'): return with VirtualMachine(distro=DISTRO_RHEL6) as vm: # Pull rpm from Foreman server and install on client vm.install_katello_ca() # Register client with foreman server using act keys vm.register_contenthost(organization_label, activation_key_name) self.assertTrue(vm.subscribed) # Install rpm on client result = vm.run('yum install -y {0}'.format(package_name)) self.assertEqual(result.return_code, 0) # Verify that the package is installed by querying it result = vm.run('rpm -q {0}'.format(package_name)) self.assertEqual(result.return_code, 0)
def pytest_report_header(config): """Called when pytest session starts""" messages = [] shared_function_enabled = 'OFF' scope = '' storage = 'file' if setting_is_set('shared_function'): if settings.shared_function.enabled: shared_function_enabled = 'ON' scope = settings.shared_function.scope if not scope: scope = '' storage = settings.shared_function.storage messages.append( 'shared_function enabled - {0} - scope: {1} - storage: {2}'.format( shared_function_enabled, scope, storage)) return messages
def _check_config(): global _configured global DEFAULT_STORAGE_HANDLER global ENABLED global NAMESPACE_SCOPE global SHARE_DEFAULT_TIMEOUT global DEFAULT_CALL_RETRIES if not _configured and setting_is_set('shared_function'): DEFAULT_STORAGE_HANDLER = settings.shared_function.storage ENABLED = settings.shared_function.enabled NAMESPACE_SCOPE = settings.shared_function.scope SHARE_DEFAULT_TIMEOUT = settings.shared_function.share_timeout DEFAULT_CALL_RETRIES = settings.shared_function.call_retries file_storage.LOCK_TIMEOUT = settings.shared_function.lock_timeout redis_storage.LOCK_TIMEOUT = settings.shared_function.lock_timeout redis_storage.REDIS_HOST = settings.shared_function.redis_host redis_storage.REDIS_PORT = settings.shared_function.redis_port redis_storage.REDIS_DB = settings.shared_function.redis_db redis_storage.REDIS_PASSWORD = settings.shared_function.redis_password _set_configured(True)
def setUpClass(cls): # noqa super().setUpClass() cls.fake_manifest_is_set = setting_is_set('fake_manifest')
from nailgun import entities from wrapanapi.systems.virtualcenter import vim, VMWareSystem from robottelo.api.utils import check_create_os_with_title from robottelo.datafactory import gen_string from robottelo.decorators import ( fixture, run_in_one_thread, setting_is_set, tier1, tier2 ) from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_LARGE, FOREMAN_PROVIDERS, VMWARE_CONSTANTS if not setting_is_set('vmware'): pytest.skip('skipping tests due to missing vmware settings', allow_module_level=True) def _get_normalized_size(size): """Convert a size in bytes to KB or MB or GB or TB example : _get_normalized_size(2527070196732) return '2.3 TB' :return a string size number + the corresponding suffix B or KB or MB or GB or TB """ suffixes = ['B', 'KB', 'MB', 'GB', 'TB'] suffix_index = 0
from robottelo.constants import DEFAULT_SUBSCRIPTION_NAME from robottelo.constants import DISTRO_RHEL7 from robottelo.constants import PRDS from robottelo.constants import REPOS from robottelo.constants import REPOSET from robottelo.constants import VDC_SUBSCRIPTION_NAME from robottelo.constants import VIRT_WHO_HYPERVISOR_TYPES from robottelo.decorators import setting_is_set from robottelo.decorators import skip_if_not_set from robottelo.products import RepositoryCollection from robottelo.products import RHELAnsibleEngineRepository from robottelo.vm import VirtualMachine pytestmark = [pytest.mark.run_in_one_thread] if not setting_is_set('fake_manifest'): pytest.skip('skipping tests due to missing fake_manifest settings', allow_module_level=True) @pytest.fixture(scope='module') def golden_ticket_host_setup(): org = entities.Organization().create() with manifests.clone(name='golden_ticket') as manifest: upload_manifest(org.id, manifest.content) rh_repo_id = enable_rhrepo_and_fetchid( basearch='x86_64', org_id=org.id, product=PRDS['rhel'], repo=REPOS['rhst7']['name'], reposet=REPOSET['rhst7'], releasever=None,
:CaseImportance: High :Upstream: No """ from random import choice from fauxfactory import gen_string from nailgun import entities from pytest import skip from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_SMALL, FOREMAN_PROVIDERS, LIBVIRT_RESOURCE_URL from robottelo.decorators import bz_bug_is_open, fixture, setting_is_set, tier2 if not setting_is_set('compute_resources'): skip('skipping tests due to missing compute_resources settings', allow_module_level=True) @fixture(scope='module') def module_libvirt_url(): return LIBVIRT_RESOURCE_URL % settings.compute_resources.libvirt_hostname @tier2 def test_positive_end_to_end(session, module_org, module_loc, module_libvirt_url): """Perform end to end testing for compute resource Libvirt component. :id: 4f4650c8-32f3-4dab-b3bf-9c54d0cda3b2
from nailgun import entities from pytest import skip from robottelo.api.utils import skip_yum_update_during_provisioning from robottelo.config import settings from robottelo.constants import AZURERM_FILE_URI from robottelo.constants import AZURERM_PLATFORM_DEFAULT from robottelo.constants import AZURERM_RG_DEFAULT from robottelo.constants import AZURERM_VM_SIZE_DEFAULT from robottelo.constants import COMPUTE_PROFILE_SMALL from robottelo.decorators import setting_is_set from robottelo.decorators import tier3 from robottelo.decorators import tier4 from robottelo.decorators import upgrade if not setting_is_set('azurerm'): skip('skipping tests due to missing azurerm settings', allow_module_level=True) @pytest.fixture(scope='module') def module_org(): return entities.Organization().create() @pytest.fixture(scope='module') def module_azure_cp_attrs(module_azurerm_cr, module_azurerm_finishimg): """ Create compute attributes on COMPUTE_PROFILE_SMALL """ nw_id = module_azurerm_cr.available_networks()['results'][-1]['id'] return entities.ComputeAttribute( compute_profile=COMPUTE_PROFILE_SMALL,
:CaseImportance: High :Upstream: No """ from random import choice from fauxfactory import gen_string from nailgun import entities from pytest import skip from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_SMALL, FOREMAN_PROVIDERS, LIBVIRT_RESOURCE_URL from robottelo.decorators import bz_bug_is_open, fixture, setting_is_set, tier2 if not setting_is_set('compute_resources'): skip('skipping tests due to missing compute_resources settings', allow_module_level=True) @fixture(scope='module') def module_libvirt_url(): return LIBVIRT_RESOURCE_URL % settings.compute_resources.libvirt_hostname @tier2 def test_positive_end_to_end(session, module_org, module_loc, module_libvirt_url): """Perform end to end testing for compute resource Libvirt component. :id: 4f4650c8-32f3-4dab-b3bf-9c54d0cda3b2 :expectedresults: All expected CRUD actions finished successfully.
import pytest from nailgun import entities from wrapanapi.systems.virtualcenter import vim, VMWareSystem from robottelo.api.utils import check_create_os_with_title from robottelo.datafactory import gen_string from robottelo.decorators import ( fixture, run_in_one_thread, setting_is_set, tier2 ) from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_LARGE, FOREMAN_PROVIDERS, VMWARE_CONSTANTS if not setting_is_set('vmware'): pytest.skip('skipping tests due to missing vmware settings', allow_module_level=True) def _get_normalized_size(size): """Convert a size in bytes to KB or MB or GB or TB example : _get_normalized_size(2527070196732) return '2.3 TB' :return a string size number + the corresponding suffix B or KB or MB or GB or TB """ suffixes = ['B', 'KB', 'MB', 'GB', 'TB'] suffix_index = 0
from robottelo.api.utils import check_create_os_with_title from robottelo.datafactory import gen_string from robottelo.decorators import ( fixture, parametrize, run_in_one_thread, setting_is_set, skip_if_bug_open, skip_if_not_set, tier2 ) from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_LARGE, FOREMAN_PROVIDERS if not setting_is_set('rhev'): pytest.skip('skipping tests due to missing rhev settings', allow_module_level=True) @fixture(scope='module') def module_ca_cert(): return ( None if settings.rhev.ca_cert is None else requests.get(settings.rhev.ca_cert).content.decode() ) @fixture(scope='module') def rhev_data(): return {
setting_is_set, skip_if_bug_open, skip_if_not_set, tier3, upgrade, ) from robottelo.products import ( YumRepository, RepositoryCollection, RHELAnsibleEngineRepository, SatelliteToolsRepository, ) from robottelo.vm import VirtualMachine if not setting_is_set('clients') or not setting_is_set('fake_manifest'): pytest.skip('skipping tests due to missing settings', allow_module_level=True) @fixture(scope='module') def module_org(): return entities.Organization().create() @fixture(scope='module', autouse=True) def repos_collection(module_org): """Adds required repositories, AK, LCE and CV for content host testing""" lce = entities.LifecycleEnvironment(organization=module_org).create() repos_collection = RepositoryCollection( distro=DISTRO_RHEL7, repositories=[
def test_positive_default_end_to_end_with_custom_profile( session, module_org, module_loc, module_ec2_settings): """Create EC2 compute resource with default properties and apply it's basic functionality. :id: 33f80a8f-2ecf-4f15-b0c3-aab5fe0ac8d3 :Steps: 1. Create an EC2 compute resource with default properties and taxonomies. 2. Update the compute resource name and add new taxonomies. 3. Associate compute profile with custom properties to ec2 compute resource 4. Delete the compute resource. :expectedresults: The EC2 compute resource is created, updated, compute profile associated and deleted. :CaseLevel: Integration :BZ: 1451626 :CaseImportance: High """ if not setting_is_set('http_proxy'): pytest.skip('skipping tests due to missing http_proxy settings', allow_module_level=True) cr_name = gen_string('alpha') new_cr_name = gen_string('alpha') cr_description = gen_string('alpha') new_org = entities.Organization().create() new_loc = entities.Location().create() http_proxy = entities.HTTPProxy( name=gen_string('alpha', 15), url=settings.http_proxy.auth_proxy_url, username=settings.http_proxy.username, password=settings.http_proxy.password, organization=[module_org.id], location=[module_loc.id], ).create() with session: session.computeresource.create({ 'name': cr_name, 'description': cr_description, 'provider': FOREMAN_PROVIDERS['ec2'], 'provider_content.http_proxy.value': http_proxy.name, 'provider_content.access_key': module_ec2_settings['access_key'], 'provider_content.secret_key': module_ec2_settings['secret_key'], 'provider_content.region.value': module_ec2_settings['region'], 'organizations.resources.assigned': [module_org.name], 'locations.resources.assigned': [module_loc.name], }) cr_values = session.computeresource.read(cr_name) assert cr_values['name'] == cr_name assert cr_values['description'] == cr_description assert cr_values['provider_content']['http_proxy'][ 'value'] == http_proxy.name assert cr_values['organizations']['resources']['assigned'] == [ module_org.name ] assert cr_values['locations']['resources']['assigned'] == [ module_loc.name ] session.computeresource.edit( cr_name, { 'name': new_cr_name, 'organizations.resources.assigned': [new_org.name], 'locations.resources.assigned': [new_loc.name], }, ) assert not session.computeresource.search(cr_name) cr_values = session.computeresource.read(new_cr_name) assert cr_values['name'] == new_cr_name assert set(cr_values['organizations']['resources']['assigned']) == { module_org.name, new_org.name, } assert set(cr_values['locations']['resources']['assigned']) == { module_loc.name, new_loc.name, } session.computeresource.update_computeprofile( new_cr_name, COMPUTE_PROFILE_LARGE, { 'provider_content.flavor': AWS_EC2_FLAVOR_T2_MICRO, 'provider_content.availability_zone': module_ec2_settings['availability_zone'], 'provider_content.subnet': module_ec2_settings['subnet'], 'provider_content.security_groups.assigned': module_ec2_settings['security_groups'], 'provider_content.managed_ip': module_ec2_settings['managed_ip'], }, ) cr_profile_values = session.computeresource.read_computeprofile( new_cr_name, COMPUTE_PROFILE_LARGE) assert cr_profile_values[ 'breadcrumb'] == f'Edit {COMPUTE_PROFILE_LARGE}' assert cr_profile_values['compute_profile'] == COMPUTE_PROFILE_LARGE assert cr_profile_values['compute_resource'] == '{} ({}-{})'.format( new_cr_name, module_ec2_settings['region'], FOREMAN_PROVIDERS['ec2']) assert (cr_profile_values['provider_content']['managed_ip'] == module_ec2_settings['managed_ip']) assert cr_profile_values['provider_content'][ 'flavor'] == AWS_EC2_FLAVOR_T2_MICRO session.computeresource.delete(new_cr_name) assert not session.computeresource.search(new_cr_name)
from robottelo.datafactory import gen_string from robottelo.decorators import ( bz_bug_is_open, fixture, run_in_one_thread, setting_is_set, skip_if_not_set, tier2, upgrade, ) pytestmark = [run_in_one_thread] EXTERNAL_GROUP_NAME = 'foobargroup' if not setting_is_set('ldap'): skip('skipping tests due to missing ldap settings', allow_module_level=True) @fixture(scope='module') def ldap_data(): return { 'ldap_user_name': settings.ldap.username, 'ldap_user_passwd': settings.ldap.password, 'base_dn': settings.ldap.basedn, 'group_base_dn': settings.ldap.grpbasedn, 'ldap_hostname': settings.ldap.hostname, }
def test_positive_default_end_to_end_with_custom_profile( session, module_org, module_loc, module_gce_settings): """Create GCE compute resource with default properties and apply it's basic functionality. :id: 59ffd83e-a984-4c22-b91b-cad055b4fbd7 :Steps: 1. Create an GCE compute resource with default properties. 2. Update the compute resource name and add new taxonomies. 3. Associate compute profile with custom properties to GCE compute resource 4. Delete the compute resource. :expectedresults: The GCE compute resource is created, updated, compute profile associated and deleted. :CaseLevel: Integration :CaseImportance: Critical """ if not setting_is_set('http_proxy'): skip('skipping tests due to missing http_proxy settings', allow_module_level=True) cr_name = gen_string('alpha') new_cr_name = gen_string('alpha') cr_description = gen_string('alpha') new_org = entities.Organization().create() new_loc = entities.Location().create() download_gce_cert() http_proxy = entities.HTTPProxy( name=gen_string('alpha', 15), url=settings.http_proxy.auth_proxy_url, username=settings.http_proxy.username, password=settings.http_proxy.password, organization=[module_org.id], location=[module_loc.id], ).create() with session: # Compute Resource Create and Assertions session.computeresource.create({ 'name': cr_name, 'description': cr_description, 'provider': FOREMAN_PROVIDERS['google'], 'provider_content.http_proxy.value': http_proxy.name, 'provider_content.google_project_id': module_gce_settings['project_id'], 'provider_content.client_email': module_gce_settings['client_email'], 'provider_content.certificate_path': module_gce_settings['cert_path'], 'provider_content.zone.value': module_gce_settings['zone'], 'organizations.resources.assigned': [module_org.name], 'locations.resources.assigned': [module_loc.name], }) cr_values = session.computeresource.read(cr_name) assert cr_values['name'] == cr_name assert cr_values['provider_content']['zone']['value'] assert cr_values['provider_content']['http_proxy'][ 'value'] == http_proxy.name assert cr_values['organizations']['resources']['assigned'] == [ module_org.name ] assert cr_values['locations']['resources']['assigned'] == [ module_loc.name ] assert (cr_values['provider_content']['google_project_id'] == module_gce_settings['project_id']) assert cr_values['provider_content'][ 'client_email'] == module_gce_settings['client_email'] # Compute Resource Edit/Updates and Assertions session.computeresource.edit( cr_name, { 'name': new_cr_name, 'organizations.resources.assigned': [new_org.name], 'locations.resources.assigned': [new_loc.name], }, ) assert not session.computeresource.search(cr_name) cr_values = session.computeresource.read(new_cr_name) assert cr_values['name'] == new_cr_name assert set(cr_values['organizations']['resources']['assigned']) == { module_org.name, new_org.name, } assert set(cr_values['locations']['resources']['assigned']) == { module_loc.name, new_loc.name, } # Compute Profile edit/updates and Assertions session.computeresource.update_computeprofile( new_cr_name, COMPUTE_PROFILE_SMALL, { 'provider_content.machine_type': GCE_MACHINE_TYPE_DEFAULT, 'provider_content.network': GCE_NETWORK_DEFAULT, 'provider_content.external_ip': GCE_EXTERNAL_IP_DEFAULT, 'provider_content.default_disk_size': '15', }, ) cr_profile_values = session.computeresource.read_computeprofile( new_cr_name, COMPUTE_PROFILE_SMALL) assert cr_profile_values['breadcrumb'] == 'Edit {0}'.format( COMPUTE_PROFILE_SMALL) assert cr_profile_values['compute_profile'] == COMPUTE_PROFILE_SMALL assert cr_profile_values['compute_resource'] == '{0} ({1}-{2})'.format( new_cr_name, module_gce_settings['zone'], FOREMAN_PROVIDERS['google']) assert cr_profile_values['provider_content'][ 'machine_type'] == GCE_MACHINE_TYPE_DEFAULT assert cr_profile_values['provider_content'][ 'network'] == GCE_NETWORK_DEFAULT assert cr_profile_values['provider_content'][ 'external_ip'] == GCE_EXTERNAL_IP_DEFAULT assert cr_profile_values['provider_content'][ 'default_disk_size'] == '15' # Compute Resource Delete and Assertion session.computeresource.delete(new_cr_name) assert not session.computeresource.search(new_cr_name)
skip_if_not_set, tier3, upgrade, ) from robottelo.helpers import add_remote_execution_ssh_key from robottelo.products import ( YumRepository, RepositoryCollection, RHELAnsibleEngineRepository, SatelliteToolsRepository, ) from robottelo.vm import VirtualMachine from robottelo.api.utils import wait_for_tasks from datetime import datetime, timedelta if not setting_is_set('clients') or not setting_is_set('fake_manifest'): pytest.skip('skipping tests due to missing settings', allow_module_level=True) @fixture(scope='module') def module_org(): org = entities.Organization().create() # adding remote_execution_connect_by_ip=Yes at org level entities.Parameter(name='remote_execution_connect_by_ip', value='Yes', organization=org.id).create() return org @fixture(scope='module', autouse=True)
from fauxfactory import gen_string from nailgun import entities from pytest import skip from robottelo.constants import COMPUTE_PROFILE_SMALL from robottelo.constants import FOREMAN_PROVIDERS from robottelo.constants import GCE_EXTERNAL_IP_DEFAULT from robottelo.constants import GCE_MACHINE_TYPE_DEFAULT from robottelo.constants import GCE_NETWORK_DEFAULT from robottelo.decorators import setting_is_set from robottelo.decorators import tier2 from robottelo.decorators import upgrade from robottelo.helpers import download_gce_cert from robottelo.test import settings if not setting_is_set('gce'): skip('skipping tests due to missing gce settings', allow_module_level=True) GCE_SETTINGS = dict( project_id=settings.gce.project_id, client_email=settings.gce.client_email, cert_path=settings.gce.cert_path, zone=settings.gce.zone, cert_url=settings.gce.cert_url, ) @tier2 @upgrade def test_positive_default_end_to_end_with_custom_profile(session): """Create GCE compute resource with default properties and apply it's basic functionality.
:CaseImportance: High :Upstream: No """ from fauxfactory import gen_string from nailgun import entities from pytest import skip from robottelo.config import settings from robottelo.constants import (AWS_EC2_FLAVOR_T2_MICRO, COMPUTE_PROFILE_LARGE, DEFAULT_LOC_ID, EC2_REGION_CA_CENTRAL_1, FOREMAN_PROVIDERS) from robottelo.decorators import fixture, setting_is_set, tier2 if not setting_is_set('ec2'): skip('skipping tests due to missing ec2 settings', allow_module_level=True) @fixture(scope='module') def module_org(): return entities.Organization().create() @fixture(scope='module') def module_loc(): return entities.Location(id=DEFAULT_LOC_ID).read() @fixture(scope='module') def module_ec2_settings():
""" import pytest import requests from wait_for import wait_for from nailgun import entities from robottelo.api.utils import check_create_os_with_title from robottelo.constants import DEFAULT_LOC_ID from robottelo.datafactory import gen_string from robottelo.decorators import (fixture, parametrize, run_in_one_thread, setting_is_set, skip_if_bug_open, skip_if_not_set, tier2) from robottelo.config import settings from robottelo.constants import COMPUTE_PROFILE_LARGE, FOREMAN_PROVIDERS if not setting_is_set('rhev'): pytest.skip('skipping tests due to missing rhev settings', allow_module_level=True) @fixture(scope='module') def module_ca_cert(): return (None if settings.rhev.ca_cert is None else requests.get( settings.rhev.ca_cert).content.decode()) @fixture(scope='module') def rhev_data(): return { 'rhev_url': settings.rhev.hostname, 'username': settings.rhev.username,
def __init__(self, cpu=4, ram=16384, distro=None, provisioning_server=None, image_dir=None, org_id=None, lce_id=None, organization_ids=None, location_ids=None): """Manage a virtual machine with satellite capsule product setup for client provisioning. :param int cpu: The number of CPUs usage. :param int ram: the number of RAM usage in mega bytes. :param str distro: The OS distro to use to provision the virtual machine, it's also used in capsule setup to prepare the satellite products content. :param str provisioning_server: the provisioning server url :param str image_dir: the images location path on the provisioning server. :param int org_id: The organization id used to subscribe the virtual machine and to create the products contents that the virtual machine will use to setup the capsule. :param int lce_id: the lifecycle environment used for the subscription of virtual machine :param List[int] organization_ids: the organization ids of organizations that will use the capsule. :param List[int] location_ids: the location ids for which the content will be synchronized. """ # ensure that capsule configuration exist and validate if not setting_is_set('capsule'): raise CapsuleVirtualMachineError('capsule configuration not set') if distro is None: # use the same distro as satellite host server os server_host_os_version = get_host_os_version() if server_host_os_version.startswith('RHEL6'): distro = DISTRO_RHEL6 elif server_host_os_version.startswith('RHEL7'): distro = DISTRO_RHEL7 else: raise CapsuleVirtualMachineError( 'cannot find a default compatible distro to create' ' the virtual machine') self._capsule_distro = distro self._capsule_domain = settings.capsule.domain self._capsule_instance_name = settings.capsule.instance_name self._capsule_hostname_hash = settings.capsule.hash self._capsule_hostname = settings.capsule.hostname self._ddns_package_url = settings.capsule.ddns_package_url super(CapsuleVirtualMachine, self).__init__(cpu=cpu, ram=ram, distro=distro, provisioning_server=provisioning_server, image_dir=image_dir, hostname=self._capsule_hostname, domain=self._capsule_domain, target_image=self._capsule_instance_name) self._capsule_org_id = org_id self._capsule_lce_id = lce_id if organization_ids is None: organization_ids = [] self._capsule_organization_ids = organization_ids if location_ids is None: location_ids = [] self._capsule_location_ids = location_ids self._capsule = None self._capsule_org = None self._capsule_lce = None
def __init__( self, cpu=4, ram=16384, distro=None, provisioning_server=None, image_dir=None, org_id=None, lce_id=None, organization_ids=None, location_ids=None): """Manage a virtual machine with satellite capsule product setup for client provisioning. :param int cpu: The number of CPUs usage. :param int ram: the number of RAM usage in mega bytes. :param str distro: The OS distro to use to provision the virtual machine, it's also used in capsule setup to prepare the satellite products content. :param str provisioning_server: the provisioning server url :param str image_dir: the images location path on the provisioning server. :param int org_id: The organization id used to subscribe the virtual machine and to create the products contents that the virtual machine will use to setup the capsule. :param int lce_id: the lifecycle environment used for the subscription of virtual machine :param List[int] organization_ids: the organization ids of organizations that will use the capsule. :param List[int] location_ids: the location ids for which the content will be synchronized. """ # ensure that capsule configuration exist and validate if not setting_is_set('capsule'): raise CapsuleVirtualMachineError('capsule configuration not set') name_prefix = gen_alphanumeric(4).lower() self._capsule_instance_name = ( '{0}-{1}'.format(name_prefix, settings.capsule.instance_name) ) self._capsule_domain = settings.clients.provisioning_server.split( '.', 1)[1] self._capsule_hostname = ( '{0}.{1}'.format( self._capsule_instance_name, self._capsule_domain ) ) super(CapsuleVirtualMachine, self).__init__( cpu=cpu, ram=ram, distro=distro, provisioning_server=provisioning_server, image_dir=image_dir, domain=self._capsule_domain, hostname=self._capsule_hostname, target_image=self._capsule_instance_name ) self._capsule_org_id = org_id self._capsule_lce_id = lce_id if organization_ids is None: organization_ids = [] self._capsule_organization_ids = organization_ids if location_ids is None: location_ids = [] self._capsule_location_ids = location_ids self._capsule = None self._capsule_org = None self._capsule_lce = None
def __init__(self, cpu=4, ram=16384, distro=None, provisioning_server=None, image_dir=None, org_id=None, lce_id=None, organization_ids=None, location_ids=None): """Manage a virtual machine with satellite capsule product setup for client provisioning. :param int cpu: The number of CPUs usage. :param int ram: the number of RAM usage in mega bytes. :param str distro: The OS distro to use to provision the virtual machine, it's also used in capsule setup to prepare the satellite products content. :param str provisioning_server: the provisioning server url :param str image_dir: the images location path on the provisioning server. :param int org_id: The organization id used to subscribe the virtual machine and to create the products contents that the virtual machine will use to setup the capsule. :param int lce_id: the lifecycle environment used for the subscription of virtual machine :param List[int] organization_ids: the organization ids of organizations that will use the capsule. :param List[int] location_ids: the location ids for which the content will be synchronized. """ # ensure that capsule configuration exist and validate if not setting_is_set('capsule'): raise CapsuleVirtualMachineError('capsule configuration not set') name_prefix = gen_alphanumeric(4).lower() self._capsule_instance_name = ('{0}-{1}'.format( name_prefix, settings.capsule.instance_name)) self._capsule_domain = settings.clients.provisioning_server.split( '.', 1)[1] self._capsule_hostname = ('{0}.{1}'.format(self._capsule_instance_name, self._capsule_domain)) super(CapsuleVirtualMachine, self).__init__(cpu=cpu, ram=ram, distro=distro, provisioning_server=provisioning_server, image_dir=image_dir, domain=self._capsule_domain, hostname=self._capsule_hostname, target_image=self._capsule_instance_name) self._capsule_org_id = org_id self._capsule_lce_id = lce_id if organization_ids is None: organization_ids = [] self._capsule_organization_ids = organization_ids if location_ids is None: location_ids = [] self._capsule_location_ids = location_ids self._capsule = None self._capsule_org = None self._capsule_lce = None
def __init__( self, cpu=4, ram=16384, distro=None, provisioning_server=None, image_dir=None, org_id=None, lce_id=None, organization_ids=None, location_ids=None): """Manage a virtual machine with satellite capsule product setup for client provisioning. :param int cpu: The number of CPUs usage. :param int ram: the number of RAM usage in mega bytes. :param str distro: The OS distro to use to provision the virtual machine, it's also used in capsule setup to prepare the satellite products content. :param str provisioning_server: the provisioning server url :param str image_dir: the images location path on the provisioning server. :param int org_id: The organization id used to subscribe the virtual machine and to create the products contents that the virtual machine will use to setup the capsule. :param int lce_id: the lifecycle environment used for the subscription of virtual machine :param List[int] organization_ids: the organization ids of organizations that will use the capsule. :param List[int] location_ids: the location ids for which the content will be synchronized. """ # ensure that capsule configuration exist and validate if not setting_is_set('capsule'): raise CapsuleVirtualMachineError('capsule configuration not set') if distro is None: # use the same distro as satellite host server os server_host_os_version = get_host_os_version() if server_host_os_version.startswith('RHEL6'): distro = DISTRO_RHEL6 elif server_host_os_version.startswith('RHEL7'): distro = DISTRO_RHEL7 else: raise CapsuleVirtualMachineError( 'cannot find a default compatible distro to create' ' the virtual machine') self._capsule_distro = distro self._capsule_domain = settings.capsule.domain self._capsule_instance_name = settings.capsule.instance_name self._capsule_hostname_hash = settings.capsule.hash self._capsule_hostname = settings.capsule.hostname self._ddns_package_url = settings.capsule.ddns_package_url super(CapsuleVirtualMachine, self).__init__( cpu=cpu, ram=ram, distro=distro, provisioning_server=provisioning_server, image_dir=image_dir, hostname=self._capsule_hostname, domain=self._capsule_domain, target_image=self._capsule_instance_name ) self._capsule_org_id = org_id self._capsule_lce_id = lce_id if organization_ids is None: organization_ids = [] self._capsule_organization_ids = organization_ids if location_ids is None: location_ids = [] self._capsule_location_ids = location_ids self._capsule = None self._capsule_org = None self._capsule_lce = None
def setUpClass(cls): # noqa super(EndToEndTestCase, cls).setUpClass() cls.fake_manifest_is_set = setting_is_set('fake_manifest')
from fauxfactory import gen_string from nailgun import entities from pytest import skip from robottelo.config import settings from robottelo.constants import ( AWS_EC2_FLAVOR_T2_MICRO, COMPUTE_PROFILE_LARGE, DEFAULT_LOC_ID, EC2_REGION_CA_CENTRAL_1, FOREMAN_PROVIDERS ) from robottelo.decorators import fixture, setting_is_set, tier2 if not setting_is_set('ec2'): skip('skipping tests due to missing ec2 settings', allow_module_level=True) @fixture(scope='module') def module_org(): return entities.Organization().create() @fixture(scope='module') def module_loc(): return entities.Location(id=DEFAULT_LOC_ID).read() @fixture(scope='module') def module_ec2_settings():
VIRT_WHO_HYPERVISOR_TYPES, ) from robottelo.decorators import ( run_in_one_thread, skip_if_not_set, setting_is_set, tier2, tier3, upgrade, ) from robottelo.products import RepositoryCollection, RHELAnsibleEngineRepository from robottelo.vm import VirtualMachine pytestmark = [run_in_one_thread] if not setting_is_set('fake_manifest'): skip('skipping tests due to missing fake_manifest settings', allow_module_level=True) @tier2 @upgrade def test_positive_end_to_end(session): """Upload a manifest with minimal input parameters, attempt to delete it with checking the warning message and hit 'Cancel' button after than delete it. :id: 580fc072-01e0-4f83-8cbb-2a8522d76243 :expectedresults: 1. The manifest was uploaded successfully. 2. When attempting to delete the manifest the confirmation dialog contains informative message which warns user about downsides and consequences of manifest deletion.