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

add teardown condition to execute other test seamlessly #16219

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
8 changes: 6 additions & 2 deletions tests/foreman/cli/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def test_positive_auto_attach_disabled_golden_ticket(
assert "This host's organization is in Simple Content Access mode" in str(context.value)


def test_negative_check_katello_reimport(target_sat, function_org):
def test_negative_check_katello_reimport(request, target_sat, function_org):
"""Verify katello:reimport trace should not fail with an TypeError

:id: b7508a1c-7798-4649-83a3-cf94c7409c96
Expand All @@ -297,6 +297,7 @@ def test_negative_check_katello_reimport(target_sat, function_org):

:BZ: 2225534, 2253621
"""
request.addfinalizer(lambda: function_org.delete())
remote_path = f'/tmp/{EXPIRED_MANIFEST}'
target_sat.put(DataFile.EXPIRED_MANIFEST_FILE, remote_path)
# Import expired manifest & refresh
Expand All @@ -307,13 +308,16 @@ def test_negative_check_katello_reimport(target_sat, function_org):
'grep -i "Katello::HttpErrors::BadRequest: This Organization\'s subscription '
'manifest has expired. Please import a new manifest" /var/log/foreman/production.log'
)
assert exec_val.status
assert exec_val.status == 0
# Delete expired manifest
target_sat.cli.Subscription.delete_manifest({'organization-id': function_org.id})
# Re-import new manifest & refresh
manifester = Manifester(manifest_category=settings.manifest.golden_ticket)
manifest = manifester.get_manifest()
target_sat.upload_manifest(function_org.id, manifest.content)
request.addfinalizer(
lambda: target_sat.cli.Subscription.delete_manifest({'organization-id': function_org.id})
)
ret_val = target_sat.cli.Subscription.refresh_manifest({'organization-id': function_org.id})
assert 'Candlepin job status: SUCCESS' in ret_val
# Additional check, katello:reimport trace should not fail with TypeError
Expand Down