Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update assertion for discovery plugin test as per IPv4/Ipv6 ip address #17633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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