Пример #1
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from random import choice

from utils import testgen, version
from utils.miq_soap import MiqVM, set_client
from utils.providers import setup_a_provider as _setup_a_provider

pytest_generate_tests = testgen.generate(
    testgen.infra_providers,
    scope="class"
)

pytestmark = [
    pytest.mark.ignore_stream("5.5", "upstream"),
    pytest.mark.uncollectif(lambda: version.current_version() >= "5.6"),
    pytest.mark.tier(3)
]


@pytest.fixture(scope="class")
def setup_a_provider():
    _setup_a_provider("infra")


@pytest.mark.usefixtures("setup_a_provider")
class TestSoapBasicInteraction(object):
    def test_connectivity(self, soap_client):
        """Tests soap
Пример #2
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.cloud.instance import Instance
from cfme.web_ui import InfoBlock, toolbar, jstimelines
from cfme.exceptions import ToolbarOptionGreyedOrUnavailable
from utils import testgen
from utils import version
from utils.blockers import BZ
from utils.log import logger
from utils.version import current_version
from utils.wait import wait_for


pytest_generate_tests = testgen.generate(testgen.cloud_providers, scope="module")

pytestmark = [pytest.mark.tier(2)]


@pytest.fixture(scope="module")
def delete_fx_provider_event(db, provider):
    logger.info("Deleting timeline events for provider name %s", provider.name)
    ems = db['ext_management_systems']
    ems_events_table_name = version.pick({version.LOWEST: 'ems_events', '5.5': 'event_streams'})
    ems_events = db[ems_events_table_name]
    with db.transaction:
        providers = (
            db.session.query(ems_events.id)
            .join(ems, ems_events.ems_id == ems.id)
            .filter(ems.name == provider.name)
        )
Пример #3
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.cloud.tenant import Tenant
from utils import testgen

pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["openstack"], scope="module")


@pytest.fixture
def tenant(provider_key):
    return Tenant(
        name=fauxfactory.gen_alphanumeric(8), description=fauxfactory.gen_alphanumeric(8), provider_key=provider_key
    )


def test_tenant(provider_mgmt, tenant, provider_key):
    """ Tests tenant (currently disabled)

    Metadata:
        test_flag: tenant
    """
    print tenant.name, tenant.description, provider_key
Пример #4
0
"""This module contains REST API specific tests."""
import fauxfactory
import pytest

from cfme import Credential
from cfme.configure.access_control import User, Group
from cfme.login import login
from cfme.rest import vm as _vm
from utils.providers import setup_a_provider as _setup_a_provider
from utils.version import current_version
from utils import testgen, conf, version


pytest_generate_tests = testgen.generate(
    testgen.provider_by_type,
    ['virtualcenter', 'rhevm'],
    scope="module"
)


@pytest.fixture(scope="module")
def a_provider():
    return _setup_a_provider("infra")


@pytest.mark.usefixtures("logged_in")
@pytest.fixture(scope='function')
def user():
    user = User(credential=Credential(principal=fauxfactory.gen_alphanumeric(),
        secret=fauxfactory.gen_alphanumeric()), name=fauxfactory.gen_alphanumeric(),
        group=Group(description='EvmGroup-super_administrator'))
Пример #5
0
import pytest

import cfme.web_ui.flash as flash
import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme.common.provider import BaseProvider
from cfme.exceptions import FlashMessageException
from cfme.infrastructure.provider import discover, wait_for_a_provider, InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from utils import testgen, providers, version
from utils.update import update
from utils.api import APIException
from cfme import test_requirements

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="function")


@pytest.fixture(scope="module")
def setup_a_provider():
    return providers.setup_a_provider(prov_class="infra", validate=True, check_existing=True)


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.discovery
def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None)
    flash.assert_message_match('At least 1 item must be selected for discovery')
Пример #6
0
from cfme.middleware.provider.hawkular import HawkularProvider
from cfme.middleware.server import MiddlewareServer
from cfme.web_ui import flash
from utils import testgen
from utils.version import current_version
from server_methods import verify_server_running, verify_server_stopped
from server_methods import get_servers_set, verify_server_suspended
from server_methods import get_eap_server, get_hawkular_server
from server_methods import verify_server_starting, verify_server_stopping
from server_methods import get_eap_container_server

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate([HawkularProvider], scope="function")


@pytest.yield_fixture(scope="function")
def server(provider):
    server = get_eap_server(provider)
    yield server
    server.restart_server()


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
Пример #7
0
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.services import requests
from utils import normalize_text, testgen
from utils.rest import assert_response
from utils.generators import random_vm_name
from utils.log import logger
from utils.update import update
from utils.version import current_version
from utils.wait import wait_for, RefreshTimer

pytestmark = [pytest.mark.meta(server_roles="+automate"),
              test_requirements.provision, pytest.mark.tier(2)]


pytest_generate_tests = testgen.generate(
    [CloudProvider], required_fields=[['provisioning', 'image']], scope="function")


@pytest.yield_fixture(scope="function")
def testing_instance(request, setup_provider, provider, provisioning, vm_name):
    """ Fixture to prepare instance parameters for provisioning
    """
    image = provisioning['image']['name']
    note = ('Testing provisioning from image {} to vm {} on provider {}'.format(
        image, vm_name, provider.key))

    instance = Instance.factory(vm_name, provider, image)

    inst_args = dict()

    # Base instance info
Пример #8
0
from cfme.common.provider import BaseProvider
from cfme.containers.provider import ContainersProvider
from cfme.middleware.provider import MiddlewareProvider
from fixtures.provider import setup_or_skip
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version

# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate(
    [ContainersProvider, MiddlewareProvider], scope="module")

pytestmark = [pytest.mark.tier(1), test_requirements.c_and_u]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled('ems_metrics_coordinator',
                                  'ems_metrics_collector',
                                  'ems_metrics_processor'):
            candu.enable_all()
            yield
    finally:
        candu.disable_all()
Пример #9
0
import pytest

from cfme.infrastructure import pxe
from utils.update import update
from utils.testgen import generate, pxe_servers

pytest_generate_tests = generate(gen_func=pxe_servers)


@pytest.fixture(scope='function')
def has_no_pxe_servers():
    pxe.remove_all_pxe_servers()


@pytest.mark.tier(2)
@pytest.mark.usefixtures('has_no_pxe_servers')
def test_pxe_server_crud(pxe_name, pxe_server_crud):
    """
    Basic Add test for PXE server including refresh.
    """
    pxe_server_crud.create(refresh_timeout=300)
    with update(pxe_server_crud):
        pxe_server_crud.name = "{}_update".format(pxe_server_crud.name)
    pxe_server_crud.delete(cancel=False)
Пример #10
0
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme import test_requirements
from utils import conf, testgen
from utils.blockers import BZ
from utils.generators import random_vm_name
from utils.hosts import setup_host_creds
from utils.log import logger
from utils.pretty import Pretty
from utils.update import update
from utils.virtual_machines import deploy_template
from utils.wait import wait_for, TimedOutError
from . import do_scan, wait_for_ssa_enabled


pytest_generate_tests = testgen.generate(gen_func=testgen.all_providers, scope="module")

pytestmark = [
    pytest.mark.long_running,
    pytest.mark.meta(blockers=[
        BZ(
            1149128,
            unblock=lambda provider: not provider.one_of(SCVMMProvider))
    ]),
    pytest.mark.meta(server_roles="+automate +smartproxy +smartstate"),
    pytest.mark.tier(2),
    test_requirements.control
]


class VMWrapper(Pretty):
Пример #11
0
from utils.datafile import load_data_file
from utils.log import logger
from utils.wait import wait_for


pytestmark = [
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.ignore_stream("upstream"),
    test_requirements.stack,
    pytest.mark.tier(2)
]


pytest_generate_tests = testgen.generate(
    [CloudProvider], required_fields=[
        ['provisioning', 'stack_provisioning']
    ],
    scope="module")


@pytest.yield_fixture(scope="function")
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')))
Пример #12
0
# -*- coding: utf-8 -*-
"""This module contains REST API specific tests."""
import fauxfactory
import pytest

from cfme.configure.configuration import server_roles_disabled

from utils import error, mgmt_system, testgen
from utils.providers import setup_a_provider as _setup_a_provider, get_mgmt
from utils.version import current_version
from utils.virtual_machines import deploy_template
from utils.wait import wait_for

pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         ['virtualcenter', 'rhevm'],
                                         "small_template",
                                         scope="module")

pytestmark = [pytest.mark.ignore_stream("5.2")]


@pytest.fixture(scope="module")
def setup_a_provider():
    return _setup_a_provider("infra")


@pytest.fixture(scope="module")
def provision_data(rest_api_modscope, provider, small_template):
    templates = rest_api_modscope.collections.templates.find_by(
        name=small_template)
    for template in templates:
Пример #13
0
from utils import version, testgen
from utils.appliance.implementations.ui import navigate_to
from utils.generators import random_vm_name
from utils.log import logger
from utils.providers import ProviderFilter
from utils.wait import wait_for

pytestmark = [
    pytest.mark.tier(2),
    pytest.mark.usefixtures("setup_provider_modscope")
]
not_scvmm = ProviderFilter(classes=[SCVMMProvider],
                           inverted=True)  # scvmm doesn't provide events
all_prov = ProviderFilter(classes=[InfraProvider])
pytest_generate_tests = testgen.generate(gen_func=testgen.providers,
                                         filters=[not_scvmm, all_prov],
                                         scope='module')


@pytest.fixture(scope="module")
def new_vm(request, provider):
    vm = VM.factory(random_vm_name("timelines", max_length=16), provider)

    request.addfinalizer(vm.delete_from_provider)

    if not provider.mgmt.does_vm_exist(vm.name):
        logger.info("deploying %s on provider %s", vm.name, provider.key)
        vm.create_on_provider(allow_skip="default", find_in_cfme=True)
    return vm

from selenium.common.exceptions import WebDriverException
from cfme.infrastructure.provider import wait_for_a_provider
from cfme.infrastructure.virtual_machines import Vm
import cfme.fixtures.pytest_selenium as sel
from time import sleep
from urlparse import urlparse
from utils import db, testgen, version
from utils.appliance import provision_appliance
from utils.conf import credentials
from utils.log import logger
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [pytest.mark.long_running]

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="module")

random_vm_test = []


def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.provider_by_type(
        metafunc, ['virtualcenter'], choose_random=True)
    if not idlist:
        return
    new_idlist = []
    new_argvalues = []
    if 'random_pwr_ctl_vm' in metafunc.fixturenames:
        if random_vm_test:
            argnames, new_argvalues, new_idlist = random_vm_test
        else:
Пример #15
0
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.virtual_machines import Vm  # For Vm.Snapshot
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.conf import credentials
from utils.log import logger
from utils.path import data_path
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [
    pytest.mark.long_running,
    pytest.mark.tier(2), test_requirements.snapshot
]

pytest_generate_tests = testgen.generate([InfraProvider], scope="module")


@pytest.fixture(scope="module")
def vm_name():
    return "test_snpsht_" + fauxfactory.gen_alphanumeric()


@pytest.fixture(scope="module")
def domain(request):
    dom = DomainCollection().create(name=fauxfactory.gen_alpha(), enabled=True)
    request.addfinalizer(dom.delete_if_exists)
    return dom


@pytest.fixture(scope="module")
from cfme.automate.explorer.domain import DomainCollection
from cfme.services.requests import Request
from cfme import test_requirements
from utils.log import logger
from utils.update import update
from utils import testgen

pytestmark = [
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.usefixtures('vm_name', 'catalog_item', 'uses_infra_providers'),
    test_requirements.service, pytest.mark.long_running
]

pytest_generate_tests = testgen.generate(
    [InfraProvider],
    required_fields=[['provisioning', 'template'], ['provisioning', 'host'],
                     ['provisioning', 'datastore']],
    scope="module")


@pytest.fixture(scope="function")
def create_domain(request):
    """Create new domain and copy instance from ManageIQ to this domain"""

    dc = DomainCollection()
    new_domain = dc.create(name=fauxfactory.gen_alphanumeric(), enabled=True)
    request.addfinalizer(new_domain.delete_if_exists)
    instance = dc.instantiate(name='ManageIQ')\
        .namespaces.instantiate(name='Service')\
        .namespaces.instantiate(name='Provisioning')\
        .namespaces.instantiate(name='StateMachines')\
Пример #17
0
from cfme import test_requirements
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from utils import testgen
from utils.blockers import BZ
from utils.log import logger

pytestmark = [pytest.mark.tier(3),
              test_requirements.report,
              pytest.mark.usefixtures('setup_provider')]

pytest_generate_tests = testgen.generate(
    [OpenStackProvider, EC2Provider, RHEVMProvider, VMwareProvider],
    scope='module')


@pytest.yield_fixture(scope='module')
def create_report():
    # TODO parameterize on path, for now test infrastructure reports
    path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
    report = CannedSavedReport.new(path)
    report_time = report.datetime
    logger.debug('Created report for path {} and time {}'.format(path, report_time))
    yield report

    try:
        report.delete()
    except Exception:
Пример #18
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.cloud.instance import instance_factory, details_page
from cfme.web_ui import toolbar, jstimelines
from utils import testgen
from utils.log import logger
from cfme.exceptions import ToolbarOptionGreyed
from utils.wait import wait_for

pytestmark = [pytest.mark.ignore_stream("5.2")]
# bz1127960 = pytest.mark.bugzilla(
#    1127960, unskip={1127960: lambda appliance_version: appliance_version >= "5.3"})


pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         provider_types=['openstack'], scope="module")


@pytest.fixture(scope="module")
def delete_fx_provider_event(db, provider_crud):
    logger.debug("Deleting timeline events for provider name {}".format(provider_crud.name))
    ems = db['ext_management_systems']
    ems_events = db['ems_events']
    with db.transaction:
        providers = (
            db.session.query(ems_events.id)
            .join(ems, ems_events.ems_id == ems.id)
            .filter(ems.name == provider_crud.name)
        )
        db.session.query(ems_events).filter(ems_events.id.in_(providers.subquery())).delete(False)
Пример #19
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.cloud.tenant import Tenant
from utils import testgen

pytest_generate_tests = testgen.generate(testgen.provider_by_type, ['openstack'],
                                         scope='module')


@pytest.fixture
def tenant(provider):
    return Tenant(name=fauxfactory.gen_alphanumeric(8),
                  description=fauxfactory.gen_alphanumeric(8),
                  provider_key=provider.key)


@pytest.mark.uncollect()
def test_tenant(tenant, provider):
    """ Tests tenant (currently disabled)

    Metadata:
        test_flag: tenant
    """
    pass
from cfme.configure import configuration as conf
from selenium.common.exceptions import WebDriverException
from cfme.infrastructure.provider import wait_for_a_provider
import cfme.fixtures.pytest_selenium as sel
from time import sleep
from urlparse import urlparse
from utils import db, testgen, version
from utils.appliance import provision_appliance
from utils.conf import credentials
from utils.log import logger
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [pytest.mark.long_running]

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="module")

random_vm_test = []


def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.provider_by_type(
        metafunc, ['virtualcenter'], choose_random=True)
    if not idlist:
        return
    new_idlist = []
    new_argvalues = []
    if 'random_pwr_ctl_vm' in metafunc.fixturenames:
        if random_vm_test:
            argnames, new_argvalues, new_idlist = random_vm_test
        else:
Пример #21
0
import cfme.fixtures.pytest_selenium as sel
from cfme.base.credential import Credential
from cfme.exceptions import FlashMessageException
from cfme.cloud.provider import (discover, wait_for_a_provider, CloudProvider,
                                 prop_region)
from cfme import test_requirements
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.web_ui import fill, flash
from utils import testgen, version
from utils.appliance.implementations.ui import navigate_to
from utils.update import update
from cfme.rest.gen_data import arbitration_profiles as _arbitration_profiles
from cfme.rest.gen_data import _creating_skeleton as creating_skeleton

pytest_generate_tests = testgen.generate([CloudProvider], scope="function")


@pytest.mark.tier(3)
@test_requirements.discovery
def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None, d_type="Amazon")
    ident = version.pick({version.LOWEST: 'User ID', '5.4': 'Username'})
    flash.assert_message_match('{} is required'.format(ident))


@pytest.mark.tier(3)
@test_requirements.discovery
def test_discovery_cancelled_validation():
    """ Tests that the flash message is correct when discovery is cancelled."""
Пример #22
0
import fauxfactory
import pytest

from cfme import test_requirements
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from utils.wait import wait_for
from utils import testgen
from utils.version import current_version
from utils.blockers import BZ

pytestmark = [test_requirements.provision]

pytest_generate_tests = testgen.generate([VMwareProvider, RHEVMProvider],
                                         scope="module")


def get_provision_data(rest_api, provider, small_template, auto_approve=True):
    templates = rest_api.collections.templates.find_by(name=small_template)
    for template in templates:
        try:
            ems_id = template.ems_id
        except AttributeError:
            continue
        if ems_id == provider.id:
            guid = template.guid
            break
    else:
        raise Exception(
            "No such template {} on provider!".format(small_template))
Пример #23
0
import utils.error as error
from cfme.middleware.provider.hawkular import HawkularProvider
from cfme.web_ui import fill, flash, form_buttons
from cfme.fixtures import pytest_selenium as sel
from cfme.exceptions import FlashMessageException
from utils import testgen
from utils.update import update
from utils.version import current_version
from utils.appliance.implementations.ui import navigate_to


pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]

pytest_generate_tests = testgen.generate(testgen.middleware_providers, scope="function")


@pytest.mark.usefixtures('has_no_middleware_providers')
def test_provider_add_with_bad_credentials(provider):
    """ Tests provider add with bad credentials"""
    provider.credentials['default'] = provider.Credential(
        principal='bad',
        secret='reallybad'
    )
    with error.expected('Credential validation was not successful: Invalid credentials'):
        provider.create(validate_credentials=True)
    assert (not provider.add_provider_button.can_be_clicked)


def test_add_cancelled_validation():
Пример #24
0
import pytest
from cfme.middleware.server import MiddlewareServer
from utils import testgen
from utils.version import current_version

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["hawkular"], scope="function")


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
        * Get headers from UI
        * Compare headers from UI with expected headers list
        * Compare content of all the list [UI, Database, Management system]
    """
    ui_servers = _get_servers_set(MiddlewareServer.servers())
    db_servers = _get_servers_set(MiddlewareServer.servers_in_db())
    mgmt_servers = _get_servers_set(MiddlewareServer.servers_in_mgmt())
    headers = MiddlewareServer.headers()
    headers_expected = ['Server Name', 'Product', 'Host Name', 'Feed', 'Provider']
    assert headers == headers_expected
    assert ui_servers == db_servers == mgmt_servers, \
        ("Lists of servers mismatch! UI:{}, DB:{}, MGMT:{}"
         .format(ui_servers, db_servers, mgmt_servers))
