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

validate that cv warning to force promote #14316

Merged
Merged
Changes from 1 commit
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
68 changes: 68 additions & 0 deletions tests/foreman/cli/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4065,6 +4065,74 @@ def test_version_info_by_lce(self, module_org, module_target_sat):
)
assert content_view['version'] == '1.0'

def test_positive_validate_force_promote_warning(self, target_sat, function_org):
"""Test cv promote shows warning of 'force promotion' for out of sequence LCE

:id: 1bfb76be-ab40-48b4-b5a3-428a2a9ab99b

:steps:
1. Create an environment path ex- Library >> Test >> Preprod >> Prod
2. Create a CV and publish into the Library
3. Promote version 1.0 to Preprod, skip Library, this should fail with warning
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved
4. Promote version 1.0 to Preprod using force, this should success
5. Try to promote version 1.0 from Preprod to Prod, this should success without warning

:expectedresults:
1. CV version 1.0 should be present on Prod LCE

:CaseImportance: High

:BZ: 2125728
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved

:customerscenario: true
"""
# Create an environment path ex- Library >> Test >> Preprod >> Prod
lce_test = target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': function_org.id}
)
lce_preprod = target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': function_org.id, 'prior': lce_test['name']}
)
lce_prod = target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': function_org.id, 'prior': lce_preprod['name']}
)

# Create a CV and publish into the Library
cv = target_sat.cli_factory.make_content_view({'organization-id': function_org.id})
target_sat.cli.ContentView.publish({'id': cv['id']})

# Promote version 1.0 to Preprod, skip Library, this should fail with warning
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved
cv_version = target_sat.cli.ContentView.info({'id': cv['id']})['versions'][0]
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.ContentView.version_promote(
{'id': cv_version['id'], 'to-lifecycle-environment-id': lce_preprod['id']}
)
assert (
'Cannot promote environment out of sequence. Use force to bypass restriction'
in error.value.stderr
)

# Promote version 1.0 to Preprod using force, this should success
target_sat.cli.ContentView.version_promote(
{
'id': cv_version['id'],
'to-lifecycle-environment-id': lce_preprod['id'],
'force': True,
}
)
promoted_lce = target_sat.cli.ContentView.info({'id': cv['id']})['lifecycle-environments'][
-1
]
assert lce_preprod['id'] == promoted_lce['id']
# Try to promote version 1.0 from Preprod to Prod, this should success without warning
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved
target_sat.cli.ContentView.version_promote(
{'id': cv_version['id'], 'to-lifecycle-environment-id': lce_prod['id']}
)
promoted_lce = target_sat.cli.ContentView.info({'id': cv['id']})['lifecycle-environments'][
-1
]
assert lce_prod['id'] == promoted_lce['id']


class TestContentViewFileRepo:
"""Specific tests for Content Views with File Repositories containing
Expand Down