def test_superadmin_tenant_project_crud(request):
    """Test suppose to verify CRUD operations for CFME projects

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Create project as child to tenant
        * Update description of project
        * Update name of project
        * Delete project
        * Delete tenant
    """
    tenant = Tenant(name="tenant1" + fauxfactory.gen_alphanumeric(), description="tenant1 description")
    project = Project(
        name="project1" + fauxfactory.gen_alphanumeric(), description="project1 description", parent_tenant=tenant
    )

    @request.addfinalizer
    def _delete_tenant_and_project():
        for item in [project, tenant]:
            if item.exists:
                item.delete()

    tenant.create()
    project.create()
    with update(project):
        project.description = project.description + "edited"
    with update(project):
        project.name = project.name + "edited"
    project.delete()
    tenant.delete()
예제 #2
0
def test_superadmin_tenant_crud(request):
    """Test suppose to verify CRUD operations for CFME tenants

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Update description of tenant
        * Update name of tenat
        * Delete tenant
    """
    tenant = Tenant(
        name='tenant1' + fauxfactory.gen_alphanumeric(),
        description='tenant1 description')

    @request.addfinalizer
    def _delete_tenant():
        if tenant.exists:
            tenant.delete()

    tenant.create()
    with update(tenant):
        tenant.description = tenant.description + "edited"
    with update(tenant):
        tenant.name = tenant.name + "edited"
    tenant.delete()
