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

Convert bookmarks upgrade scenarios to new format #16856

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ tests/foreman/ui/test_templatesync.py @SatelliteQE/team-endeavour
tests/foreman/ui/test_user.py @SatelliteQE/team-endeavour
tests/foreman/ui/test_usergroup.py @SatelliteQE/team-endeavour
tests/foreman/ui/test_webhook.py @SatelliteQE/team-endeavour
tests/new_upgrades/test_bookmarks.py @SatelliteQE/team-endeavour
tests/upgrades/test_bookmarks.py @SatelliteQE/team-endeavour
tests/upgrades/test_host.py @SatelliteQE/team-endeavour
tests/upgrades/test_hostgroup.py @SatelliteQE/team-endeavour
Expand Down
11 changes: 11 additions & 0 deletions tests/new_upgrades/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,14 @@ def content_upgrade_shared_satellite():
) as test_duration:
yield sat_instance
test_duration.ready()


@pytest.fixture
def search_upgrade_shared_satellite():
"""Mark tests using this fixture with pytest.mark.search_upgrades."""
sat_instance = shared_checkout("search_upgrade")
with SharedResource(
"search_upgrade_tests", shared_checkin, sat_instance=sat_instance
) as test_duration:
yield sat_instance
test_duration.ready()
175 changes: 175 additions & 0 deletions tests/new_upgrades/test_bookmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
"""Test for bookmark related Upgrade Scenario's

:Requirement: UpgradedSatellite

:CaseAutomation: Automated

:CaseComponent: Search

:Team: Endeavour

:CaseImportance: High

"""

from box import Box
from fauxfactory import gen_alpha
import pytest

from robottelo.constants import BOOKMARK_ENTITIES_SELECTION
from robottelo.utils.shared_resource import SharedResource


@pytest.fixture
def disabled_bookmark_setup(search_upgrade_shared_satellite, upgrade_action):
"""Create public disabled bookmarks for system entities using available bookmark
data.

:id: preupgrade-13904b14-6340-4b85-a56f-98080cf50a92

:steps:

1. Create public disabled bookmarks before the upgrade for all system entities
using available bookmark data.
2. Check the bookmark attribute status(controller, name, query public)
for all the system entities.

:expectedresults: Public disabled bookmark should be created successfully.

:BZ: 1833264, 1826734, 1862119

:customerscenario: true

:CaseImportance: Critical
"""
target_sat = search_upgrade_shared_satellite
with SharedResource(target_sat.hostname, upgrade_action, target_sat=target_sat) as sat_upgrade:
test_data = Box(
{
'target_sat': target_sat,
'test_name': None,
}
)
test_name = f'bookmark_upgrade_{gen_alpha()}'
test_data.test_name = test_name
for entity in BOOKMARK_ENTITIES_SELECTION:
bookmark_name = entity["name"] + test_name
vsedmik marked this conversation as resolved.
Show resolved Hide resolved
bm = target_sat.api.Bookmark(
controller=entity['controller'],
name=bookmark_name,
public=False,
query=f"name={bookmark_name}",
).create()

assert bm.controller == entity['controller']
assert bm.name == bookmark_name
assert bm.query == f"name={bookmark_name}"
assert not bm.public
sat_upgrade.ready()
target_sat._session = None
yield test_data


@pytest.mark.search_upgrades
def test_post_disabled_bookmark(disabled_bookmark_setup):
"""Check the status of public disabled bookmark for all the
system entities(activation keys, tasks, compute profile, content hosts etc) after upgrade.

:id: postupgrade-13904b14-6340-4b85-a56f-98080cf50a92

:steps:

1. Check the bookmark status after post-upgrade.
2. Remove the bookmark.

:expectedresults: Public disabled bookmarks details for all the system entities
should be unchanged after upgrade.

:CaseImportance: Critical
"""
target_sat = disabled_bookmark_setup.target_sat
test_name = disabled_bookmark_setup.test_name
for entity in BOOKMARK_ENTITIES_SELECTION:
bookmark_name = entity["name"] + test_name
bm = target_sat.api.Bookmark().search(query={'search': f'name="{bookmark_name}"'})[0]
assert bm.controller == entity['controller']
assert bm.name == bookmark_name
assert bm.query == f"name={bookmark_name}"
assert not bm.public
bm.delete()


@pytest.fixture
def enabled_bookmark_setup(search_upgrade_shared_satellite, upgrade_action):
"""Create public enable bookmark for system entities using available bookmark
data.

:id: preupgrade-93c419db-66b4-4c9a-a82a-a6a68703881f

:steps:
1. Create public enable bookmarks before the upgrade for all system entities
using available bookmark data.
2. Check the bookmark attribute(controller, name, query public) status
for all the system entities.

:expectedresults: Public enabled bookmark should be created successfully.

:BZ: 1833264, 1826734, 1862119

:CaseImportance: Critical

:customerscenario: true
"""
target_sat = search_upgrade_shared_satellite
with SharedResource(target_sat.hostname, upgrade_action, target_sat=target_sat) as sat_upgrade:
test_data = Box(
{
'target_sat': target_sat,
'test_name': None,
}
)
test_name = f'bookmark_upgrade_{gen_alpha()}'
test_data.test_name = test_name
for entity in BOOKMARK_ENTITIES_SELECTION:
bookmark_name = entity["name"] + test_name
bm = target_sat.api.Bookmark(
controller=entity['controller'],
name=bookmark_name,
public=True,
query=f"name={bookmark_name}",
).create()
assert bm.controller == entity['controller']
assert bm.name == bookmark_name
assert bm.query == f"name={bookmark_name}"
assert bm.public
sat_upgrade.ready()
target_sat._session = None
yield test_data


@pytest.mark.search_upgrades
def test_post_enabled_bookmark(enabled_bookmark_setup):
"""Check the status of public enabled bookmark for all the
system entities(activation keys, tasks, compute profile, content hosts etc) after upgrade.

:id: postupgrade-93c419db-66b4-4c9a-a82a-a6a68703881f

:steps:
1. Check the bookmark status after post-upgrade.
2. Remove the bookmark.

:expectedresults: Public disabled bookmarks details for all the system entities
should be unchanged after upgrade.

:CaseImportance: Critical
"""
target_sat = enabled_bookmark_setup.target_sat
test_name = enabled_bookmark_setup.test_name
for entity in BOOKMARK_ENTITIES_SELECTION:
bookmark_name = entity["name"] + test_name
bm = target_sat.api.Bookmark().search(query={'search': f'name="{bookmark_name}"'})[0]
assert bm.controller == entity['controller']
assert bm.name == bookmark_name
assert bm.query == f"name={bookmark_name}"
assert bm.public
bm.delete()