Beispiel #1
0
 def __init__(self, ipappliance):
     self.ipapp = ipappliance
     if store.slave_manager:
         sublogger_name = '{} coverage'.format(store.slave_manager.slaveid)
     else:
         sublogger_name = 'coverage'
     self.log = create_sublogger(sublogger_name)
Beispiel #2
0
 def __init__(self, ipappliance):
     self.ipapp = ipappliance
     if store.slave_manager:
         sublogger_name = '{} coverage'.format(store.slave_manager.slaveid)
     else:
         sublogger_name = 'coverage'
     self.log = create_sublogger(sublogger_name)
Beispiel #3
0
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []
        from cfme.utils.conf import cfme_data
        self.provs = sorted(set(cfme_data['management_systems'].keys()),
                            key=len,
                            reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = 'ipc://{}'.format(
            config.cache.makedir('parallelize').join(str(os.getpid())))
        ctx = zmq.Context.instance()
        self.sock = ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists

        self.worker_config = {
            'args':
            self.config.args,
            'options':
            dict(  # copy to avoid aliasing
                vars(self.config.option),
                use_sprout=False,  # Slaves don't use sprout
            ),
            'zmq_endpoint':
            zmq_endpoint,
            'appliance_data':
            getattr(self, "slave_appliances_data", {})
        }

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance,
                                     worker_config=self.worker_config)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message("using appliance {}".format(
                self.slaves[slave].appliance.url),
                               slave,
                               green=True)
Beispiel #4
0
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []
        from cfme.utils.conf import cfme_data
        self.provs = sorted(set(cfme_data['management_systems'].keys()),
                            key=len, reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = 'ipc://{}'.format(
            config.cache.makedir('parallelize').join(str(os.getpid())))
        ctx = zmq.Context.instance()
        self.sock = ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists
        slave_config = conf_path.join('slave_config.yaml')
        slave_config.check() and slave_config.remove()

        # write out the slave config
        conf.runtime['slave_config'] = {
            'args': self.config.args,
            'options': dict(  # copy to avoid aliasing
                self.config.option.__dict__,
                use_sprout=False,   # Slaves don't use sprout
            ),
            'zmq_endpoint': zmq_endpoint,
        }
        if hasattr(self, "slave_appliances_data"):
            conf.runtime['slave_config']["appliance_data"] = self.slave_appliances_data
        conf.save('slave_config')

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message("using appliance {}".format(self.slaves[slave].appliance.url),
                slave, green=True)
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.serial_collection = []  # tests that must run on a single appliance
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []

        # necessary to get list of supported providers
        version = appliances[0].version
        from cfme.markers.env_markers.provider import all_required
        self.provs = sorted([p.the_id for p in all_required(version, filters=[])],
                            key=len, reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = f'ipc://{config.cache.makedir("parallelize").join(str(os.getpid()))}'
        self.zmq_ctx = zmq.Context.instance()
        self.sock = self.zmq_ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists
        self.worker_config = {
            'args': self.config.args,
            'options': dict(  # copy to avoid aliasing
                vars(self.config.option),
                use_sprout=False,   # Slaves don't use sprout
            ),
            'zmq_endpoint': zmq_endpoint,
            'appliance_data': getattr(self, "slave_appliances_data", {})
        }

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance, worker_config=self.worker_config)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message(f"using appliance {self.slaves[slave].appliance.url}",
                               slave,
                               green=True)
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []

        # necessary to get list of supported providers
        version = appliances[0].version
        from cfme.markers.env_markers.provider import all_required
        self.provs = sorted([p.the_id for p in all_required(version, filters=[])],
                            key=len, reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = 'ipc://{}'.format(
            config.cache.makedir('parallelize').join(str(os.getpid())))
        ctx = zmq.Context.instance()
        self.sock = ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists

        self.worker_config = {
            'args': self.config.args,
            'options': dict(  # copy to avoid aliasing
                vars(self.config.option),
                use_sprout=False,   # Slaves don't use sprout
            ),
            'zmq_endpoint': zmq_endpoint,
            'appliance_data': getattr(self, "slave_appliances_data", {})
        }

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance, worker_config=self.worker_config)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message("using appliance {}".format(self.slaves[slave].appliance.url),
                slave, green=True)
Beispiel #7
0
 def __init__(self, selenium, endpoint, extra_objects=None):
     extra_objects = extra_objects or {}
     extra_objects.update({
         'appliance': endpoint.owner,
         'endpoint': endpoint,
         'store': store,
     })
     super(MiqBrowser, self).__init__(selenium,
                                      plugin_class=MiqBrowserPlugin,
                                      logger=create_sublogger('MiqBrowser'),
                                      extra_objects=extra_objects)
     self.window_handle = selenium.current_window_handle
Beispiel #8
0
 def __init__(self, selenium, endpoint, extra_objects=None):
     extra_objects = extra_objects or {}
     extra_objects.update({
         'appliance': endpoint.owner,
         'endpoint': endpoint,
         'store': store,
     })
     super(MiqBrowser, self).__init__(
         selenium,
         plugin_class=MiqBrowserPlugin,
         logger=create_sublogger('MiqBrowser'),
         extra_objects=extra_objects)
     self.window_handle = selenium.current_window_handle
Beispiel #9
0
 def __init__(self, selenium, endpoint, extra_objects=None):
     extra_objects = extra_objects or {}
     extra_objects.update({
         'appliance': endpoint.owner,
         'endpoint': endpoint,
         'store': store,
     })
     super(MiqBrowser, self).__init__(selenium,
                                      plugin_class=MiqBrowserPlugin,
                                      logger=create_sublogger('MiqBrowser'),
                                      extra_objects=extra_objects)
     self.window_handle = selenium.current_window_handle
     self.logger.info('Opened browser %s %s',
                      selenium.capabilities.get('browserName', 'unknown'),
                      selenium.capabilities.get('version', 'unknown'))
Beispiel #10
0
 def __init__(self, ipappliance):
     self.ipapp = ipappliance
     if store.slave_manager:
         sublogger_name = '{} coverage'.format(store.slave_manager.slaveid)
     else:
         sublogger_name = 'coverage'
     self.log = create_sublogger(sublogger_name)
     # We don't know exactly when the forking architecture change
     # occurred in CFME, but this code does not accurately gather
     # coverage statistics from anything below CFME 5.8.   So if the
     # version is below 5.8, we set our functions to noops.
     if self.ipapp.version < '5.8':
         raise ApplianceVersionException(
             msg='Coverage statistics collection is only supported in appliances >= 5.8',
             version=self.ipapp.version)
Beispiel #11
0
 def __init__(self, ipappliance):
     self.ipapp = ipappliance
     if store.slave_manager:
         sublogger_name = '{} coverage'.format(store.slave_manager.slaveid)
     else:
         sublogger_name = 'coverage'
     self.log = create_sublogger(sublogger_name)
     # We don't know exactly when the forking architecture change
     # occurred in CFME, but this code does not accurately gather
     # coverage statistics from anything below CFME 5.8.   So if the
     # version is below 5.8, we set our functions to noops.
     if self.ipapp.version < '5.8':
         raise ApplianceVersionException(
             msg=
             'Coverage statistics collection is only supported in appliances >= 5.8',
             version=self.ipapp.version)
Beispiel #12
0
 def __init__(self, selenium, endpoint, extra_objects=None):
     extra_objects = extra_objects or {}
     extra_objects.update({
         'appliance': endpoint.owner,
         'endpoint': endpoint,
         'store': store,
     })
     super(MiqBrowser, self).__init__(
         selenium,
         plugin_class=MiqBrowserPlugin,
         logger=create_sublogger('MiqBrowser'),
         extra_objects=extra_objects)
     self.window_handle = selenium.current_window_handle
     self.logger.info(
         'Opened browser %s %s',
         selenium.capabilities.get('browserName', 'unknown'),
         selenium.capabilities.get('version', 'unknown'))
Beispiel #13
0
from cfme.containers.image_registry import (ImageRegistry,
                                            ImageRegistryCollection)
from cfme.containers.node import Node, NodeCollection
from cfme.containers.pod import Pod, PodCollection
from cfme.containers.template import Template, TemplateCollection
from cfme.containers.container import Container, ContainerCollection
from cfme.utils.log import create_sublogger
from cfme.utils.wait import wait_for
from cfme.utils.appliance.implementations.ui import navigate_to

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(1),
    pytest.mark.provider([ContainersProvider], scope='function')
]
logger = create_sublogger("smart_management")

