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

[1LP][RFR] Fix minor version update tests. #8521

Merged
merged 36 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
db33eab
Fix minor version update tests.
Feb 28, 2019
049b2f7
Fix test_update_replicated_webui and add single()
Mar 14, 2019
e893c01
Fix missing wait_for_evm_service.
Mar 14, 2019
2ec384c
Use browser stealing.
Mar 15, 2019
d99e1a8
Convert ha_appliances_with_providers to expect.
Mar 15, 2019
32ff4a7
Fix test_update_distributed_webui
Mar 16, 2019
704337c
Add waits to update tests.
Mar 18, 2019
3565f58
Fix failure trying deleting nonexisting VM.
Mar 18, 2019
0a4202d
Provide more information on vmdb_version ssh command failure
Mar 21, 2019
2dd769f
Unificate is_ha_monitor_started, fix it for cfme 5.10
Mar 26, 2019
e2e28e8
Fix ha_appliances_with_providers doc.
Mar 26, 2019
2cf7bca
Fix test_update_ha_webui, consolidate failover state getters
Mar 27, 2019
e188a86
Add safety check for the cfme version in the repo file.
Apr 11, 2019
3bc3335
Add wait_for when checking the login page.
Apr 23, 2019
3311535
add preupdate version parameter
Apr 23, 2019
3abf3ef
fix replicated_appliances_with_providers
Apr 26, 2019
a859935
Fix code formatting test_update_distributed_webui
Apr 26, 2019
7ccdf52
Fix test_update_embedded_ansible_webui
Apr 26, 2019
a2a556d
Add BZ blocker: 1704835
Apr 30, 2019
df1725e
Add Accept header when waiting for evmserverd.
Apr 30, 2019
917d0c2
Wait for failover-monitor to stabilize after restart
May 14, 2019
60dd675
Use LogValidator for inspecting the logs.
May 15, 2019
fe9290a
Make flake8 happy
May 15, 2019
7ddf0f6
Change waiting for appliance update in test_update_distributed_webui
May 24, 2019
ddb5a70
Fix error message formatting in get_apps
May 24, 2019
22198ca
Beautifulize the pytest_generate_tests
May 24, 2019
5afbe5e
Fix 'ApplianceDB' object has no attribute 'postgres_version'
Jun 4, 2019
39ac6bc
Allow non-strict ssh host key checking.
Jun 3, 2019
4d50df1
Remove single() in favor of unpacking.
Jul 8, 2019
6f13e2a
Use six for the problematic imports
Jul 12, 2019
f41d25b
Increase the timeout for update to make test_update_webui pass
Jul 18, 2019
61871c1
Fix 404 when baseurl doesn't end with slash.
Jul 8, 2019
9d3528b
Add docblock about two masters problem to get_master
Jul 24, 2019
9813814
Add condition dealing with BZ 1732092.
Jul 24, 2019
39c6c41
Add yum strategy HA upgrade testing to the existing webui option
Jul 24, 2019
72ea775
Decrease the verbosity of ssh expect interacitions.
Jul 24, 2019
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
26 changes: 16 additions & 10 deletions cfme/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ def name(self):
string if entity has the name attribute
None if its missing
"""
collect = self.appliance.rest_api.collections.servers
servers = collect.all if self.appliance.is_dev else collect.find_by(is_master=True)
return getattr(servers[0], 'name', '') # empty string default for string building w/o None
# empty string default for string building w/o None
return getattr(self.appliance._rest_api_server(), 'name', '')

@property
def settings(self):
Expand All @@ -67,7 +66,7 @@ def collect_logs(self):
@property
def zone(self):
server_res = self.appliance.rest_api.collections.servers.find_by(id=self.sid)
server = server_res[0]
server, = server_res
server.reload(attributes=['zone'])
zone = server.zone
zone_obj = self.appliance.collections.zones.instantiate(
Expand Down Expand Up @@ -160,14 +159,22 @@ def all(self):
return servers

def get_master(self):
"""Look for the master server through REST entity, use its ID to instantiate Server
"""Look for the master server through REST entity, use its ID to
instantiate Server

In replicated environment, we can have more than one master. In such
case one of them (quite randomly thus quite possibly the incorrect one)
used to be selected by the get_master function.

To get the the correct rest-api object matching the appliance in the
context the IPAppliance._rest_api_server has to be used .

Returns:
:py:class:`cfme.base.Server` entity
"""
collect = self.appliance.rest_api.collections.servers
servers = collect.all if self.appliance.is_dev else collect.find_by(is_master=True)
server = servers[0]
server, = servers
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are expecting more servers then I would prefer unpacking like

server, *_ = servers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good tip. I didn't know that * does such thing. But I am expecting single server here. I have had implemented single() function which was checking whether there is exactly one item in the list and picked it, but I was told to use the unpacking instead.


if not hasattr(server, 'name'):
logger.warning('rest_api server object has no name attribute')
Expand Down Expand Up @@ -206,7 +213,7 @@ def collect_logs(self):
@property
def region(self):
zone_res = self.appliance.rest_api.collections.zones.find_by(id=self.id)
zone = zone_res[0]
zone, = zone_res
zone.reload(attributes=['region_number'])
region_obj = self.appliance.collections.regions.instantiate(number=zone.region_number)
return region_obj
Expand Down Expand Up @@ -298,10 +305,9 @@ def _api_settings_url(self):
region_filter = self.appliance.rest_api.get(
'{}{}'.format(self.appliance.rest_api.collections.regions._href, filter_query)
)
assert len(region_filter['resources']) == 1
region_id = region_filter['resources'][0]['id']
region, = region_filter['resources']
return '/'.join([self.appliance.rest_api.collections.regions._href,
str(region_id),
str(region['id']),
'settings'])

@property
Expand Down
8 changes: 3 additions & 5 deletions cfme/base/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,17 @@ def prerequisite(self):

def step(self, *args, **kwargs):
# Can be either blank or logged in
from cfme.utils import browser
logged_in_view = self.create_view(BaseLoggedInPage)
if logged_in_view.logged_in:
logged_in_view.logout()

# TODO this is not the place to handle this behavior
if not self.view.wait_displayed(timeout=3):
if not self.view.wait_displayed(timeout=60):
# Something is wrong
from cfme.utils import browser
del self.view # In order to unbind the browser
browser.quit()
browser.ensure_browser_open(self.obj.appliance.server.address())
if not self.view.wait_displayed(timeout=3):
raise Exception('Could not open the login screen')
raise


@navigator.register(Server)
Expand Down
Loading