Пример #25
0
from cfme.automate.simulation import simulate
from cfme.common.vm import VM
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure.virtual_machines import Vm  # For Vm.Snapshot
from utils import testgen
from utils.conf import credentials
from utils.log import logger
from utils.path import data_path
from utils.ssh import SSHClient
from utils.wait import wait_for


pytestmark = [pytest.mark.long_running]


pytest_generate_tests = testgen.generate(testgen.infra_providers, 'full_template', scope="module")


@pytest.fixture(scope="module")
def vm_name():
    return "test_snpsht_" + fauxfactory.gen_alphanumeric()


@pytest.fixture(scope="module")
def domain(request):
    dom = Domain(fauxfactory.gen_alpha(), enabled=True)
    dom.create()
    request.addfinalizer(dom.delete)
    return dom

Пример #26
0
import pytest
from random import choice
from selenium.common.exceptions import NoSuchElementException

from cfme.configure.tasks import is_host_analysis_finished
from cfme.infrastructure.deployment_roles import DeploymentRoles
from cfme.infrastructure.host import Host
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.web_ui import flash, Quadicon, summary_title, toolbar
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.wait import wait_for


pytest_generate_tests = testgen.generate([OpenstackInfraProvider],
                                         scope='module')
pytestmark = [pytest.mark.usefixtures("setup_provider_modscope")]


