Пример #1
0
def test_images_rel(provider, rel):
    sel.force_navigate('containers_images')
    ui_images = [r.name.text for r in list_tbl.rows()]

    for name in ui_images:
        obj = Image(name, provider)

        val = obj.get_detail('Relationships', rel)
        if val == '0' or val == 'Unknown image source':
            continue
        obj.click_element('Relationships', rel)

        try:
            val = int(val)
            assert len([r for r in list_tbl.rows()]) == val
        except ValueError:
            assert val == InfoBlock.text('Properties', 'Name')
def test_images_rel(provider, rel):
    sel.force_navigate('containers_images')
    ui_images = [r.name.text for r in list_tbl.rows()]

    for name in ui_images:
        obj = Image(name, provider)

        val = obj.get_detail('Relationships', rel)
        if val == '0' or val == 'Unknown image source':
            continue
        obj.click_element('Relationships', rel)

        try:
            val = int(val)
            assert len([r for r in list_tbl.rows()]) == val
        except ValueError:
            assert val == InfoBlock.text('Properties', 'Name')
def test_images_rel(provider, rel):
    """ https://bugzilla.redhat.com/show_bug.cgi?id=1365878
    """
    sel.force_navigate('containers_images')
    tb.select('List View')
    list_tbl_image = CheckboxTable(
        table_locator="//div[@id='list_grid']//table")
    ui_images = [r.name.text for r in list_tbl_image.rows()]

    for name in ui_images:
        obj = Image(name, provider)

        val = obj.get_detail('Relationships', rel)
        assert val != 'Unknown image source'
        obj.click_element('Relationships', rel)

        try:
            val = int(val)
            assert len([r for r in list_tbl_image.rows()]) == val
        except ValueError:
            assert val == InfoBlock.text('Properties', 'Name')
def test_images_rel(provider, rel, detailfield):
    """ https://bugzilla.redhat.com/show_bug.cgi?id=1365878
    """
    # Nav to provider first
    navigate_to(provider, 'Details')

    # Then to container images for that provider
    # Locate Relationships table in provider details
    images_key = ({
        version.LOWEST: 'Images',
        '5.7': 'Container Images'
    })
    sel.click(InfoBlock.element('Relationships', version.pick(images_key)))

    # Get the names of all the container images from the table
    list_tbl_image = CheckboxTable(
        table_locator="//div[@id='list_grid']//table")
    ui_images = [r.name.text for r in list_tbl_image.rows()]

    for name in ui_images:
        img = Image(name, provider)
        navigate_to(img, 'Details')

        val = img.get_detail('Relationships', rel)
        assert val != 'Unknown image source'

        sel.click(InfoBlock.element('Relationships', rel))

        # Containers Provider and Image Registry are string values
        # Other rows in the table show the number of the given items
        if rel in ['Containers Provider', 'Image Registry']:
            assert val == InfoBlock.text('Properties', detailfield)
        else:
            val = int(val)
            # There might be more than 1 page of items
            if paginator.page_controls_exist():
                paginator.results_per_page(1000)
            assert len([r for r in list_tbl_image.rows()]) == val
def test_containers_smartstate_analysis(provider, test_item, soft_assert):

    chosen_row = navigate_and_get_rows(provider, Image, 1)[0]
    image_obj = Image(chosen_row.name.text, chosen_row.tag.text, provider)

    if test_item.is_openscap:
        image_obj.assign_policy_profiles('OpenSCAP profile')
    else:
        image_obj.unassign_policy_profiles('OpenSCAP profile')

    try:
        evm_tail = LogValidator('/var/www/miq/vmdb/log/evm.log',
                                matched_patterns=LOG_VERIFICATION_VERBS)
    except:  # TODO: Should we add a specific exception?
        pytest.skip(
            'Cannot continue test, probably due to containerized appliance\n'
            'Traceback: \n{}'.format(format_exc()))

    evm_tail.fix_before_start()

    image_obj.perform_smartstate_analysis(wait_for_finish=True)

    image_obj.summary.reload()
    for tbl, attr, verifier in test_item.tested_attr:

        table = getattr(image_obj.summary, tbl)

        if not soft_assert(
                hasattr(table, attr),
                '{} table has missing attribute \'{}\''.format(tbl, attr)):
            continue
        value = getattr(table, attr).value
        soft_assert(
            verifier(value),
            '{}.{} attribute has unexpected value ({})'.format(
                tbl, attr, value))
Пример #6
0
def random_image_instance(provider):
    return Image.get_random_instances(provider, count=1).pop()
def random_image_instance(provider):
    return Image.get_random_instances(provider, count=1).pop()
def random_image_instance(provider, appliance):
    return Image.get_random_instances(provider, 1, appliance).pop()