Skip to content

Commit

Permalink
update assertion for discovery plugin test as per IPv4/Ipv6 ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed Feb 20, 2025
1 parent c8aeb92 commit cff307e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/foreman/ui/test_discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from fauxfactory import gen_integer, gen_ipaddr, gen_string
import pytest

from robottelo.config import settings


@pytest.fixture
def module_discovery_env(module_org, module_location, module_target_sat):
Expand Down Expand Up @@ -169,7 +171,12 @@ def _finalize():
@pytest.mark.run_in_one_thread
@pytest.mark.tier3
def test_positive_list_host_based_on_rule_search_query(
request, session, module_org, module_location, module_discovery_env, target_sat
request,
session,
module_org,
module_location,
module_discovery_env,
target_sat,
):
"""List all the discovered hosts resolved by given rule's search query
e.g. all discovered hosts with cpu_count = 2, and list rule's associated
Expand All @@ -190,7 +197,7 @@ def test_positive_list_host_based_on_rule_search_query(
:BZ: 1731112
"""
ip_address = gen_ipaddr()
ip_address = gen_ipaddr(ipv6=settings.server.is_ipv6)
cpu_count = gen_integer(2, 10)
rule_name = gen_string('alpha')
rule_search = f'cpu_count = {cpu_count}'
Expand Down Expand Up @@ -236,7 +243,7 @@ def _finalize():
values = session.discoveryrule.read_discovered_hosts(discovery_rule.name)
assert values['searchbox'] == rule_search
assert len(values['table']) == 1
assert values['table'][0]['IP Address'] == ip_address
assert values['table'][0]['IPv6' if settings.server.is_ipv6 else 'IPv4'] == ip_address
assert values['table'][0]['CPUs'] == str(cpu_count)
# auto provision the discovered host
result = target_sat.api.DiscoveredHost(id=discovered_host['id']).auto_provision()
Expand Down

0 comments on commit cff307e

Please sign in to comment.