ROLES = ['NovaCompute', 'Controller', 'Compute', 'BlockStorage', 'SwiftStorage',
         'CephStorage']


def test_host_role_association(provider, soft_assert):
    navigate_to(provider, 'ProviderNodes')
    names = [q.name for q in list(Quadicon.all())]
    for node in names:
        host = Host(node, provider=provider)
        host.run_smartstate_analysis()
        wait_for(is_host_analysis_finished, [host.name], delay=15,
                 timeout="10m", fail_func=toolbar.refresh)
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.cloud.provider.ec2 import EC2Provider
from utils import testgen, version
from utils.appliance.implementations.ui import navigate_to
from utils.generators import random_vm_name
from utils.log import logger
from utils.wait import wait_for

pytestmark = [
    pytest.mark.tier(2),
    pytest.mark.uncollectif(lambda provider: provider.one_of(EC2Provider) and
                            version.current_version() < '5.8'),
    pytest.mark.usefixtures("setup_provider_modscope")
]
pytest_generate_tests = testgen.generate(
    [AzureProvider, OpenStackProvider, EC2Provider], scope="module")


def ec2_sleep():
    # CFME currently obtains events from AWS Config thru AWS SNS
    # EC2 Config creates config diffs apprx. every 10 minutes
    # This workaround is needed until CFME starts using CloudWatch + CloudTrail instead
    sleep(900)


