Skip to content

Commit

Permalink
Merge branch 'master' into repo-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible authored May 15, 2024
2 parents 2b31c75 + bc57170 commit d750f18
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/foreman/cli/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pytest

from robottelo.config import settings
from robottelo.exceptions import CLIFactoryError


def assert_job_invocation_result(
Expand Down Expand Up @@ -334,6 +335,37 @@ def test_positive_run_concurrent_jobs(self, rex_contenthosts, target_sat):
target_sat.cli.GlobalParameter().delete({'name': param_name})
assert len(target_sat.cli.GlobalParameter().list({'search': param_name})) == 0

@pytest.mark.parametrize(
'value', [0, -2, 2.5, 'a'], ids=['zero', 'negative', 'decimal', 'string']
)
@pytest.mark.rhel_ver_list([8])
def test_negative_invalid_concurrency_level(self, rex_contenthost, target_sat, value):
"""Tests you can not invoke job with invalid concurrency level
:id: 15b55f91-759a-4b77-8ba2-330a5ca7ca0b
:steps:
1. Run a REX job with invalid concurrency-setting
:expectedresults: should refuse gracefully
:BZ: 2250732
:parametrized: yes
"""
with pytest.raises(CLIFactoryError) as error:
target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Ansible Default',
'inputs': 'command=ls',
'search-query': f'name ~ {rex_contenthost.hostname}',
'concurrency-level': f'{value}',
}
)
assert 'Concurrency level: must be greater than 0' in str(
error.value
) or 'Numeric value is required' in str(error.value)

@pytest.mark.rhel_ver_list([8])
def test_positive_run_serial(self, rex_contenthosts, target_sat):
"""Tests subtasks in a job run one by one when concurrency level set to 1
Expand Down
62 changes: 62 additions & 0 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import re

from airgun.exceptions import DisabledWidgetError, NoSuchElementException
from box import Box
import pytest
from wait_for import wait_for
import yaml
Expand Down Expand Up @@ -447,6 +448,67 @@ def test_positive_export(session, target_sat, function_org, function_location):
assert set(actual_fields) == expected_fields


@pytest.mark.skipif(
(settings.ui.webdriver != 'chrome'), reason='Currently only chrome is supported'
)
@pytest.mark.tier3
def test_positive_export_selected_columns(target_sat, current_sat_location):
"""Select certain columns in the hosts table and check that they are exported in the CSV file.
:id: 2b65c1d6-0b94-11ef-a4b7-000c2989e153
:steps:
1. Select different columns to be displayed in the hosts table.
2. Export the hosts into CSV file.
:expectedresults: All columns selected in the UI table should be exported in the CSV file.
:BZ: 2167146
:customerscenario: true
"""
columns = (
Box(ui='Power', csv='Power Status', displayed=True),
Box(ui='Recommendations', csv='Insights Recommendations Count', displayed=True),
Box(ui='Name', csv='Name', displayed=True),
Box(ui='IPv4', csv='Ip', displayed=True),
Box(ui='IPv6', csv='Ip6', displayed=True),
Box(ui='MAC', csv='Mac', displayed=True),
Box(ui='OS', csv='Operatingsystem', displayed=True),
Box(ui='Owner', csv='Owner', displayed=True),
Box(ui='Host group', csv='Hostgroup', displayed=True),
Box(ui='Boot time', csv='Reported Data - Boot Time', displayed=True),
Box(ui='Last report', csv='Last Report', displayed=True),
Box(ui='Comment', csv='Comment', displayed=True),
Box(ui='Model', csv='Compute Resource Or Model', displayed=True),
Box(ui='Sockets', csv='Reported Data - Sockets', displayed=True),
Box(ui='Cores', csv='Reported Data - Cores', displayed=True),
Box(ui='RAM', csv='Reported Data - Ram', displayed=True),
Box(ui='Virtual', csv='Virtual', displayed=True),
Box(ui='Disks space', csv='Reported Data - Disks Total', displayed=True),
Box(ui='Kernel version', csv='Reported Data - Kernel Version', displayed=True),
Box(ui='BIOS vendor', csv='Reported Data - Bios Vendor', displayed=True),
Box(ui='BIOS release date', csv='Reported Data - Bios Release Date', displayed=True),
Box(ui='BIOS version', csv='Reported Data - Bios Version', displayed=True),
Box(ui='RHEL Lifecycle status', csv='Rhel Lifecycle Status', displayed=True),
Box(ui='Installable updates', csv='Installable ...', displayed=False),
Box(ui='Lifecycle environment', csv='Lifecycle Environment', displayed=True),
Box(ui='Content view', csv='Content View', displayed=True),
Box(ui='Registered', csv='Registered', displayed=True),
Box(ui='Last checkin', csv='Last Checkin', displayed=True),
)

with target_sat.ui_session() as session:
session.location.select(loc_name=current_sat_location.name)
session.host.manage_table_columns({column.ui: column.displayed for column in columns})
file_path = session.host.export()
with open(file_path, newline='') as fh:
csvfile = csv.DictReader(fh)
assert set(csvfile.fieldnames) == set(
[column.csv for column in columns if column.displayed]
)


@pytest.mark.tier4
def test_positive_create_with_inherited_params(
session, target_sat, function_org, function_location_with_org
Expand Down

0 comments on commit d750f18

Please sign in to comment.