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

Commit

Permalink
Merge pull request #10271 from tpapaioa/automate_occupied_zone_delete
Browse files Browse the repository at this point in the history
[1LP][RFR] Automate test_distributed_zone_delete_occupied
  • Loading branch information
mshriver authored Jul 31, 2020
2 parents 6a0ac7d + 3a6a1f2 commit 1b4f524
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
14 changes: 0 additions & 14 deletions cfme/tests/distributed/test_appliance_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ def test_distributed_zone_add_provider_to_nondefault_zone():
pass


@pytest.mark.tier(1)
def test_distributed_zone_delete_occupied():
"""
Delete Zone that has appliances in it.
Polarion:
assignee: tpapaioa
casecomponent: Appliance
caseimportance: critical
initialEstimate: 1/12h
"""
pass


@pytest.mark.tier(1)
def test_distributed_zone_mixed_appliance_ip_versions():
"""
Expand Down
38 changes: 36 additions & 2 deletions cfme/tests/distributed/test_appliance_replication.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from time import sleep

import fauxfactory
import pytest
from widgetastic.exceptions import NoSuchElementException

from cfme import test_requirements
from cfme.base.ui import LoginPage
Expand All @@ -9,6 +11,7 @@
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.infrastructure.virtual_machines import InfraVmDetailsView
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.tests.configure.test_zones import create_zone
from cfme.utils import conf
from cfme.utils.appliance import ViaREST
from cfme.utils.appliance import ViaUI
Expand Down Expand Up @@ -469,8 +472,8 @@ def test_distributed_delete_appliance(distributed_appliances, location):
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)
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':
Expand All @@ -485,3 +488,34 @@ def test_distributed_delete_appliance(distributed_appliances, location):
view.accordions.diagnostics.tree.root_items)
# Server is removed from Settings tree
assert not secondary_server.exists


@pytest.mark.tier(1)
def test_distributed_zone_delete_occupied(distributed_appliances):
"""Verify that zone with appliances in it cannot be deleted.
Polarion:
assignee: tpapaioa
casecomponent: Appliance
caseimportance: critical
initialEstimate: 1/12h
"""
_, secondary_appliance = distributed_appliances

with secondary_appliance:
# Create new zone
zone = create_zone(secondary_appliance, fauxfactory.gen_alphanumeric(),
fauxfactory.gen_alphanumeric())

# Add secondary appliance to new zone
server_info = secondary_appliance.server.settings
server_info.update_basic_information({'appliance_zone': zone.name})

with pytest.raises(NoSuchElementException):
zone.delete()
assert zone.exists, "Occupied zone was deleted"

server_info.update_basic_information({'appliance_zone': 'default'})

zone.delete()
assert not zone.exists, "Zone could not be deleted"

0 comments on commit 1b4f524

Please sign in to comment.