Beispiel #1
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme import test_requirements
from cfme.utils.rest import assert_response
from cfme.utils.rest import query_resource_attributes
from cfme.utils.testgen import config_managers
from cfme.utils.testgen import generate
from cfme.utils.wait import wait_for

pytest_generate_tests = generate(gen_func=config_managers, scope='module')
pytestmark = [test_requirements.config_management]


@pytest.fixture(scope='module')
def config_manager(config_manager_obj):
    """Fixture that provides a random config manager and sets it up."""
    if config_manager_obj.type == 'Ansible Tower':
        config_manager_obj.create(validate=True)
    else:
        config_manager_obj.create()
    yield config_manager_obj
    config_manager_obj.delete()


@pytest.fixture
def authentications(appliance, config_manager):
    """Creates and returns authentication resources under /api/authentications."""
    auth_num = 2
    collection = appliance.rest_api.collections.authentications
Beispiel #2
0
from cfme.common.provider import cleanup_vm
from cfme.common.vm import VM
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.utils import testgen
from cfme.utils.log import logger
from cfme.utils import version

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

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


@pytest.yield_fixture(scope="function")
def catalog_item(provider, vm_name, dialog, catalog, provisioning):
    template, host, datastore, iso_file, catalog_item_type = map(
        provisioning.get,
        ('template', 'host', 'datastore', 'iso_file', 'catalog_item_type'))

    provisioning_data = {
        'vm_name': vm_name,
        'host_name': {
            'name': [host]
        },
import fauxfactory
import pytest
from cfme.configure.configuration.region_settings import Category, Tag
from cfme.utils import error
from cfme.utils.update import update
from cfme.utils.testgen import config_managers, generate


pytest_generate_tests = generate(gen_func=config_managers)
pytestmark = [pytest.mark.uncollectif(lambda config_manager_obj:
                                      config_manager_obj.type == "Ansible Tower"),
              pytest.mark.meta(blockers=[1491704])]


@pytest.yield_fixture
def config_manager(config_manager_obj):
    """ Fixture that provides a random config manager and sets it up"""
    config_manager_obj.create()
    yield config_manager_obj
    config_manager_obj.delete()


@pytest.fixture
def config_system(config_manager):
    return fauxfactory.gen_choice(config_manager.systems)


@pytest.yield_fixture(scope="module")
def category():
    cg = Category(name=fauxfactory.gen_alpha(8).lower(),
                  description=fauxfactory.gen_alphanumeric(length=32),
Beispiel #4
0
"""Tests for Openstack cloud networks and subnets"""

import pytest

from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.utils import testgen


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

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


def test_list_networks(provider, appliance):
    networks = [n.label for n in provider.mgmt.api.networks.list()]
    displayed_networks = [n.name for n in appliance.collections.cloud_networks.all()]
    for n in networks:
        assert n in displayed_networks
Beispiel #5
0
from cfme.common.provider import CloudInfraProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.configure import configuration
from cfme.common.vm import VM
from cfme.utils import testgen, version, ssh
from cfme.utils.blockers import BZ
from cfme.utils.log import logger
from cfme.utils.conf import credentials
from cfme.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.name)
# -*- coding: utf-8 -*-
import uuid

import pytest

from cfme import test_requirements
from cfme.physical.provider.lenovo import LenovoProvider
from cfme.utils import testgen
from cfme.utils.update import update

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


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.discovery
def test_physical_infra_provider_crud(provider, has_no_providers):
    """Tests provider add with good credentials

    Metadata:
        test_flag: crud
    """
    provider.create()

    # Fails on upstream, all provider types - BZ1087476
    provider.validate_stats(ui=True)

    old_name = provider.name
    with update(provider):
        provider.name = str(uuid.uuid4())  # random uuid
# -*- coding: utf-8 -*-
import pytest

import fauxfactory

from cfme import test_requirements
from cfme.utils.rest import assert_response, query_resource_attributes
from cfme.utils.testgen import config_managers, generate
from cfme.utils.wait import wait_for


pytest_generate_tests = generate(gen_func=config_managers, scope='module')
pytestmark = [test_requirements.config_management]


@pytest.fixture(scope='module')
def config_manager(config_manager_obj):
    """Fixture that provides a random config manager and sets it up."""
    if config_manager_obj.type == 'Ansible Tower':
        config_manager_obj.create(validate=True)
    else:
        config_manager_obj.create()
    yield config_manager_obj
    config_manager_obj.delete()


@pytest.fixture
def authentications(appliance, config_manager):
    """Creates and returns authentication resources under /api/authentications."""
    auth_num = 2
    collection = appliance.rest_api.collections.authentications
Beispiel #8
0
from copy import copy, deepcopy

from cfme.utils import error
from cfme.base.credential import Credential
from cfme.common.provider_views import (InfraProviderAddView,
                                        InfraProvidersView,
                                        InfraProvidersDiscoverView)
from cfme.infrastructure.provider import discover, wait_for_a_provider, InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider, RHEVMEndpoint
from cfme.infrastructure.provider.virtualcenter import VMwareProvider, VirtualCenterEndpoint
from cfme.utils import testgen, version
from cfme.utils.update import update
from cfme.utils.blockers import BZ
from cfme import test_requirements

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


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.discovery
def test_empty_discovery_form_validation(appliance):
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None)
    view = appliance.browser.create_view(InfraProvidersDiscoverView)
    view.flash.assert_message('At least 1 item must be selected for discovery')


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.provider_discovery
Beispiel #9
0
# -*- coding: utf-8 -*-
import pytest

