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

[1LP][RFR] New Test: Testing managed vms relationships #9788

Merged
merged 1 commit into from
Dec 24, 2019
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
23 changes: 23 additions & 0 deletions cfme/infrastructure/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from cfme.exceptions import displayed_not_implemented
from cfme.exceptions import ItemNotFound
from cfme.exceptions import MenuItemNotFound
from cfme.infrastructure.virtual_machines import VmsTemplatesAllView
from cfme.modeling.base import BaseCollection
from cfme.modeling.base import BaseEntity
from cfme.utils import ParamClassName
Expand Down Expand Up @@ -128,6 +129,19 @@ def is_displayed(self):
)


class DatastoreManagedVMsView(VmsTemplatesAllView):
"""
This view represents All VMs and Templates page for datastores
"""

@property
def is_displayed(self):
return (
self.logged_in_as_current_user and
self.entities.title.text == f'{self.context["object"].name} (All VMs and Instances)'
)


class DatastoreDetailsView(BaseLoggedInPage):
"""
represents Datastore Details page
Expand Down Expand Up @@ -448,3 +462,12 @@ class Utilization(CFMENavigateStep):

def step(self, *args, **kwargs):
self.prerequisite_view.toolbar.monitoring.item_select("Utilization")


@navigator.register(Datastore)
class ManagedVMs(CFMENavigateStep):
VIEW = DatastoreManagedVMsView
prerequisite = NavigateToSibling("Details")

def step(self, *args, **kwargs):
self.prerequisite_view.entities.relationships.click_at('Managed VMs')
21 changes: 0 additions & 21 deletions cfme/tests/automate/test_automate_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,27 +277,6 @@ def test_vm_naming_number_padding():
pass


@pytest.mark.tier(1)
@pytest.mark.ignore_stream("5.10")
def test_vm_name_automate_method():
"""This test case will check redesign of vm_name automated method

Polarion:
assignee: ghubale
initialEstimate: 1/8h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.11
casecomponent: Automate
tags: automate

Bugzilla:
1677573
"""
pass


@pytest.mark.tier(1)
def test_git_refresh_with_renamed_yaml():
"""
Expand Down
26 changes: 0 additions & 26 deletions cfme/tests/cloud_infra_common/test_power_control_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,32 +290,6 @@ def test_check_compliance_policy_option_on_vm_summery_page():
pass


@pytest.mark.tier(2)
@pytest.mark.ignore_stream("5.10")
def test_power_states_with_respective_provider():
"""
Polarion:
assignee: ghubale
initialEstimate: 1/12h
caseimportance: medium
caseposneg: positive
testtype: functional
startsin: 5.11
casecomponent: Control
tags: power
testSteps:
1. Provision Azure Instance
2. In Instance detail page, select Resume from Lifecycle menu
expectedResults:
1.
2. Should not have Resume button there or disable button upon provider

Bugzilla:
1541447
"""
pass


@pytest.mark.tier(2)
@pytest.mark.meta(coverage=[1740285])
def test_power_operations_on_paused_provider():
Expand Down
49 changes: 42 additions & 7 deletions cfme/tests/cloud_infra_common/test_relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from cfme.infrastructure.datastore import HostAllDatastoresView
from cfme.infrastructure.datastore import ProviderAllDatastoresView
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.infrastructure.virtual_machines import HostTemplatesOnlyAllView
from cfme.infrastructure.virtual_machines import ProviderTemplatesOnlyAllView
Expand All @@ -34,8 +35,11 @@
from cfme.storage.manager import ProviderStorageManagerAllView
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.blockers import BZ
from cfme.utils.generators import random_vm_name
from cfme.utils.log import logger
from cfme.utils.log_validator import LogValidator


HOST_RELATIONSHIPS = [
("Infrastructure Provider", InfraProviderDetailsView),
("Cluster", ClusterDetailsView),
Expand Down Expand Up @@ -402,12 +406,28 @@ def test_change_network_security_groups_per_page_items():
pass


@pytest.fixture(scope="function")
def testing_vm(appliance, provider):
"""Fixture to provision vm"""
vm_name = random_vm_name('pwr-c')
vm = appliance.collections.infra_vms.instantiate(vm_name, provider)

if not provider.mgmt.does_vm_exist(vm.name):
logger.info("deploying %s on provider %s", vm.name, provider.key)
vm.create_on_provider(allow_skip="default", find_in_cfme=True)
yield vm
vm.cleanup_on_provider()


@test_requirements.relationships
@pytest.mark.manual
@pytest.mark.tier(1)
@pytest.mark.meta(coverage=[1729953])
def test_datastore_relationships():
@pytest.mark.meta(automates=[1729953], blockers=[BZ(1729953)])
@pytest.mark.provider([RHEVMProvider], selector=ONE)
def test_datastore_relationships(setup_provider, testing_vm):
"""
Bugzilla:
1729953

Polarion:
assignee: ghubale
casecomponent: Infra
Expand All @@ -428,11 +448,26 @@ def test_datastore_relationships():
1.
2.
3. Operations should be performed successfully. It should not give unexpected error.

Bugzilla:
1729953
"""
pass
view = navigate_to(testing_vm.datastore, "ManagedVMs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to provision a VM in order to navigate to its datastore's ManagedVMs view? I understand that this is a part of BZ steps-to-reproduce, but can you not just add a provider, select a datastore, navigate to the ManagedVMs page and test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is possible:

view = navigate_to(appliance.collections.datastores.all()[0], "ManagedVMs")
  • But in this test case, I need to have one VM on which I can perform relationships.

view.entities.get_entity(name=testing_vm.name).check()

view.toolbar.configuration.item_select("Refresh Relationships and Power States",
handle_alert=True)
view.flash.assert_success_message(
"Refresh Provider initiated for 1 VM and Instance from the CFME Database"
)
view.flash.dismiss()

view.toolbar.configuration.item_select('Perform SmartState Analysis',
handle_alert=True)
view.flash.assert_success_message(
"Analysis initiated for 1 VM and Instance from the CFME Database"
)
view.flash.dismiss()

view.toolbar.configuration.item_select('Extract Running Processes', handle_alert=True)
view.flash.assert_no_error()


@test_requirements.relationships
Expand Down