def set_tenant_vm():
    vm_data = {'vm_cb': True, 'vm': 1}
    reset_vm_data = {'vm_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**vm_data)
    yield
    roottenant.set_quota(**reset_vm_data)
def set_tenant_storage():
    storage_data = {'storage_cb': True, 'storage': 0.01}
    reset_storage_data = {'storage_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**storage_data)
    yield
    roottenant.set_quota(**reset_storage_data)
def set_tenant_memory():
    memory_data = {'memory_cb': True, 'memory': 2}
    reset_memory_data = {'memory_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**memory_data)
    yield
    roottenant.set_quota(**reset_memory_data)
def set_tenant_cpu():
    cpu_data = {'cpu_cb': True, 'cpu': 2}
    reset_cpu_data = {'cpu_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**cpu_data)
    yield
    roottenant.set_quota(**reset_cpu_data)
예제 #7
0
def set_tenant_vm():
    vm_data = {'vm_cb': True, 'vm': 1}
    reset_vm_data = {'vm_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**vm_data)
    yield
    roottenant.set_quota(**reset_vm_data)
예제 #8
0
def set_tenant_storage():
    storage_data = {'storage_cb': True, 'storage': 1}
    reset_storage_data = {'storage_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**storage_data)
    yield
    roottenant.set_quota(**reset_storage_data)
예제 #9
0
def set_tenant_memory():
    memory_data = {'memory_cb': True, 'memory': 2}
    reset_memory_data = {'memory_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**memory_data)
    yield
    roottenant.set_quota(**reset_memory_data)
예제 #10
0
def set_tenant_cpu():
    cpu_data = {'cpu_cb': True, 'cpu': 2}
    reset_cpu_data = {'cpu_cb': False}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**cpu_data)
    yield
    roottenant.set_quota(**reset_cpu_data)
예제 #11
0
def test_superadmin_tenant_crud(request):
    """Test suppose to verify CRUD operations for CFME tenants

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Update description of tenant
        * Update name of tenat
        * Delete tenant
    """
    tenant = Tenant(
        name='tenant1' + fauxfactory.gen_alphanumeric(),
        description='tenant1 description')

    @request.addfinalizer
    def _delete_tenant():
        if tenant.exists:
            tenant.delete()

    tenant.create()
    with update(tenant):
        tenant.description = tenant.description + "edited"
    with update(tenant):
        tenant.name = tenant.name + "edited"
    tenant.delete()
def test_superadmin_child_tenant_crud(request, number_of_childrens):
    """Test CRUD operations for CFME child tenants, where several levels of tenants are created.

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create 5 tenants where the next tenant is always child to the previous one
        * Update description of tenant(N-1)_* in the tree
        * Update name of tenant(N-1)_*
        * Delete all created tenants in reversed order
    """

    tenant = None
    tenant_list = []

    @request.addfinalizer
    def _delete_tenants():
        # reversed because we need to go from the last one
        for tenant in reversed(tenant_list):
            if tenant.exists:
                tenant.delete()

    for i in range(1, number_of_childrens + 1):
        new_tenant = Tenant(
            name="tenant{}_{}".format(i, fauxfactory.gen_alpha(4)),
            description=fauxfactory.gen_alphanumeric(16),
            parent_tenant=tenant,
        )
        tenant_list.append(new_tenant)
        new_tenant.create()
        tenant = new_tenant

    tenant_update = tenant.parent_tenant
    with update(tenant_update):
        tenant_update.description = tenant_update.description + "edited"
    with update(tenant_update):
        tenant_update.name = tenant_update.name + "edited"

    for tenant_item in reversed(tenant_list):
        tenant_item.delete()
        assert not tenant_item.exists
예제 #13
0
def test_superadmin_child_tenant_crud(request, number_of_childrens):
    """Test CRUD operations for CFME child tenants, where several levels of tenants are created.

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create 5 tenants where the next tenant is always child to the previous one
        * Update description of tenant(N-1)_* in the tree
        * Update name of tenant(N-1)_*
        * Delete all created tenants in reversed order
    """

    tenant = None
    tenant_list = []

    @request.addfinalizer
    def _delete_tenants():
        # reversed because we need to go from the last one
        for tenant in reversed(tenant_list):
            if tenant.exists:
                tenant.delete()

    for i in range(1, number_of_childrens + 1):
        new_tenant = Tenant(
            name="tenant{}_{}".format(i, fauxfactory.gen_alpha(4)),
            description=fauxfactory.gen_alphanumeric(16),
            parent_tenant=tenant)
        tenant_list.append(new_tenant)
        new_tenant.create()
        tenant = new_tenant

    tenant_update = tenant.parent_tenant
    with update(tenant_update):
        tenant_update.description = tenant_update.description + "edited"
    with update(tenant_update):
        tenant_update.name = tenant_update.name + "edited"

    for tenant_item in reversed(tenant_list):
        tenant_item.delete()
        assert not tenant_item.exists
예제 #14
0
def test_superadmin_tenant_project_crud(request):
    """Test suppose to verify CRUD operations for CFME projects

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Create project as child to tenant
        * Update description of project
        * Update name of project
        * Delete project
        * Delete tenant
    """
    tenant = Tenant(name='tenant1' + fauxfactory.gen_alphanumeric(),
                    description='tenant1 description')
    project = Project(name='project1' + fauxfactory.gen_alphanumeric(),
                      description='project1 description',
                      parent_tenant=tenant)

    @request.addfinalizer
    def _delete_tenant_and_project():
        for item in [project, tenant]:
            if item.exists:
                item.delete()

    tenant.create()
    project.create()
    with update(project):
        project.description = project.description + "edited"
    with update(project):
        project.name = project.name + "edited"
    project.delete()
    tenant.delete()
예제 #15
0
def test_tenant_quota_max_cpu_check(
        provisioner, prov_data, template_name, provider, request, vm_name, bug):
    """ Test Tenant Quota-Max CPU by UI.

    Prerequisities:
        * A provider set up, supporting provisioning in CFME

    Steps:
        * Set the tenant quota for cpu by UI emforcement
        * Open the provisioning dialog.
        * Apart from the usual provisioning settings, set CPU greater then tenant quota cpu.
        * Submit the provisioning request and wait for it to finish.
        * Visit the requests page. The last message should state quota validation message.

    Metadata:
        test_flag: provision
    """
    cpu_data = {'cpu_cb': True, 'cpu': 2}
    roottenant = Tenant.get_root_tenant()
    roottenant.set_quota(**cpu_data)
    note = ('template {} to vm {} on provider {}'.format(template_name, vm_name, provider.key))
    prov_data["vm_name"] = vm_name
    prov_data["num_sockets"] = "8"
    prov_data["notes"] = note

    provisioner(template_name, prov_data)

    # nav to requests page to check quota validation
    row_description = 'Provision from [{}] to [{}]'.format(template_name, vm_name)
    cells = {'Description': row_description}
    row, __ = wait_for(requests.wait_for_request, [cells],
                    fail_func=sel.refresh, num_sec=500, delay=20)
    # BUG - https://bugzilla.redhat.com/show_bug.cgi?id=1364381
    # TODO: update assert message once the above bug is fixed.
    # assert row.last_message.text == 'Request exceeds maximum allowed for the following: \
    # (cpu - Used: 526 plus requested: 8 exceeds quota: 3))'
    assert row.reason.text == "Quota Exceeded"