@pytest.fixture(scope="module")
def new_instance(request, provider):
    instance = Instance.factory(random_vm_name("timelines", max_length=16),
                                provider)

    request.addfinalizer(instance.delete_from_provider)
Пример #28
0
import pytest
from cfme import test_requirements
from cfme.common.vm import VM
from cfme.infrastructure import host, datastore, cluster, resource_pool
from cfme.infrastructure.cluster import ClusterCollection
from cfme.infrastructure.provider import InfraProvider
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.wait import wait_for


pytestmark = [pytest.mark.tier(3),
              test_requirements.general_ui]


pytest_generate_tests = testgen.generate(
    [InfraProvider], required_fields=['remove_test'], scope="module")


def test_delete_cluster_appear_after_refresh(setup_provider, provider):
    """ Tests delete cluster

    Metadata:
        test_flag: delete_object
    """
    cluster_name = provider.data['remove_test']['cluster']
    test_cluster = cluster.Cluster(name=cluster_name, provider=provider)
    test_cluster.delete(cancel=False, wait=True)
    provider.refresh_provider_relationships()
    test_cluster.wait_for_exists()

Пример #29
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from random import choice

from utils import testgen, version
from utils.miq_soap import MiqVM, set_client
from utils.providers import setup_a_provider as _setup_a_provider

pytest_generate_tests = testgen.generate(testgen.infra_providers,
                                         scope="class")

pytestmark = [
    pytest.mark.ignore_stream("5.5", "upstream"),
    pytest.mark.uncollectif(lambda: version.current_version() >= "5.6"),
    pytest.mark.tier(3)
]


@pytest.fixture(scope="class")
def setup_a_provider():
    _setup_a_provider("infra")


