Skip to content

Commit

Permalink
[6.15.z] Coverage of BZ#2245081 ansible callback on capsule (#14723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Satellite-QE authored Apr 10, 2024
1 parent c0f0459 commit d9503c8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ def module_lb_capsule(retry_limit=3, delay=300, **broker_args):
Broker(hosts=cap_hosts.out).checkin()


@pytest.fixture(scope='module')
def module_capsule_configured_ansible(module_capsule_configured):
"""Configure the capsule instance with Ansible feature enabled"""
result = module_capsule_configured.install(
cmd_args=[
'enable-foreman-proxy-plugin-ansible',
]
)
assert result.status == 0, 'Installer failed to enable ansible plugin.'
return module_capsule_configured


@pytest.fixture(scope='module')
def module_capsule_configured_async_ssh(module_capsule_configured):
"""Configure the capsule instance with the satellite from settings.server.hostname,
Expand Down
31 changes: 31 additions & 0 deletions tests/foreman/installer/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,37 @@ def test_installer_cap_pub_directory_accessibility(capsule_configured):
assert 'Success!' in command_output.stdout


def test_installer_capsule_with_enabled_ansible(module_capsule_configured_ansible):
"""Enables Ansible feature on external Capsule and checks the callback is set correctly
:id: d60c475e-f4e7-11ee-af8a-98fa9b11ac24
:steps:
1. Have a Satellite with external Capsule integrated
2. Enable Ansible feature on external Capsule
3. Check the ansible callback plugin on external Capsule
:expectedresults:
Ansible callback plugin is overridden to "redhat.satellite.foreman"
:CaseImportance: High
:BZ: 2245081
:customerscenario: true
"""
ansible_env = '/etc/foreman-proxy/ansible.env'
downstream_callback = 'redhat.satellite.foreman'
callback_whitelist = module_capsule_configured_ansible.execute(
f"awk -F= '/ANSIBLE_CALLBACK_WHITELIST/{{print$2}}' {ansible_env}"
)
assert callback_whitelist.stdout.strip('" \n') == downstream_callback
callbacks_enabled = module_capsule_configured_ansible.execute(
f"awk -F= '/ANSIBLE_CALLBACKS_ENABLED/{{print$2}}' {ansible_env}"
)
assert callbacks_enabled.stdout.strip('" \n') == downstream_callback


@pytest.mark.tier1
@pytest.mark.build_sanity
@pytest.mark.first_sanity
Expand Down

0 comments on commit d9503c8

Please sign in to comment.