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

[WIPTEST] Fixing infra_hosts_power_tests for the CFME 5.10 #8327

Open
wants to merge 1 commit 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
5 changes: 4 additions & 1 deletion cfme/infrastructure/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,10 @@ def step(self):
try:
self.prerequisite_view.navigation.select("Compute", "Infrastructure", "Hosts")
except NoSuchElementException:
self.prerequisite_view.navigation.select("Compute", "Infrastructure", "Nodes")
try:
self.prerequisite_view.navigation.select("Compute", "Infrastructure", "Nodes")
except NoSuchElementException:
self.prerequisite_view.navigation.select("Compute", "Infrastructure", "Hosts / Nodes")


@navigator.register(Host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def host_collection(appliance):


@pytest.fixture(scope='module')
def host_on(host_collection, provider):
def host_on(host_collection):
try:
my_host_on = provider.nodes.all().pop()
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this change? Now the host that we return may not be associated with the provider for the test function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this change there is an issue with navigating to Host's Details view:

"NameError: Could not find field with name 'Hosts'"

ipdb> my_host_on = host_collection.all().pop()

OpenstackNode(name=u'bc5add29-47a9-4387-bbcc-3f9d9e21631d (NovaCompute)', provider=OpenstackInfraProvider(endpoints={'default': <cfme.infrastructure.provider.openstack_infra.RHOSEndpoint object at 0x7f3097ac8d90>, 'rsa_keypair': <cfme.common.provider.SSHEndpoint object at 0x7f309790a5d0>, 'events': <cfme.common.provider.EventsEndpoint object at 0x7f3097ac88d0>}, name='uc_ci', key='uc_ci', zone=None, start_ip='192.168.24.2', end_ip='192.168.24.2', provider_data=None, api_version='Keystone v3', keystone_v3_domain_id='default'), hostname=None, ip_address=None, custom_ident=None, host_platform=None, ipmi_address=None, mac_address=None, credentials={}, ipmi_credentials=None, interface_type='lan')

and then my_host_on.get_power_state() can't be executed because it goes to the Infrastructure Provider Detail page but we expected to see the Host's Detail page

So if we do the code below the method 'my_host_on.get_power_state()' works ok

ipdb> my_host_on = host_collection.all().pop()

Host(name=u'47b49e2d-c65b-48c6-a27b-605207986de6 (NovaCompute)', provider=None, hostname=None, ip_address=None, custom_ident=None, host_platform=None, ipmi_address=None, mac_address=None, credentials={}, ipmi_credentials=None, interface_type='lan')

Copy link
Contributor

@digitronik digitronik Jan 10, 2019

Choose a reason for hiding this comment

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

@dkholodo: I like @mshriver comment. extending... suppose, we have already have one provider lets vsphere then we add rhos uc then about situation will occur means host_collection.all() will return you all host for both provider.

I would like to suggest you; Please, use filtering of all method. It will help you to filter out hosts/nodes for specific provider and then you can select anyone of them for power operation.

my_host_on = host_collection.all().pop()
except IndexError:
assert False, "Missing nodes in provider's details"

Expand All @@ -30,9 +30,9 @@ def host_on(host_collection, provider):


@pytest.fixture(scope='module')
def host_off(host_collection, provider):
def host_off(host_collection):
try:
my_host_off = provider.nodes.all().pop()
my_host_off = host_collection.all().pop()
except IndexError:
assert False, "Missing nodes in provider's details"

Expand Down