@pytest.mark.usefixtures("setup_a_provider")
class TestSoapBasicInteraction(object):
    def test_connectivity(self, soap_client):
        """Tests soap

        Metadata:
Пример #30
0
from cfme.middleware.provider import MiddlewareProvider
from utils import testgen
from utils import version
from utils.version import current_version
from cfme.middleware.server import MiddlewareServer
from cfme.middleware.messaging import MiddlewareMessaging
from cfme.middleware.datasource import MiddlewareDatasource
from cfme.middleware.domain import MiddlewareDomain
from cfme.middleware.server_group import MiddlewareServerGroup
from cfme.middleware.deployment import MiddlewareDeployment

pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate([MiddlewareProvider],
                                         scope='function')

TOPOLOGY_TYPES = {
    "servers": {"MiddlewareServer"},
    "deployments": {
        "MiddlewareDeployment", "MiddlewareDeploymentWar",
        "MiddlewareDeploymentEar"
    },
    "datasources": {"MiddlewareDatasource"},
    "messaging": {"MiddlewareMessaging"},
    "vms": {"Vm"},
    "containers": {"Container"},
    "domains": {"MiddlewareDomain"},
    "server_groups": {"MiddlewareServerGroup"}
}
Пример #31
0
from cfme.automate.explorer import Domain, Namespace, Class, Method
from utils import testgen
from utils.log import logger
from utils.wait import wait_for

pytestmark = [
    pytest.mark.usefixtures("vm_name"),
    pytest.mark.usefixtures("catalog_item"),
    pytest.mark.usefixtures('uses_infra_providers'), pytest.mark.long_running,
    pytest.mark.ignore_stream("upstream"),
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.tier(3)
]

pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         ['virtualcenter'],
                                         scope="module")


@pytest.fixture(scope="function")
def copy_domain(request):
    domain = Domain(name=fauxfactory.gen_alphanumeric(), enabled=True)
    domain.create()
    request.addfinalizer(lambda: domain.delete() if domain.exists() else None)
    return domain


@pytest.fixture
def myservice(setup_provider, provider, catalog_item, request):
    vm_name = catalog_item.provisioning_data["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
Пример #32
0
from cfme.common.provider import BaseProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate(testgen.provider_by_type, [
    'container', 'middleware'], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
Пример #33
0
from cfme.middleware.provider import MiddlewareProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate([ContainersProvider, MiddlewareProvider], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
Пример #34
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.common.vm import VM
from cfme.infrastructure.provider.scvmm import SCVMMProvider
from utils import testgen

pytest_generate_tests = testgen.generate([SCVMMProvider], scope="module")


@pytest.mark.meta(blockers=[1178961])
@pytest.mark.uncollectif(
    lambda provider: "host_group" in provider.data.get("provisioning", {}),
    reason="No host group")
def test_no_dvd_ruins_refresh(provider, small_template):
    host_group = provider.data["provisioning"]["host_group"]
    with provider.mgmt.with_vm(small_template,
                               vm_name="test_no_dvd_{}".format(
                                   fauxfactory.gen_alpha()),
                               host_group=host_group) as vm_name:
        provider.mgmt.disconnect_dvd_drives(vm_name)
        vm = VM.factory(vm_name, provider)
        provider.refresh_provider_relationships()
        vm.wait_to_appear()
Пример #35
0
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from utils import testgen
from utils.blockers import BZ
from utils.log import logger

pytestmark = [
    pytest.mark.tier(3), test_requirements.report,
    pytest.mark.usefixtures('setup_provider')
]

pytest_generate_tests = testgen.generate(
    [OpenStackProvider, EC2Provider, RHEVMProvider, VMwareProvider],
    scope='module')


@pytest.yield_fixture(scope='module')
def create_report():
    # TODO parameterize on path, for now test infrastructure reports
    path = [
        "Configuration Management", "Hosts", "Virtual Infrastructure Platforms"
    ]
    report = CannedSavedReport.new(path)
    report_time = report.datetime
    logger.debug('Created report for path {} and time {}'.format(
        path, report_time))
    yield report
import pytest
from itertools import product
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import Table
from cfme.web_ui import search

from utils import testgen
from utils.version import current_version

pytestmark = [
    pytest.mark.uncollectif(
        lambda: current_version() < "5.6"),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(3)]
pytest_generate_tests = testgen.generate(
    testgen.container_providers, scope='function')


PROJECTS_SEARCH_STRINGS = ['*', 'infra', '$', 'management-infra']
ROUTES_SEARCH_STRINGS = ['*', 'front', '$', 'frontend']
table_el = '//table[contains(@class, ' \
           '"table table-striped table-bordered table-hover table-selectable")]'

# CMP-9871


@pytest.mark.parametrize('projects_search_strings', product(PROJECTS_SEARCH_STRINGS))
def test_projects_search(projects_search_strings):
    """ Projects summary page - Search bar

           This test checks Search bar functionality on the Projects summary page
Пример #37
0
import fauxfactory
import uuid

import pytest

import utils.error as error
from cfme import Credential
from cfme.exceptions import FlashMessageException
from cfme.cloud.provider import (discover, EC2Provider, wait_for_a_provider,
                                 Provider, OpenStackProvider, properties_form)
from cfme.web_ui import fill, flash
from utils import testgen, version
from utils.providers import get_credentials_from_config
from utils.update import update

pytest_generate_tests = testgen.generate(testgen.cloud_providers,
                                         scope="function")


def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None, d_type="Amazon")
    ident = version.pick({version.LOWEST: 'User ID', '5.4': 'Username'})
    flash.assert_message_match('{} is required'.format(ident))