from cfme.infrastructure.provider import InfraProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.net import ip_address, resolve_hostname
from cfme.utils.providers import get_crud_by_name
from cfme.utils import testgen
from cfme import test_requirements

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


@pytest.mark.tier(3)
@pytest.mark.usefixtures('setup_provider')
@test_requirements.report
def test_providers_summary(soft_assert):
    """Checks some informations about the provider. Does not check memory/frequency as there is
    presence of units and rounding."""
    path = ["Configuration Management", "Providers", "Providers Summary"]
    report = CannedSavedReport.new(path)
    for provider in report.data.rows:
        if any(ptype in provider["MS Type"]
               for ptype in {"ec2", "openstack"}):  # Skip cloud
            continue
        details_view = navigate_to(InfraProvider(name=provider["Name"]),
                                   'Details')
        props = details_view.contents.properties
Beispiel #10
0
import pytest

from cfme.infrastructure import pxe
from cfme.infrastructure.provider import InfraProvider
from cfme.utils import testgen

pytestmark = [
    pytest.mark.usefixtures('uses_infra_providers'),
]


pytest_generate_tests = testgen.generate([InfraProvider], required_fields=['iso_datastore'])


@pytest.fixture()
def no_iso_dss(provider):
    template_crud = pxe.ISODatastore(provider.name)
    if template_crud.exists():
        template_crud.delete(cancel=False)


