This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
[WIP] Tests for grouping cluster candu graphs by tags #8677
Open
nachandr
wants to merge
8
commits into
ManageIQ:master
Choose a base branch
from
nachandr:candu_group_cluster_graph_by_tag
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6dc237a
Tests for grouping cluster candu graphs by tags
nachandr 29f018d
Tests for grouping cluster candu graphs by tags
nachandr 96f7726
Tests for grouping cluster candu graphs by tags
nachandr 279db12
Tests for grouping cluster candu graphs by tags
nachandr ead747a
Tests for grouping cluster candu graphs by tags
nachandr 2ba1dae
Tests for grouping cluster candu graphs by tags
nachandr d05717a
Tests for grouping cluster candu graphs by tags
nachandr 2a01cb2
Tests for grouping cluster candu graphs by tags
nachandr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
from cfme import test_requirements | ||
from cfme.common.candu_views import UtilizationZoomView | ||
from cfme.infrastructure.provider import InfraProvider | ||
from cfme.tests.candu import compare_data_with_unit | ||
from cfme.utils.appliance.implementations.ui import navigate_to | ||
|
||
|
@@ -12,40 +13,61 @@ | |
test_requirements.c_and_u | ||
] | ||
|
||
HOST_GRAPHS = ['host_cpu', | ||
'host_memory', | ||
'host_disk', | ||
'host_network', | ||
'host_cpu_state'] | ||
GRAPHS = ['cpu', | ||
'memory', | ||
'disk', | ||
'network', | ||
'cpu_state'] | ||
|
||
INTERVAL = ['Hourly', 'Daily'] | ||
|
||
GROUP_BY = ['VM Location'] | ||
|
||
CANDU_VM = 'cu-24x7' | ||
|
||
ENTITY = ['host', 'cluster'] | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def host(temp_appliance_extended_db): | ||
def entity_object(temp_appliance_extended_db, entity): | ||
vm = temp_appliance_extended_db.rest_api.collections.vms.get(name=CANDU_VM) | ||
|
||
vm_host = vm.host.name | ||
return temp_appliance_extended_db.collections.hosts.instantiate(name=vm_host) | ||
provider = temp_appliance_extended_db.rest_api.collections.providers.get(id=vm.ems_id) | ||
provider_object = temp_appliance_extended_db.collections.infra_providers.instantiate( | ||
InfraProvider, name=provider.name) | ||
vm_object = temp_appliance_extended_db.collections.infra_vms.instantiate( | ||
CANDU_VM, provider_object) | ||
if entity == 'host': | ||
return vm_object.host | ||
elif entity == 'cluster': | ||
return vm_object.cluster | ||
""" | ||
if entity == 'host': | ||
vm_host = vm.host.name | ||
return temp_appliance_extended_db.collections.hosts.instantiate(name=vm_host) | ||
elif entity == 'cluster': | ||
provider = temp_appliance_extended_db.rest_api.collections.providers.get(id=vm.ems_id) | ||
provider_object = temp_appliance_extended_db.collections.infra_providers.instantiate( | ||
InfraProvider, name=provider.name) | ||
vm_object = temp_appliance_extended_db.collections.infra_vms.instantiate( | ||
CANDU_VM, provider_object) | ||
return vm_object.cluster | ||
""" | ||
|
||
|
||
@pytest.mark.parametrize('gp_by', GROUP_BY, ids=['vm_tag']) | ||
@pytest.mark.parametrize('interval', INTERVAL) | ||
@pytest.mark.parametrize('graph_type', HOST_GRAPHS) | ||
def test_tagwise(candu_db_restore, interval, graph_type, gp_by, host): | ||
@pytest.mark.parametrize('graph_type', GRAPHS) | ||
@pytest.mark.parametrize('entity', ENTITY) | ||
def test_tagwise(candu_db_restore, interval, graph_type, gp_by, entity, entity_object): | ||
"""Tests for grouping host graphs by VM tag for hourly and Daily intervals | ||
|
||
prerequisites: | ||
* DB from an appliance on which C&U is enabled | ||
* DB should have C&U data collection enabled for Tag category | ||
* DB should have a VM tagged with proper tag category | ||
* DB should have a VM and VM/host tagged with proper tag category | ||
|
||
Steps: | ||
* Navigate to Host Utilization Page | ||
* Navigate to Host/Cluster Utilization Page | ||
* Select interval(Hourly or Daily) | ||
* Select group by option with VM tag | ||
* Check graph displayed or not | ||
|
@@ -61,21 +83,42 @@ def test_tagwise(candu_db_restore, interval, graph_type, gp_by, host): | |
initialEstimate: 1/4h | ||
casecomponent: CandU | ||
""" | ||
view = navigate_to(host, 'candu') | ||
if entity == 'host': | ||
view = navigate_to(entity_object, 'candu') | ||
elif entity == 'cluster': | ||
view = navigate_to(entity_object, 'Utilization') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aaaaaahhh this was my bad :). I think we need to use same name. TODO: need PR for this. |
||
data = {'interval': interval, 'group_by': gp_by} | ||
view.options.fill(data) | ||
|
||
entity_graph = '{}_{}'.format(entity, graph_type) | ||
|
||
# Check graph displayed or not | ||
try: | ||
graph = getattr(view.interval_type, graph_type) | ||
if entity == 'host': | ||
graph = getattr(view.interval_type, entity_graph) | ||
elif entity == 'cluster': | ||
graph = getattr(view, entity_graph) | ||
except AttributeError: | ||
pytest.fail('{} graph was not displayed'.format(graph_type)) | ||
pytest.fail('{} graph was not displayed'.format(entity_graph)) | ||
assert graph.is_displayed | ||
|
||
# zoom in button not available with normal graph except Host and VM. | ||
# We have to use vm or host average graph for zoom in operation. | ||
if entity == 'cluster': | ||
graph_zoom = ["cluster_host", "cluster_vm"] | ||
enity_avg_graph = '{}_vm_host_avg'.format(entity_graph) | ||
# entity_graph = entity + '_' + graph_type | ||
avg_graph = entity_graph if entity_graph in graph_zoom else enity_avg_graph | ||
try: | ||
avg_graph = getattr(view, avg_graph) | ||
except AttributeError: | ||
pytest.fail('{} graph was not displayed'.format(entity_graph)) | ||
|
||
graph.zoom_in() | ||
view = view.browser.create_view(UtilizationZoomView) | ||
|
||
# check for chart and tag London available or not in legend list. | ||
# wait, some time graph take time to load | ||
view.flush_widget_cache() | ||
assert view.chart.is_displayed | ||
legends = view.chart.all_legends | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required:
we have property for getting
custer
for specificvm
integration_tests/cfme/infrastructure/virtual_machines.py
Line 985 in af5e08f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nachandr when we were looking at this the other day, we were using the entity object that was returned by the rest api. What @digitronik is suggesting here is to actually use the vm and cluster collections (this will use the GUI).
Nikhil and I did chat offline and this is slower with our current implementation. I think both ways work here.