Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] Automate test_distributed_delete_offline_worker_appliance #10253

Merged
merged 1 commit into from
Jul 17, 2020
Merged
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
7 changes: 7 additions & 0 deletions cfme/base/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,13 @@ class ZoneDiagnosticsView(ConfigurationView):
@View.nested
class rolesbyservers(WaitTab): # noqa
TAB_NAME = "Roles by Servers"
title = Text(
'//*[@id="zone_tree_div"]/'
'h3[contains(normalize-space(.), "Status of Roles for Servers in Zone")]'
)
tree = DiagnosticsTreeView("roles_by_server_treebox")
selected_item = SummaryForm("Selected Item")
configuration = Dropdown("Configuration")

@View.nested
class serversbyroles(WaitTab): # noqa
Expand Down
2 changes: 2 additions & 0 deletions cfme/modeling/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from cfme.exceptions import ItemNotFound
from cfme.exceptions import KeyPairNotFound
from cfme.exceptions import RestLookupError
from cfme.utils.appliance import NavigatableMixin
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.log import logger
Expand Down Expand Up @@ -179,6 +180,7 @@ def exists(self):
NameError,
NavigationDestinationNotFound,
NoSuchElementException,
RestLookupError,
RowNotFound,
TimedOutError,
):
Expand Down
17 changes: 0 additions & 17 deletions cfme/tests/distributed/test_appliance_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,6 @@ def test_distributed_zone_mixed_appliance_ip_versions():
pass


@pytest.mark.tier(3)
def test_distributed_delete_offline_worker_appliance():
"""
Steps to Reproduce:
have 3 servers .
Shutdown one server. This become inactive.
go to WebUI > Configuration > Diagnostics > Select "Zone: Default
zone" > Select worker > Configuration > Delete

Polarion:
assignee: tpapaioa
casecomponent: Appliance
initialEstimate: 1/2h
"""
pass


def test_distributed_zone_in_different_networks():
"""
Polarion:
Expand Down
46 changes: 46 additions & 0 deletions cfme/tests/distributed/test_appliance_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,49 @@ def test_appliance_replicate_remote_down(replicated_appliances):
global_appliance.browser.widgetastic.refresh()
assert global_region.replication.get_replication_status(host=remote_appliance.hostname), (
"Remote appliance not found on Replication tab after dropped connection.")


@pytest.mark.tier(3)
@pytest.mark.parametrize('location', ['zone', 'region'], ids=['from_zone', 'from_region'])
def test_distributed_delete_appliance(distributed_appliances, location):
"""In a distributed appliance configuration, shut down the secondary appliance, and verify that
the server record can be deleted from either the zone's or the region's Diagnostics page.

Polarion:
assignee: tpapaioa
casecomponent: Appliance
initialEstimate: 1/2h
"""
primary_appliance, secondary_appliance = distributed_appliances

secondary_server = primary_appliance.collections.servers.instantiate(
sid=secondary_appliance.server.sid)

secondary_appliance.evmserverd.stop()

with primary_appliance:
if location == 'zone':
dest = primary_appliance.server.zone
else:
dest = primary_appliance.server.zone.region

# Delete stopped server from region or zone diagnostics page
view = navigate_to(dest, 'RolesByServers')
server_string = f'{secondary_server.name} [{secondary_server.sid}]'
view.rolesbyservers.tree.click_path(f'Server: {server_string} (stopped)')
view.rolesbyservers.configuration.item_select(f'Delete Server {server_string}',
handle_alert=True)

# Flash message appears when deleting server from zone page, but not from region page
if location == 'zone':
view.flash.assert_success_message(f'Server "{server_string}": Delete successful')

view.browser.refresh()
# Server is removed from Roles By Servers tab's tree
assert not any(e.text.startswith(f'Server: {server_string}') for e in
view.rolesbyservers.tree.root_items)
# Server is removed from Diagnostics tree
assert not any(e.text.startswith(f'Server: {server_string}') for e in
view.accordions.diagnostics.tree.root_items)
# Server is removed from Settings tree
assert not secondary_server.exists