TEST_ITEMS = [
    ContainersTestItem(Container,
                       'container_smart_man',
                       collection_obj=ContainerCollection),
    ContainersTestItem(Template,
                       'template_smart_man',
                       collection_obj=TemplateCollection),
    ContainersTestItem(ImageRegistry,
                       'image_registry_smart_man',
                       collection_obj=ImageRegistryCollection),
    ContainersTestItem(Image,
                       'image_smart_man',
                       collection_obj=ImageCollection),
    ContainersTestItem(Node, 'node_smart_man', collection_obj=NodeCollection),
Beispiel #14
0
# -*- coding: utf-8 -*-

"""Library for event testing.

"""

from time import sleep
from threading import Thread, Event as ThreadEvent

from cfme.utils.log import create_sublogger
from manageiq_client.filters import Q

logger = create_sublogger('events')


class EventAttr(object):
    """ EventAttr helps to compare event attributes with specific method.

    Contains one event attribute and the method for comparing it.
    """
    def __init__(self, attr_type=None, cmp_func=None, **attrs):
        if len(attrs) > 1:
            raise ValueError('event attribute can have only one key=value pair')

        self.name, self.value = attrs.items()[0]
        self.type = attr_type or type(self.value)
        self.cmp_func = cmp_func

    def match(self, attr):
        """ Compares current attribute with passed attribute."""
        if not isinstance(attr, EventAttr) or self.name != attr.name:
                                            ImageRegistryCollection)
from cfme.containers.node import Node, NodeCollection
from cfme.containers.pod import Pod, PodCollection
from cfme.containers.template import Template, TemplateCollection
from cfme.containers.container import Container, ContainerCollection
from cfme.utils.log import create_sublogger
from cfme.utils.wait import wait_for
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.blockers import BZ

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(1),
    pytest.mark.provider([ContainersProvider], scope='function')
]
logger = create_sublogger("smart_management")

TEST_ITEMS = [
    pytest.mark.polarion('CMP-9948')(ContainersTestItem(
        Container, 'CMP-9948', collection_obj=ContainerCollection)),
    pytest.mark.polarion('CMP-10320')(ContainersTestItem(
        Template, 'CMP-10320', collection_obj=TemplateCollection)),
    pytest.mark.polarion('CMP-9992')(ContainersTestItem(
        ImageRegistry, 'CMP-9992', collection_obj=ImageRegistryCollection)),
    pytest.mark.polarion('CMP-9981')(ContainersTestItem(
        Image, 'CMP-9981', collection_obj=ImageCollection)),
    pytest.mark.polarion('CMP-9964')(ContainersTestItem(
        Node, 'CMP-9964', collection_obj=NodeCollection)),
    pytest.mark.polarion('CMP-9932')(ContainersTestItem(
        Pod, 'CMP-9932', collection_obj=PodCollection)),
    pytest.mark.polarion('CMP-9870')(ContainersTestItem(