Skip to content

Commit

Permalink
Parametrize for f-m service restart too
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Apr 16, 2024
1 parent ef76ab1 commit 6ced447
Showing 1 changed file with 40 additions and 30 deletions.
70 changes: 40 additions & 30 deletions tests/foreman/destructive/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,68 @@
pytestmark = pytest.mark.destructive


@pytest.mark.tier4
@pytest.mark.run_in_one_thread
def test_positive_reboot_recover_cv_publish(target_sat, function_sca_manifest_org):
"""Reboot the Satellite during publish and resume publishing
:id: cceae727-81db-40a4-9c26-05ca6e93464e
:setup:
1. Enable and sync 3 bigger RH repos.
:steps:
1. Create and publish a Content View with the setup repos.
2. Reboot the Satellite while publish is running.
3. Check Foreman Tasks.
:expectedresults: Publish continues after reboot and finishes successfully
:CaseImportance: High
:CaseAutomation: Automated
"""
org = function_sca_manifest_org
@pytest.fixture(scope='module')
def module_big_repos(module_target_sat, module_sca_manifest_org):
"""Enables and syncs three bigger RH repos"""
repos = []
for tag in ['rhel7_optional', 'rhel7_extra', 'rhel7_sup']:
id = target_sat.api_factory.enable_rhrepo_and_fetchid(
id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=constants.DEFAULT_ARCHITECTURE,
org_id=org.id,
org_id=module_sca_manifest_org.id,
product=constants.REPOS[tag]['product'],
repo=constants.REPOS[tag]['name'],
reposet=constants.REPOS[tag]['reposet'],
releasever=constants.REPOS[tag]['releasever'],
)
repo = target_sat.api.Repository(id=id).read()
repo = module_target_sat.api.Repository(id=id).read()
repos.append(repo)
repo.sync(synchronous=False)
target_sat.wait_for_tasks(
search_query=(f'label = Actions::Katello::Repository::Sync and organization_id = {org.id}'),
module_target_sat.wait_for_tasks(
search_query=(
f'label = Actions::Katello::Repository::Sync and organization_id = {module_sca_manifest_org.id}'
),
poll_timeout=750,
search_rate=10,
max_tries=75,
)
return repos


@pytest.mark.tier4
@pytest.mark.run_in_one_thread
@pytest.mark.parametrize('reboot', [True, False], ids=['vm_reboot', 'fm_restart'])
def test_positive_reboot_recover_cv_publish(
target_sat, module_sca_manifest_org, module_big_repos, reboot
):
"""Reboot the Satellite during publish and resume publishing
:id: cceae727-81db-40a4-9c26-05ca6e93464e
:parametrized: yes
:setup:
1. Enable and sync 3 bigger RH repos.
:steps:
1. Create and publish a Content View with the setup repos.
2. Reboot or restart the Satellite while publish is running.
3. Check Foreman Tasks.
:expectedresults: Publish continues after reboot/restart and finishes successfully.
"""
cv = target_sat.api.ContentView(
organization=org,
organization=module_sca_manifest_org,
solve_dependencies=True,
repository=repos,
repository=module_big_repos,
).create()
try:
publish_task = cv.publish(synchronous=False)
sleep_time = random.randint(0, 60) # publish takes ~70s in 6.15 and SatLab VM
sleep(sleep_time)
target_sat.power_control(state='reboot', ensure=True)
if reboot:
target_sat.power_control(state='reboot', ensure=True)
else:
target_sat.cli.Service.restart()
target_sat.wait_for_tasks(
search_query=(f'id = {publish_task["id"]}'),
search_rate=30,
Expand Down

0 comments on commit 6ced447

Please sign in to comment.