def test_discovery_cancelled_validation():
    """ Tests that the flash message is correct when discovery is cancelled."""
    discover(None, cancel=True, d_type="Amazon")
    msg = version.pick({
        version.LOWEST:
        'Amazon Cloud Providers Discovery was cancelled by the user',
Пример #38
0
import pytest

from cfme.configure.access_control import simple_user
from cfme.login import login
from cfme.web_ui import menu
from utils.conf import credentials
from utils.testgen import auth_groups, generate
from utils import version
from utils.providers import setup_a_provider

pytest_generate_tests = generate(auth_groups, auth_mode='ldap')


@pytest.fixture(scope="module")
def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)


@pytest.mark.tier(2)
def test_group_roles(configure_ldap_auth_mode, group_name, group_data,
                     setup_first_provider):
    """Basic default LDAP group role RBAC test

    Validates expected menu and submenu names are present for default
    LDAP group roles

    """

    # This should be removed but currently these roles are subject to a bug
    if version.current_version() >= '5.4' and group_name in [
            'evmgroup-administrator', 'evmgroup-approver', 'evmgroup-auditor',
Пример #39
0
"""Tests for Openstack cloud instances"""

import fauxfactory
import pytest

from cfme.cloud.instance.openstack import OpenStackInstance
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.host import Host
from cfme.web_ui import Quadicon
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.version import current_version

pytest_generate_tests = testgen.generate([OpenStackProvider], scope='module')

pytestmark = [pytest.mark.usefixtures("setup_provider_modscope")]


@pytest.fixture(scope='function')
def new_instance(provider):
    prov_data = provider.get_yaml_data()['provisioning']
    instance = OpenStackInstance(fauxfactory.gen_alpha(),
                                 provider,
                                 template_name=prov_data['image']['name'])
    navigate_to(instance, 'Provision')
    instance.create(fauxfactory.gen_email(),
                    fauxfactory.gen_alpha(),
                    fauxfactory.gen_alpha(),
                    prov_data['cloud_network'],
                    prov_data['instance_type'],
                    False,
Пример #40
0
import pytest

from cfme.login import login
from cfme.web_ui import menu
from utils.conf import credentials
from utils.testgen import auth_groups, generate

pytest_generate_tests = generate(auth_groups, auth_mode='ldap')


def test_group_roles(configure_ldap_auth_mode, group_name, group_data):
    """Basic default LDAP group role RBAC test

    Validates expected menu and submenu names are present for default
    LDAP group roles

    """
    try:
        username = credentials[group_name]['username']
        password = credentials[group_name]['password']
    except KeyError:
        pytest.fail('No match in credentials file for group "%s"' % group_name)

    login(username, password)
    assert set(menu.visible_pages()) == set(group_data)
Пример #41
0
import pytest

from cfme.middleware.messaging import MiddlewareMessaging
from cfme.middleware.provider import get_random_list
from cfme.middleware.provider.hawkular import HawkularProvider
from utils import testgen
from utils.version import current_version
from server_methods import get_hawkular_server

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate([HawkularProvider], scope="function")
ITEMS_LIMIT = 1  # when we have big list, limit number of items to test


def test_list_messagings():
    """Tests messagings list between UI, DB and Management system
    This test requires that no any other provider should exist before.

    Steps:
        * Get messagings list from UI
        * Get messagings list from Database
        * Get messagings list from Management system(Hawkular)
        * Compare size of all the list [UI, Database, Management system]
    """
    ui_msges = _get_messagings_set(MiddlewareMessaging.messagings())
    db_msges = _get_messagings_set(MiddlewareMessaging.messagings_in_db())
    mgmt_msges = _get_messagings_set(MiddlewareMessaging.messagings_in_mgmt())
    headers = MiddlewareMessaging.headers()
from utils import testgen
from utils.log import logger
from utils.wait import wait_for

pytestmark = [
    test_requirements.service,
    pytest.mark.usefixtures("vm_name"),
    pytest.mark.usefixtures("catalog_item"),
    pytest.mark.usefixtures("uses_infra_providers"),
    pytest.mark.long_running,
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.tier(3),
]


pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["virtualcenter"], scope="module")


@pytest.fixture(scope="function")
def copy_domain(request):
    domain = Domain(name=fauxfactory.gen_alphanumeric(), enabled=True)
    domain.create()
    request.addfinalizer(lambda: domain.delete() if domain.exists() else None)
    return domain


@pytest.yield_fixture(scope="function")
def myservice(setup_provider, provider, catalog_item, request):
    vm_name = catalog_item.provisioning_data["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
    catalog_item.create()
Пример #43
0
import pytest

from cfme.infrastructure import pxe
from utils.update import update
from utils.testgen import generate, pxe_servers


pytest_generate_tests = generate(pxe_servers)


@pytest.fixture(scope='function')
def has_no_pxe_servers():
    pxe.remove_all_pxe_servers()


@pytest.mark.usefixtures('has_no_pxe_servers')
def test_pxe_server_crud(pxe_name, pxe_server_crud):
    """
    Basic Add test for PXE server including refresh.
    """
    pxe_server_crud.create()
    with update(pxe_server_crud):
        pxe_server_crud.name = pxe_server_crud.name + "_update"
    pxe_server_crud.delete(cancel=False)
import pytest

from cfme.containers.provider import ContainersProvider
from utils import testgen, version
from cfme.web_ui import toolbar as tb
from utils.appliance.implementations.ui import navigate_to


pytestmark = [
    pytest.mark.uncollectif(
        lambda: version.current_version() < "5.6"),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='function')


@pytest.mark.polarion('CMP-9878')
def test_reload_button_provider(provider):
    """ This test verifies the data integrity of the fields in
        the Relationships table after clicking the "reload"
        button. Fields that are being verified as part of provider.validate.stats():
        Projects, Routes, Container Services, Replicators, Pods, Containers, and Nodes.
        Images are being validated separately, since the total
        number of images in CFME 5.7 includes all images from the OSE registry as well
        as the images that are being created from the running pods. The images are searched
        according to the @sha. Image Registries are also validated separately.
    """

    navigate_to(provider, 'Details')
    tb.select('Reload Current Display')
    provider.validate_stats(ui=True)
Пример #45
0
import pytest
from utils import testgen
from cfme.web_ui import Quadicon
from cfme.fixtures import pytest_selenium as sel


pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         ['openstack-infra'],
                                         scope='module')


@pytest.mark.usefixtures("setup_provider_modscope")
def test_credentials_quads(provider):
    provider.load_details()
    sel.force_navigate("infrastructure_providers")
    quad = Quadicon(provider.name, qtype='infra_prov')
    checked = str(quad.creds).split('-')[0]
    assert checked == 'checkmark'
Пример #46
0
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.services import requests
from utils import normalize_text, testgen
from utils.generators import random_vm_name
from utils.log import logger
from utils.update import update
from utils.version import current_version
from utils.wait import wait_for, RefreshTimer

pytestmark = [
    pytest.mark.meta(server_roles="+automate"), test_requirements.provision,
    pytest.mark.tier(2)
]

pytest_generate_tests = testgen.generate(
    [CloudProvider],
    required_fields=[['provisioning', 'image']],
    scope="function")


@pytest.fixture(scope="function")
def testing_instance(request, setup_provider, provider, provisioning, vm_name):
    """ Fixture to prepare instance parameters for provisioning
    """
    image = provisioning['image']['name']
    note = (
        'Testing provisioning from image {} to vm {} on provider {}'.format(
            image, vm_name, provider.key))

    instance = Instance.factory(vm_name, provider, image)

    request.addfinalizer(instance.delete_from_provider)
Пример #47
0
from cfme.containers.image import Image
from cfme.containers.project import Project
from cfme.containers.route import Route
from cfme.containers.template import Template
from cfme.exceptions import SetLabelException

from utils import testgen
from utils.wait import wait_for
from utils.log import logger
from utils.blockers import BZ


pytestmark = [
    pytest.mark.usefixtures('setup_provider_modscope'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='module')


TEST_OBJECTS = (Pod, Service, Route, Template, Node, Replicator, Image, Project)


def check_labels_in_ui(instance, name, expected_value):
    if hasattr(instance.summary, 'labels') and \
            hasattr(instance.summary.labels, name.lower()):
        return getattr(instance.summary.labels, name.lower()).text_value == str(expected_value)
    return False


@pytest.fixture(scope='module')
def random_labels(provider, appliance):
    # Creating random instance for each object in TEST_OBJECTS and create a random label for it.
Пример #48
0
from cfme.configure.configuration import VMwareConsoleSupport
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.configure import configuration
from cfme.common.vm import VM
from utils import testgen, version, ssh
from utils.appliance.implementations.ui import navigate_to
from utils.log import logger
from utils.conf import credentials
from utils.providers import ProviderFilter
from wait_for import wait_for

pytestmark = pytest.mark.usefixtures('setup_provider')

pytest_generate_tests = testgen.generate(
    gen_func=testgen.providers,
    filters=[ProviderFilter(classes=[CloudInfraProvider], required_flags=['html5_console'])],
    scope='module'
)


@pytest.fixture(scope="function")
def vm_obj(request, provider, setup_provider, console_template, vm_name):
    """
    Create a VM on the provider with the given template, and return the vm_obj.

    Also, it will remove VM from provider using nested function _delete_vm
    after the test is completed.

    """
    vm_obj = VM.factory(vm_name, provider, template_name=console_template)
Пример #49
0
from collections import namedtuple
from fauxfactory import gen_alphanumeric, gen_integer
import pytest
from cfme.containers.provider import ContainersProvider
from cfme.containers.provider.openshift import OpenshiftProvider
from cfme.exceptions import FlashMessageException
from cfme.web_ui import flash
from utils import testgen
from utils.version import current_version

pytestmark = [pytest.mark.uncollectif(lambda: current_version() < "5.8.0.3")]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='module')

alphanumeric_name = gen_alphanumeric(10)
long_alphanumeric_name = gen_alphanumeric(100)
integer_name = str(gen_integer(0, 100000000))
provider_names = alphanumeric_name, integer_name, long_alphanumeric_name
DEFAULT_SEC_PROTOCOLS = (
    pytest.mark.polarion('CMP-10598')('SSL trusting custom CA'),
    pytest.mark.polarion('CMP-10597')('SSL without validation'),
    pytest.mark.polarion('CMP-10599')('SSL'))

TestItem = namedtuple('TestItem',
                      ['default_sec_protocol', 'hawkular_sec_protocol'])
TEST_ITEMS = (
    pytest.mark.polarion('CMP-10593')(TestItem('SSL trusting custom CA',
                                               'SSL trusting custom CA')),
    pytest.mark.polarion('CMP-10594')(TestItem('SSL trusting custom CA',
                                               'SSL without validation')),
    pytest.mark.polarion('CMP-10589')(TestItem('SSL trusting custom CA',
                                               'SSL')),
Пример #50
0
import pytest

import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme import Credential
from cfme.exceptions import FlashMessageException
from cfme.cloud.provider import (discover, wait_for_a_provider,
    CloudProvider, prop_region)
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.web_ui import fill, flash
from utils import testgen, version, providers
from utils.appliance.implementations.ui import navigate_to
from utils.update import update
from cfme import test_requirements
pytest_generate_tests = testgen.generate(testgen.cloud_providers, scope="function")


@pytest.fixture(scope="module")
def setup_a_provider():
    return providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)


@pytest.mark.tier(3)
@test_requirements.discovery
def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None, d_type="Amazon")
    ident = version.pick({version.LOWEST: 'User ID',
                          '5.4': 'Username'})
    flash.assert_message_match('{} is required'.format(ident))
Пример #51
0
# -*- coding: utf-8 -*-
import pytest

from cfme.exceptions import ItemNotFound
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.storage.volume import VolumeCollection

from utils import testgen
from utils.appliance.implementations.ui import navigate_to

pytest_generate_tests = testgen.generate([CloudProvider])

pytestmark = [
    pytest.mark.tier(3), test_requirements.storage,
    pytest.mark.usefixtures('openstack_provider', 'setup_provider')
]


@pytest.mark.uncollectif(
    lambda provider: not provider.one_of(OpenStackProvider))
def test_volume_navigation(openstack_provider, appliance):
    # grab a volume name, the table returns a generator so use next

    collection = VolumeCollection(appliance=appliance)
    view = navigate_to(collection, 'All')

    try:
        volume_name = view.entities.get_first_entity().name
    except (StopIteration, ItemNotFound):
Пример #52
0
import pytest
import time
from utils import db
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from cfme.configure.configuration import server_roles_enabled, candu
from cfme.exceptions import FlashMessageException

pytest_generate_tests = testgen.generate(testgen.provider_by_type, None)


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
    finally:
        candu.disable_all()


# blow away all providers when done - collecting metrics for all of them is
# too much
@pytest.yield_fixture
def handle_provider(provider):
    try:
        providers.clear_providers()
        providers.setup_provider(provider.key)
Пример #53
0
import pytest

from cfme.configure.access_control import simple_user
from cfme.login import login, login_admin
from utils.conf import credentials
from utils.testgen import auth_groups, generate
from utils import version
from utils.providers import setup_a_provider

pytest_generate_tests = generate(auth_groups, auth_mode='aws_iam')


@pytest.fixture(scope="module")
def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)