@pytest.mark.tier(2)
@pytest.mark.meta(blockers=[1200783])
def test_iso_datastore_crud(setup_provider, no_iso_dss, provider):
    """
    Basic CRUD test for ISO datastores.

    Note:
        An ISO datastore cannot be edited.

    Metadata:
# -*- coding: utf-8 -*-
import pytest
import random

from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.utils import testgen, version

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

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


@pytest.mark.uncollectif(lambda: version.current_version() < '5.8')
@pytest.mark.tier(3)
def test_object_add_remove_tag(objects, provider):
    all_objects = objects.all(provider)
    obj = random.choice(all_objects)

    # add tag with category Department and tag communication
    obj.add_tag('Department', 'Communication')
    tag_available = obj.get_tags()
    assert 'Department' in tag_available and 'Communication' in tag_available

    # remove assigned tag
    obj.remove_tag('Department', 'Communication')
    tag_available = obj.get_tags()
    assert 'Department' not in tag_available and 'Communication' not in tag_available
Beispiel #12
0
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.gce import GCEProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider, RHOSEndpoint
from cfme.common.provider_views import (CloudProviderAddView,
                                        CloudProvidersView,
                                        CloudProvidersDiscoverView)
from cfme import test_requirements

from cfme.utils import testgen, version
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.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(appliance):
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None, EC2Provider)
    view = appliance.browser.create_view(CloudProvidersDiscoverView)
    view.flash.assert_message('Username is required')


@pytest.mark.tier(3)
@test_requirements.discovery
def test_discovery_cancelled_validation(appliance):
    """ Tests that the flash message is correct when discovery is cancelled."""
import fauxfactory
import pytest

from cfme import test_requirements
from cfme.utils.rest import assert_response
from cfme.utils.rest import delete_resources_from_detail
from cfme.utils.rest import query_resource_attributes
from cfme.utils.testgen import config_managers
from cfme.utils.testgen import generate
from cfme.utils.wait import wait_for


pytest_generate_tests = generate(
    # config_managers generates list of managers from cfme_data
    gen_func=config_managers,
    # Filter the config manager types for Tower
    managers_type='Ansible Tower',
    scope='module'
)
pytestmark = [test_requirements.rest]


@pytest.fixture(scope='module')
def config_manager(config_manager_obj):
    """Fixture that provides a random config manager and sets it up."""
    if config_manager_obj.type != 'Ansible Tower':
        pytest.skip('A non "Ansible Tower" configuration manager provider was selected for test,'
                    'Please verify cfme_data.yaml content.')

    config_manager_obj.create(validate=True)  # actually add it to CFME
    yield config_manager_obj
import pytest

from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.conf import credentials
from cfme.utils.testgen import auth_groups, generate

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


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

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

    """
    request.addfinalizer(appliance.server.login_admin)

    # This should be removed but currently these roles are subject to a bug
    if group_name in ['evmgroup-administrator',
                      'evmgroup-approver',
                      'evmgroup-auditor',
                      'evmgroup-operator',
                      'evmgroup-security',
                      'evmgroup-support',
                      'evmgroup-user']:
        pytest.skip("This role currently fails this test")
from cfme.utils import testgen
from cfme.utils.log import logger
from cfme.containers.provider import ContainersProvider
from cfme.intelligence.chargeback import assignments, rates
from cfme.intelligence.reports.reports import CustomReport
from cfme.web_ui import flash

pytestmark = [
    pytest.mark.tier(3),
    pytest.mark.meta(
        server_roles=
        '+ems_metrics_coordinator +ems_metrics_collector +ems_metrics_processor'
    ),
    pytest.mark.usefixtures("setup_provider_modscope")
]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='module')

RATE_TO_COST_HEADER = {
    'Fixed Compute Cost 1': 'Fixed Compute Cost 1',
    'Fixed Compute Cost 2': 'Fixed Compute Cost 2',
    'Used CPU Cores': 'Cpu Cores Used Cost',
    'Used Memory': 'Memory Used Cost',
    'Used Network I/O': 'Network I/O Used Cost',
}


def price2float(str_):
    """Converting the price (str) value to float (2 decimals).
    e.g. '$1,273.48' --> 1273.48"""
    if not str_:
        return 0.0
Beispiel #16
0
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.blockers import BZ
from cfme.utils.generators import random_vm_name
from cfme.utils.log import logger
from cfme.utils.providers import ProviderFilter
from cfme.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

    pytest.mark.tier(2)
]


@pytest.fixture
def needs_firefox():
    """ Fixture which skips the test if not run under firefox.

    I recommend putting it in the first place.
    """
    ensure_browser_open()
    if browser.browser().name != "firefox":
        pytest.skip(msg="This test needs firefox to run")


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


@pytest.yield_fixture(scope='function')
def myservice(appliance, setup_provider, provider, catalog_item, request):
    """Tests my service

    Metadata:
        test_flag: provision
    """
    vm_name = version.pick({
        version.LOWEST:
        catalog_item.provisioning_data["vm_name"] + '_0001',
        '5.7':
        catalog_item.provisioning_data["vm_name"] + '0001'
    })
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme import test_requirements
from cfme.utils.rest import assert_response
from cfme.utils.rest import query_resource_attributes
from cfme.utils.testgen import config_managers
from cfme.utils.testgen import generate
from cfme.utils.wait import wait_for


