Skip to content

Commit

Permalink
validate that cv warning to force promote
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysawant committed Mar 8, 2024
1 parent cc8227d commit b4a38c7
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/foreman/cli/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4065,6 +4065,62 @@ 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, default_lce):
"""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
2. Create a CV and publish > promote to Test
3. Promote version 1.0 to Preprod (sequencial in environment path)
4. Publish version 2.0
5. Try to promote 2.0 on to Preprod
:expectedresults:
1. After step 4, version 1.0 in 'Test' and 2.0 in 'Library'
2. After step 5, we will get warning, 'Cannot promote environment out of sequence. Use force to bypass restriction'
:CaseImportance: High
:BZ: 2125728
"""
# 1. 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']}
)

# 2. Create a CV and publish > promote to Test
cv = target_sat.cli_factory.make_content_view({'organization-id': function_org.id})
target_sat.cli.ContentView.publish({'id': cv['id']})
cv_version_1 = target_sat.cli.ContentView.info({'id': cv['id']})['versions'][0]
target_sat.cli.ContentView.version_promote(
{'id': cv_version_1['id'], 'to-lifecycle-environment-id': lce_test['id']}
)

# 3. Promote version 1.0 to preprod
target_sat.cli.ContentView.version_promote(
{'id': cv_version_1['id'], 'to-lifecycle-environment-id': lce_preprod['id']}
)

# 4. Publish version 2.0
target_sat.cli.ContentView.publish({'id': cv['id']})
cv_version_2 = target_sat.cli.ContentView.info({'id': cv['id']})['versions'][0]

# 5. Try to promote 2.0 on to Preprod
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.ContentView.version_promote(
{'id': cv_version_2['id'], 'to-lifecycle-environment-id': lce_preprod['id']}
)
assert (
'Cannot promote environment out of sequence. Use force to bypass restriction'
in error.value.stderr
)


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

0 comments on commit b4a38c7

Please sign in to comment.