Skip to content

Commit

Permalink
Fix IPv6 ansible and registration tests (#17205)
Browse files Browse the repository at this point in the history
Fix ipv6 ansible and registration tests

Signed-off-by: Shubham Ganar <[email protected]>
  • Loading branch information
shubhamsg199 authored Dec 20, 2024
1 parent 7f92e12 commit 4c08b39
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/foreman/api/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def test_positive_ansible_job_on_host(
:BZ: 2164400
"""
SELECTED_ROLE = 'RedHatInsights.insights-client'
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
if rhel_contenthost.os_version.major <= 7:
rhel_contenthost.create_custom_repos(rhel7=settings.repos.rhel7_os)
assert rhel_contenthost.execute('yum install -y insights-client').status == 0
Expand Down
2 changes: 2 additions & 0 deletions tests/foreman/api/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def test_positive_update_packages_registration(
:expectedresults: Package update is successful on host post registration.
"""
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
org = module_sca_manifest_org
result = rhel_contenthost.api_register(
module_target_sat,
Expand Down
3 changes: 3 additions & 0 deletions tests/foreman/cli/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_positive_ansible_e2e(
SELECTED_ROLE_1 = 'theforeman.foreman_scap_client'
SELECTED_VAR = gen_string('alpha')
proxy_id = target_sat.nailgun_smart_proxy.id
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
# disable batch tasks to test BZ#2154184
target_sat.cli.Settings.set({'name': 'foreman_tasks_proxy_batch_trigger', 'value': 'false'})
result = rhel_contenthost.register(
Expand Down Expand Up @@ -593,6 +594,8 @@ def test_positive_install_ansible_collection(
:expectedresults: Ansible collection can be installed on content host via REX.
"""
client = rhel_contenthost
# Adding IPv6 proxy for IPv6 communication
client.enable_ipv6_dnf_and_rhsm_proxy()
# Enable Ansible repository and Install ansible or ansible-core package
client.register(module_org, None, module_ak_with_cv.name, target_sat)
rhel_repo_urls = getattr(settings.repos, f'rhel{client.os_version.major}_os', None)
Expand Down
2 changes: 2 additions & 0 deletions tests/foreman/cli/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def test_upgrade_katello_ca_consumer_rpm(
:BZ: 1791503
"""
# Adding IPv6 proxy for IPv6 communication
rhel7_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
consumer_cert_name = f'katello-ca-consumer-{target_sat.hostname}'
consumer_cert_src = f'{consumer_cert_name}-1.0-1.src.rpm'
new_consumer_cert_rpm = f'{consumer_cert_name}-1.0-2.noarch.rpm'
Expand Down
4 changes: 4 additions & 0 deletions tests/foreman/cli/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def test_positive_install_configure_host(
"""
puppet_infra_host = [session_puppet_enabled_sat, session_puppet_enabled_capsule]
for client, puppet_proxy in zip(content_hosts, puppet_infra_host, strict=True):
# Adding IPv6 proxy for IPv6 communication
client.enable_ipv6_dnf_and_rhsm_proxy()
client.configure_puppet(
proxy_hostname=puppet_proxy.hostname, install_puppet_agent7=(client_repo_ver == '1')
)
Expand Down Expand Up @@ -137,6 +139,8 @@ def test_positive_run_puppet_agent_generate_report_when_no_message(
:parametrized: yes
"""
sat = session_puppet_enabled_sat
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
client = rhel_contenthost
client.configure_puppet(
proxy_hostname=sat.hostname,
Expand Down
3 changes: 3 additions & 0 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def test_positive_config_report_ansible(
2. Job report should be created.
"""
SELECTED_ROLE = 'RedHatInsights.insights-client'
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
if rhel_contenthost.os_version.major <= 7:
rhel_contenthost.create_custom_repos(rhel7=settings.repos.rhel7_os)
assert rhel_contenthost.execute('yum install -y insights-client').status == 0
Expand Down Expand Up @@ -787,6 +788,8 @@ def test_positive_install_ansible_collection(
:expectedresults: The Ansible collection is successfully installed on the host
"""
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
client = rhel_contenthost
# Enable Ansible repository and Install ansible or ansible-core package
client.register(module_org, None, module_ak_with_cv.name, target_sat)
Expand Down
7 changes: 7 additions & 0 deletions tests/foreman/ui/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def test_positive_global_registration_end_to_end(
:parametrized: yes
"""
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
# make sure global parameters for rex and insights are set to true
insights_cp = (
module_target_sat.api.CommonParameter()
Expand Down Expand Up @@ -204,6 +206,7 @@ def test_positive_global_registration_end_to_end(
]
for pair in expected_pairs:
assert pair in cmd

# rhel repo required for insights client installation,
# syncing it to the satellite would take too long
rhelver = rhel_contenthost.os_version.major
Expand Down Expand Up @@ -387,6 +390,8 @@ def test_global_registration_with_gpg_repo_and_default_package(
:parametrized: yes
"""
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
client = rhel_contenthost
repo_name = 'foreman_register'
repo_url = settings.repos.gr_yum_repo.url
Expand Down Expand Up @@ -752,6 +757,8 @@ def test_subscription_manager_install_from_repository(
:BZ: 1923320
"""
# Adding IPv6 proxy for IPv6 communication
rhel_contenthost.enable_ipv6_dnf_and_rhsm_proxy()
client = rhel_contenthost
repo_name = 'foreman_register'
rhel_ver = rhel_contenthost.os_version.major
Expand Down

0 comments on commit 4c08b39

Please sign in to comment.