pytest_generate_tests = generate(
    # config_managers generates list of managers from cfme_data
    gen_func=config_managers,
    # Filter the config manager types for Tower
    managers_type='Ansible Tower',
    scope='module'
)
pytestmark = [test_requirements.tower]


@pytest.fixture(scope='module')
def config_manager(config_manager_obj):
    """Fixture that provides a random config manager and sets it up."""
    if config_manager_obj.type != 'Ansible Tower':
        pytest.skip('A non "Ansible Tower" configuration manager provider was selected for test,'
                    'Please verify cfme_data.yaml content.')

    config_manager_obj.create(validate=True)  # actually add it to CFME
    yield config_manager_obj
# -*- 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.utils import testgen
from cfme.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 = appliance.collections.volumes
    view = navigate_to(collection, 'All')

    try:
        volume_name = view.entities.get_first_entity().name
    except (StopIteration, ItemNotFound):
        pytest.skip(
import fauxfactory
import pytest
from cfme.configure.configuration.region_settings import Category, Tag
from cfme.utils import error, version
from cfme.utils.update import update
from cfme.utils.testgen import config_managers, generate
from cfme.utils.blockers import BZ


pytest_generate_tests = generate(gen_func=config_managers)
pytestmark = [pytest.mark.uncollectif(lambda config_manager_obj:
                                      config_manager_obj.type == "Ansible Tower"),
              pytest.mark.meta(blockers=[BZ(1393987)])]


@pytest.yield_fixture
def config_manager(config_manager_obj):
    """ Fixture that provides a random config manager and sets it up"""
    config_manager_obj.create()
    yield config_manager_obj
    config_manager_obj.delete()


@pytest.fixture
def config_system(config_manager):
    return fauxfactory.gen_choice(config_manager.systems)


@pytest.yield_fixture(scope="module")
def category():
    cg = Category(name=fauxfactory.gen_alpha(8).lower(),
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.virtual_machines import get_all_vms
from cfme.web_ui import toolbar
from cfme.utils import testgen
from cfme.utils.blockers import BZ
from cfme.utils.generators import random_vm_name
from cfme.utils.log import logger
from cfme.utils.wait import wait_for, TimedOutError

pytestmark = [
    pytest.mark.long_running,
    pytest.mark.tier(2),
    pytest.mark.usefixtures('setup_provider'), test_requirements.power
]

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


@pytest.fixture(scope='function')
def vm_name():
    return random_vm_name('pwr-c')


@pytest.fixture(scope="function")
def testing_vm(request, provider, vm_name):
    """Fixture to provision vm to the provider being tested"""
    vm = VM.factory(vm_name, provider)
    logger.info("provider_key: %s", provider.key)

    @request.addfinalizer
    def _cleanup():
Beispiel #22
0
import pytest

from cfme.containers.provider import ContainersProvider
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import toolbar as tb
from cfme.utils import testgen, version
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.blockers import BZ

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


@pytest.mark.polarion('CMP-10255')
@pytest.mark.meta(blockers=[BZ(1406772, forced_streams=["5.7", "5.8"])])
def test_cockpit_button_access(provider, appliance, soft_assert):
    """ The test verifies the existence of cockpit "Web Console"
        button on master node, then presses on the button and
        opens up the cockpit main page in a new window. Then
        we verify the title of the main cockpit page. The test
        will not work until the single sign-on bug is fixed

    """

    collection = appliance.collections.nodes
    nodes = collection.all()
Beispiel #23
0
from cfme.common.provider import CloudInfraProvider
from cfme.common.vm import VM
from cfme.infrastructure.provider import InfraProvider
from cfme.web_ui import toolbar as tb
from cfme.utils import testgen
from cfme.utils.blockers import BZ
from cfme.utils.generators import random_vm_name
from cfme.utils.log import logger
from cfme.utils.providers import ProviderFilter
from cfme.utils.timeutil import parsetime
from cfme.utils.wait import wait_for
from cfme.utils.version import pick, current_version

pytest_generate_tests = testgen.generate(
    gen_func=testgen.providers,
    filters=[
        ProviderFilter(classes=[CloudInfraProvider],
                       required_flags=['provision', 'retire'])
    ])

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2), pytest.mark.long_running
]