@pytest.mark.uncollect('Needs to be fixed after menu removed')
@pytest.mark.tier(2)
def test_group_roles(
        request, configure_aws_iam_auth_mode, group_name, group_data, setup_first_provider):
    """Basic default AWS_IAM group role RBAC test

    Validates expected menu and submenu names are present for default
    AWS IAM groups

    """
    request.addfinalizer(login_admin)

    # This should be removed but currently these roles are subject to a bug
    if version.current_version() >= '5.4' and group_name in ['evmgroup-administrator',
Пример #54
0
from cfme.containers.pod import match_page as match_page_pod
from cfme.containers.service import match_page as match_page_service
from cfme.containers.container import match_page as match_page_container
from cfme.containers.provider import ContainersProvider, \
    match_page as match_page_containersprovider
from cfme.web_ui import browser_title
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.version import current_version
from utils.blockers import BZ


pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < "5.8"),
    pytest.mark.usefixtures("setup_provider")]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='function')


DataSet = namedtuple('DataSet', ['match_page', 'start_page_name'])
data_sets = (
    DataSet(match_page_containersoverview, 'Containers / Overview'),
    DataSet(match_page_containersprovider, 'Containers / Providers'),
    DataSet(match_page_node, 'Containers / Nodes'),
    DataSet(match_page_pod, 'Containers / Pods'),
    DataSet(match_page_service, 'Containers / Services'),
    DataSet(match_page_container, 'Containers / Explorer')
)


