Skip to content

Commit

Permalink
close-loop bz2209968
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr committed Feb 21, 2024
1 parent 0be99dd commit 9350cee
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
18 changes: 18 additions & 0 deletions robottelo/utils/datafactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,24 @@ def valid_hostgroups_list():
]


@filtered_datapoint
def valid_hostgroups_list_short():
"""Generates a list of valid host group names. Shorter so they can be nested.
:return: Returns the valid host group names list
"""
return [
gen_string('alphanumeric', random.randint(1, 15)),
gen_string('alpha', random.randint(1, 15)),
gen_string('cjk', random.randint(1, 15)),
gen_string('latin1', random.randint(1, 15)),
gen_string('numeric', random.randint(1, 15)),
gen_string('utf8', random.randint(1, 15)),
gen_string('html', random.randint(1, 15)),
gen_string('alphanumeric', random.randint(1, 15)),
]


@filtered_datapoint
def valid_labels_list():
"""Generates a list of valid labels."""
Expand Down
45 changes: 44 additions & 1 deletion tests/foreman/ui/test_jobinvocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from inflection import camelize
import pytest

from robottelo.utils.datafactory import gen_string
from robottelo.utils.datafactory import (
gen_string,
valid_hostgroups_list_short,
)


@pytest.fixture
Expand All @@ -27,6 +30,46 @@ def module_rhel_client_by_ip(module_org, smart_proxy_location, rhel7_contenthost
return rhel7_contenthost


@pytest.mark.no_containers
@pytest.mark.tier4
def test_positive_bz2209968(
session,
module_org,
smart_proxy_location,
module_rhel_client_by_ip,
target_sat,
):
"""Check that full host group names are displayed when invoking a job
:id: 2301cd1d-ed82-4168-9f9b-d1661ac8fc5b
:steps:
1. Go to Monitor -> Jobs -> Run job
2. In "Target hosts and inputs" step, choose "Host groups" targeting
:expectedresults: Verify that in the dropdown, full hostgroup names are present, e.g. Parent/Child/Grandchild
:parametrized: yes
"""
names = valid_hostgroups_list_short()
parent1 = target_sat.cli_factory.hostgroup({'name': names[0]})
parent2 = target_sat.cli_factory.hostgroup({'name': names[1]})
child1a = target_sat.cli_factory.hostgroup({'name': names[2], 'parent': parent1['name']})
child1b = target_sat.cli_factory.hostgroup({'name': names[3], 'parent': parent1['name']})
target_sat.cli_factory.hostgroup({'name': names[4], 'parent': child1a['name']})
target_sat.cli_factory.hostgroup({'name': names[5], 'parent': child1a['name']})
target_sat.cli_factory.hostgroup({'name': names[6], 'parent': child1b['name']})
target_sat.cli_factory.hostgroup({'name': names[7], 'parent': parent2['name']})

with session:
session.organization.select(module_org.name)
session.location.select(smart_proxy_location.name)
hostgroups = session.jobinvocation.read_hostgroups()

assert 'fish' in hostgroups


@pytest.mark.tier4
def test_positive_run_default_job_template_by_ip(
session, module_org, smart_proxy_location, module_rhel_client_by_ip
Expand Down

0 comments on commit 9350cee

Please sign in to comment.