RetirementWarning = namedtuple('RetirementWarning', ['id', 'string'])

warnings = [
    RetirementWarning('no_warning', 'None'),
    RetirementWarning('1_week_warning', '1 Week before retirement'),
    RetirementWarning('2_week_warning', '2 Weeks before retirement'),
    RetirementWarning('30_day_warning', '30 Days before retirement')
Beispiel #24
0
import pytest
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.networks.provider import NetworkProviderCollection
from cfme.utils import testgen
from cfme.utils.appliance.implementations.ui import navigate_to

pytest_generate_tests = testgen.generate(
    classes=[EC2Provider, AzureProvider, OpenStackProvider], scope='module')
pytestmark = pytest.mark.usefixtures('setup_provider')


@pytest.mark.tier(1)
def test_sdn_crud(provider, appliance):
    """ Test for functional addition of network manager with cloud provider
        and functional references to components on detail page
    Prerequisites: Cloud provider in cfme
    """

    view = navigate_to(provider, 'Details')
    net_prov_name = view.contents.relationships.get_text_of("Network Manager")
    collection = NetworkProviderCollection(appliance)
    network_provider = collection.instantiate(name=net_prov_name)

    view = navigate_to(network_provider, 'Details')
    parent_name = view.entities.relationships.get_text_of(
        "Parent Cloud Provider")

    assert parent_name == provider.name
Beispiel #25
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 cfme.utils import testgen
from cfme.utils import conf
from cfme.utils.log import logger
from cfme.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(appliance):
    candu = appliance.get(CANDUCollection)
    original_roles = appliance.server.settings.server_roles_db
    try:
        appliance.server.settings.enable_server_roles(
            'ems_metrics_coordinator', 'ems_metrics_collector',
            'ems_metrics_processor')
        candu.enable_all()
        yield
    finally:
Beispiel #26
0
from cfme.middleware.provider import MiddlewareProvider
from cfme.utils import testgen
from cfme.utils import version
from cfme.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"}}


@pytest.mark.usefixtures('setup_provider')
def test_topology(provider):
Beispiel #27
0
"AWSTemplateFormatVersion" : "2010-09-09",
  "Description" : "AWS CloudFormation Sample Template Rails_Single_Instance.",

  "Parameters" : {
    "KeyName": {
      "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
      "Type": "AWS::EC2::KeyPair::KeyName",
      "ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
    }
  }
}
"""

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


@pytest.yield_fixture(scope="function")
def create_template():
    method = METHOD_TORSO.replace('CloudFormation',
                                  fauxfactory.gen_alphanumeric())
    yield method


def test_orchestration_template_crud(provisioning, create_template):
    template_type = provisioning['stack_provisioning']['template_type']
    template = OrchestrationTemplate(
        template_type=template_type,
        template_name=fauxfactory.gen_alphanumeric(),
import fauxfactory
import pytest

from cfme import test_requirements
from cfme.cloud.provider.azure import AzureProvider
from cfme.common.provider import CloudInfraProvider
from cfme.utils import error, testgen
from cfme.utils.blockers import BZ
from cfme.utils.rest import assert_response
from cfme.utils.version import pick
from cfme.utils.wait import wait_for

pytest_generate_tests = testgen.generate(classes=[CloudInfraProvider])

pytestmark = [test_requirements.rest]


def delete_provider(appliance, name):
    provs = appliance.rest_api.collections.providers.find_by(name=name)

    if not provs:
        return

    prov = provs[0]

    # workaround for BZ1501941
    def _delete():
        try:
            prov.action.delete()
        except Exception as exc:
            if 'ActiveRecord::RecordNotFound' in str(exc):
# -*- coding: utf-8 -*-
import uuid
import pytest

from cfme.utils import testgen
from cfme.utils.update import update
from cfme import test_requirements
from cfme.physical.provider.lenovo import LenovoProvider

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


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.discovery
def test_provider_crud(provider):
    """Tests provider add with good credentials

    Metadata:
        test_flag: crud
    """
    provider.create()

    # Fails on upstream, all provider types - BZ1087476
    provider.validate_stats(ui=True)

    old_name = provider.name
    with update(provider):
        provider.name = str(uuid.uuid4())  # random uuid

    with update(provider):
from cfme.utils import testgen
from cfme.utils.conf import credentials
from cfme.utils.rest import assert_response
from cfme.utils.generators import random_vm_name
from cfme.utils.log import logger
from cfme.utils.update import update
from cfme.utils.version import current_version
from cfme.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()
Beispiel #31
0
import pytest

from cfme.infrastructure import pxe
from cfme.utils.update import update
from cfme.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)
# -*- coding: utf-8 -*-

import pytest
from cfme import test_requirements
from cfme.common.vm import VM
from cfme.infrastructure import host, datastore, resource_pool
from cfme.infrastructure.cluster import ClusterCollection
from cfme.infrastructure.provider import InfraProvider
from cfme.utils import testgen
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.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,
                                             appliance):
    """ Tests delete cluster

    Metadata:
        test_flag: delete_object
    """
    cluster_name = provider.data['remove_test']['cluster']
    cluster_col = appliance.get(ClusterCollection)
    test_cluster = cluster_col.instantiate(name=cluster_name,
                                           provider=provider)
    test_cluster.delete(cancel=False, wait=True)
from cfme.utils.version import current_version
from deployment_methods import deploy, get_deployment_from_list
from deployment_methods import get_deployments_set
from deployment_methods import check_deployment_not_listed
from deployment_methods import check_deployment_disabled, check_deployment_enabled
from deployment_methods import RESOURCE_JAR_NAME, WAR_EXT
from deployment_methods import RESOURCE_WAR_NAME, RESOURCE_WAR_NAME_NEW
from deployment_methods import RESOURCE_WAR_CONTENT, RESOURCE_WAR_CONTENT_NEW
from deployment_methods import check_deployment_content, check_no_deployment_content
from server_methods import get_hawkular_server, get_eap_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_deployments(provider):
    """Tests deployments list between UI, DB and management system

    Steps:
        * Get deployments list from UI for whole Middleware
        * Get deployments list from Database for whole Middleware
        * Get deployments list from Management system  for whole Middleware
        * Verifies that UI list contains all DB entities
        * Verifies that UI list contains all MGMT entities
    """
    ui_deps = get_deployments_set(MiddlewareDeployment.deployments())
    db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db())
Beispiel #34
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.common.vm import VM
from cfme.infrastructure.provider.scvmm import SCVMMProvider
from cfme.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.name,
                               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()
Beispiel #35
0
import pytest

from cfme.utils.conf import credentials
from cfme.utils.testgen import auth_groups, generate

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


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

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

    """
    request.addfinalizer(appliance.server.login_admin)

    # This should be removed but currently these roles are subject to a bug
    if group_name in ['evmgroup-administrator',
                      'evmgroup-approver',
                      'evmgroup-auditor',
                      'evmgroup-operator',
                      'evmgroup-security',
                      'evmgroup-support',
                      'evmgroup-user']:
        pytest.skip("This role currently fails this test")

    try:
import pytest

from cfme.configure.access_control import simple_user
from cfme.utils.conf import credentials
from cfme.utils.testgen import auth_groups, generate

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


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

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

    """
    request.addfinalizer(appliance.server.login_admin)

    # This should be removed but currently these roles are subject to a bug
    if group_name in ['evmgroup-administrator',
                      'evmgroup-approver',
                      'evmgroup-auditor',
                      'evmgroup-operator',
                      'evmgroup-security',
                      'evmgroup-support',
                      'evmgroup-user']:
        pytest.skip("This role currently fails this test")