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

[RFR] Automate test_utilization_utilization_graphs #10194

Merged
merged 1 commit into from
Jul 10, 2020
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
25 changes: 22 additions & 3 deletions cfme/fixtures/candu.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ def candu_tag_vm(provider, enable_candu_category):


@pytest.fixture(scope="module")
def candu_db_restore(temp_appliance_extended_db):
def candu_db_restore(request, temp_appliance_extended_db):
app = temp_appliance_extended_db
# get DB backup file
db_storage_hostname = conf.cfme_data.bottlenecks.hostname
db_storage_ssh = SSHClient(hostname=db_storage_hostname, **conf.credentials.bottlenecks)
file_name = getattr(request, 'param', 'candu.db.backup')
rand_filename = f"/tmp/db.backup_{fauxfactory.gen_alphanumeric()}"
db_storage_ssh.get_file("{}/candu.db.backup".format(
conf.cfme_data.bottlenecks.backup_path), rand_filename)
db_storage_ssh.get_file(
f"{conf.cfme_data.bottlenecks.backup_path}/{file_name}",
rand_filename
)
app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

app.evmserverd.stop()
Expand All @@ -90,3 +93,19 @@ def candu_db_restore(temp_appliance_extended_db):
app.db.fix_auth_dbyml()
app.evmserverd.start()
app.wait_for_miq_ready()


@pytest.fixture(params=["regions", "providers", "clusters", "hosts"])
def entity_init(temp_appliance_extended_db, request, provider):
appliance = temp_appliance_extended_db
provider.appliance = appliance
if request.param == "regions":
return appliance.collections.regions.instantiate(appliance.region()[-1])
if request.param == "providers":
return provider
if request.param == "clusters":
return appliance.collections.clusters.instantiate(name=provider.data["clusters"][0],
provider=provider)
if request.param == "hosts":
return appliance.collections.hosts.instantiate(name=provider.data["hosts"][0].name,
provider=provider)
2 changes: 2 additions & 0 deletions cfme/infrastructure/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,6 @@ def step(self, *args, **kwargs):
]
if self.appliance.version >= "5.11":
path.insert(0, "Enterprise")
self.prerequisite_view.tree.expand_path(*path)
self.prerequisite_view.browser.plugin.ensure_page_safe()
self.prerequisite_view.tree.click_path(*path)
68 changes: 0 additions & 68 deletions cfme/tests/candu/test_candu_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,74 +90,6 @@ def test_bottleneck_summary_graph():
pass


@pytest.mark.tier(1)
@test_requirements.c_and_u
def test_utilization_utilization_graphs():
"""
Polarion:
assignee: gtalreja
casecomponent: Optimize
initialEstimate: 1/4h
testSteps:
1. Enable C&U
2. Wait until data will be collected
3. Go to Optimize/Utilization
expectedResults:
1.
2.
3. Verify that all graphs shows correctly
"""
pass


@pytest.mark.tier(2)
@test_requirements.c_and_u
def test_utilization_provider():
"""
Verify гutilication data from providers

Polarion:
assignee: gtalreja
casecomponent: Optimize
caseimportance: medium
initialEstimate: 1/8h
testtype: functional
"""
pass


@pytest.mark.tier(2)
@test_requirements.c_and_u
def test_utilization_cluster():
"""
Verify гutilication data from cluster

Polarion:
assignee: gtalreja
casecomponent: Optimize
caseimportance: medium
initialEstimate: 1/8h
testtype: functional
"""
pass


@pytest.mark.tier(2)
@test_requirements.c_and_u
def test_utilization_host():
"""
Verify utilication data from host

Polarion:
assignee: gtalreja
casecomponent: Optimize
caseimportance: medium
initialEstimate: 1/8h
testtype: functional
"""
pass


@pytest.mark.tier(3)
@test_requirements.c_and_u
def test_crosshair_op_cluster_vsphere65():
Expand Down
51 changes: 51 additions & 0 deletions cfme/tests/candu/test_utilization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import pytest

from cfme import test_requirements
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.utils.appliance.implementations.ui import navigate_to

pytestmark = [
pytest.mark.tier(1),
test_requirements.c_and_u,
pytest.mark.provider(
[VMwareProvider, RHEVMProvider, EC2Provider, OpenStackProvider, AzureProvider],
required_fields=[(['cap_and_util', 'capandu_vm'], 'cu-24x7')], scope="module")
]


@pytest.mark.tier(1)
@pytest.mark.provider([VMwareProvider], scope="module")
@pytest.mark.parametrize("candu_db_restore", ["utilization_db.backup"], ids=["db"], indirect=True)
def test_utilization_trends(temp_appliance_extended_db, candu_db_restore, request,
entity_init):
"""
Test to automate the testing of Overview -> Utilization tab

Polarion:
assignee: gtalreja
casecomponent: Optimize
initialEstimate: 1/4h
testSteps:
1. Enable C&U
2. Wait until data will be collected
3. Go to Optimize/Utilization
expectedResults:
1.
2.
3. Verify that all graphs shows correctly
"""
with temp_appliance_extended_db:
view = navigate_to(entity_init, "UtilTrendSummary")

assert view.summary.chart.is_displayed
assert view.details.cpu_chart.is_displayed
assert view.details.memory_chart.is_displayed
if entity_init == "regions":
assert view.details.disk_chart.is_displayed
assert view.report.disk_table.is_displayed
assert view.report.cpu_table.is_displayed
assert view.report.memory_table.is_displayed