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

[6.15.z] [6.15] negative test for webhook task #13175

Merged
Merged
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
25 changes: 25 additions & 0 deletions tests/foreman/api/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,28 @@ def test_positive_event_triggered(self, module_org, target_sat, setting_update):
repo.sync()
assert_event_triggered(shell, hook.event)
target_sat.wait_for_tasks(f'Deliver webhook {hook.name}')

@pytest.mark.parametrize('setting_update', ['safemode_render=False'], indirect=True)
def test_negative_event_task_failed(self, module_org, target_sat, setting_update):
"""Create a webhook with unreachable target and assert the associated task
failed

:id: d4a49556-9413-46e8-bcb5-7afd0184bdb2

:expectedresults: Deliver webhook task fails

:CaseImportance: High
"""
hook = target_sat.api.Webhooks(
event='actions.katello.repository.sync_succeeded',
http_method='GET',
target_url="http://localhost/target",
).create()
repo = target_sat.api.Repository(
organization=module_org, content_type='yum', url=settings.repos.yum_0.url
).create()
with target_sat.session.shell() as shell:
shell.send('foreman-tail')
repo.sync()
assert_event_triggered(shell, hook.event)
target_sat.wait_for_tasks(f'Deliver webhook {hook.name}', must_succeed=False)
Loading