@pytest.mark.meta(blockers=[BZ(1446265, forced_streams=["5.8", "upstream"])])
@pytest.mark.polarion('CMP-10601')
Пример #55
0
import fauxfactory
import pytest
from cfme.cloud.provider.openstack import OpenStackProvider
from utils.update import update
from cfme.cloud.tenant import Tenant
from utils import testgen
from utils.log import logger
from utils.version import current_version


pytest_generate_tests = testgen.generate([OpenStackProvider], scope='module')


@pytest.yield_fixture(scope='function')
def tenant(provider, setup_provider):
    tenant = Tenant(name=fauxfactory.gen_alphanumeric(8), provider=provider)

    yield tenant

    try:
        if tenant.exists:
            tenant.delete()

    except Exception:
        logger.warning(
            'Exception while attempting to delete tenant fixture, continuing')
    finally:
        if tenant.name in provider.mgmt.list_tenant():
            provider.mgmt.remove_tenant(tenant.name)

import pytest
import random

from cfme.web_ui import CheckboxTable
from cfme.containers.replicator import Replicator
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.version import current_version


pytestmark = [
    pytest.mark.uncollectif(lambda provider: current_version() < "5.6" and provider.version > 3.2),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate(
    testgen.container_providers, scope='module')

list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")


REPLICATORS_PROPERTIES_FIELDS = ['Name', 'Creation timestamp', 'Resource version',
                                 'Requested pods', 'Current pods']
REPLICATORS_RELATIONSHIPS_FIELDS = ['Containers Provider', 'Project', 'Pods', 'Nodes',
                                    'My Company Tags']


@pytest.fixture(scope="module")
def replicator(provider):
    navigate_to(Replicator, 'All')
    replicator_name = random.choice([r.name.text for r in list_tbl.rows()])
    return Replicator(replicator_name, provider)
# in selenium (the group is selected then immediately reset)
import fauxfactory
import pytest

from cfme.cloud.instance import Instance
from cfme.cloud.provider import CloudProvider
from cfme.infrastructure.pxe import get_template_from_config
from utils import testgen, ssh
from utils.log import logger
from utils.wait import wait_for

pytestmark = [pytest.mark.meta(server_roles="+automate")]

pytest_generate_tests = testgen.generate(
    [CloudProvider],
    required_fields=[['provisioning', 'ci-template'],
                     ['provisioning', 'ci-username'],
                     ['provisioning', 'ci-pass'], ['provisioning', 'image']],
    scope="module")


@pytest.fixture(scope="module")
def setup_ci_template(provider):
    cloud_init_template_name = provider.data['provisioning']['ci-template']
    cloud_init_template = get_template_from_config(cloud_init_template_name)
    if not cloud_init_template.exists():
        cloud_init_template.create()


@pytest.fixture(scope="function")
def vm_name(request):
    vm_name = 'test_image_prov_{}'.format(fauxfactory.gen_alphanumeric())
Пример #58
0
from cfme.containers.service import Service
from cfme.containers.route import Route
from cfme.containers.project import Project
from cfme.containers.provider import ContainersProvider
from random import choice
from cfme.web_ui import breadcrumbs
from collections import namedtuple
from cfme.web_ui import toolbar as tb


pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < "5.6"),
    pytest.mark.usefixtures("setup_provider"),
    pytest.mark.tier(1),
]
pytest_generate_tests = testgen.generate(testgen.container_providers, scope="function")

# CMP_9903  CMP_9904  CMP_9905  CMP_9906

DataSet = namedtuple("DataSet", ["object", "breadcrumb_member"])

DATA_SETS = [
    DataSet(Service, "Container Services"),
    DataSet(Route, "Routes"),
    DataSet(Project, "Projects"),
    DataSet(ContainersProvider, "Containers Providers"),
]


@pytest.mark.parametrize(("cls"), DATA_SETS, ids=[cls.object.__name__ for cls in DATA_SETS])
def test_summary_pages_links(provider, cls):
Пример #59
0
import pytest
from cfme.automate.explorer import Domain, Namespace, Class, Instance, Method
from cfme.automate.simulation import simulate
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure.virtual_machines import Vm
from utils import testgen
from utils.conf import credentials
from utils.log import logger
from utils.path import data_path
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [pytest.mark.long_running]

pytest_generate_tests = testgen.generate(testgen.infra_providers,
                                         'full_template',
                                         scope="module")


@pytest.fixture(scope="module")
def vm_name():
    return "test_snpsht_" + fauxfactory.gen_alphanumeric()


@pytest.fixture(scope="module")
def domain(request):
    dom = Domain(fauxfactory.gen_alpha(), enabled=True)
    dom.create()
    request.addfinalizer(dom.delete)
    return dom