From 07dc41c2280e9406ccfd04edcf3bc9598c2934ec Mon Sep 17 00:00:00 2001 From: Mike Shriver Date: Tue, 20 Aug 2019 15:27:38 -0400 Subject: [PATCH] Move tier and requirement markers out of fixtures Add customer-scenario filter and marker register the markers default customerscenario update pytest-polarion-collect and other polarion packages Remove test injection from test_advanced_search, for meta The polarion meta was not correctly parsed, and with updates to pytest-polarion-collect and polarion_docstrings, the unmerged docstrings are causing exceptions and failures during collection. Go to boilerplate for this test module, until the meta processing is resolved. Update smem to run with python2 explicitly --- cfme/fixtures/node_annotate.py | 137 ------ cfme/markers/__init__.py | 7 +- cfme/markers/manual.py | 2 +- cfme/markers/marker_filters.py | 78 +++ cfme/test_framework/pytest_plugin.py | 1 - cfme/test_requirements.py | 23 +- .../test_service_vm_custom_button.py | 1 + cfme/tests/v2v/test_csv_import.py | 13 +- cfme/tests/webui/test_advanced_search.py | 444 ++++++++++++------ cfme/utils/smem_memory_monitor.py | 2 +- conf/polarion_tools.yaml | 3 +- requirements/frozen.py3.txt | 6 +- requirements/frozen_docs.py3.txt | 6 +- 13 files changed, 410 insertions(+), 313 deletions(-) delete mode 100644 cfme/fixtures/node_annotate.py create mode 100644 cfme/markers/marker_filters.py diff --git a/cfme/fixtures/node_annotate.py b/cfme/fixtures/node_annotate.py deleted file mode 100644 index 1edaf763ad..0000000000 --- a/cfme/fixtures/node_annotate.py +++ /dev/null @@ -1,137 +0,0 @@ -import csv -import os -from operator import itemgetter - -import py -import pytest -import yaml - -from cfme.fixtures.pytest_store import store -from cfme.utils.conf import cfme_data -from cfme.utils.path import project_path - - -class MarkFromMap(object): - def __init__(self, mark_map): - self.mark_map = mark_map - - def pytest_itemcollected(self, item): - mark = self.mark_map.get(item.nodeid) - if mark is not None: - # todo: warn when the applied marker differs from the data - if not item.get_marker(mark.name): - item.add_marker(mark) - - @classmethod - def from_parsed_list(cls, parsed, key, map_value): - data = dict(list(map(itemgetter('id', key), parsed))) - mark_map = dict((k, map_value(v)) for k, v in data.items()) - return cls(mark_map) - - -def pytest_configure(config): - if config.getoption('--help'): - return - path = cfme_data.get('cfme_annotations_path') - if path: - to_parse = project_path.join(path) - parsed = parse(to_parse) - if not parsed: - store.terminalreporter.line( - 'no test annotation found in {}'.format(to_parse), yellow=True) - else: - store.terminalreporter.line('no test annotation found in {}'.format(path), yellow=True) - parsed = [] - config.pluginmanager.register(MarkFromMap.from_parsed_list( - parsed, 'tier', pytest.mark.tier)) - config.pluginmanager.register(MarkFromMap.from_parsed_list( - parsed, 'requirement', pytest.mark.requirement)) - config.pluginmanager.register(MarkFromMap.from_parsed_list(parsed, 'type', - pytest.mark.__getattr__)) - - -def pytest_addoption(parser): - group = parser.getgroup('cfme') - group.addoption('--tier', type=int, action='append', help='only run tests of the given tiers') - group.addoption('--requirement', type=str, action='append', - help='only run tests of the given requirements') - - -def tier_matches(item, tiers): - mark = item.get_marker('tier') - if getattr(mark, 'args', None) is None: - return False - return mark.args[0] in tiers - - -def requirement_matches(item, requirements): - mark = item.get_marker('requirement') - if getattr(mark, 'args', None) is None: - return False - return mark.args[0] in requirements - - -def pytest_collection_modifyitems(config, items): - tiers = config.getoption('tier') - requirements = config.getoption('requirement') - if not tiers and not requirements: - return - # TODO(rpfannsc) trim after pytest #1373 is done - keep, discard = [], [] - - for item in items: - if tiers and not tier_matches(item, tiers): - discard.append(item) - continue - elif requirements and not requirement_matches(item, requirements): - discard.append(item) - continue - else: - keep.append(item) - - items[:] = keep - # TODO(rpfannsc) add a reason after pytest #1372 is fixed - config.hook.pytest_deselected(items=discard) - - -def generate_nodeid(mapping): - title = mapping['Title'] - caseid = mapping['Test Case ID'] - if not caseid: - raise ValueError('incomplete entry') - - needle = title.find('[') - attribute_part = title[:needle].replace('.', '::') - - parameter_part = title[needle:] - if os.sep not in caseid: - file_part = caseid[:-needle - 1].replace('.', os.sep) - else: - file_part = caseid - - return "{}.py::{}{}".format(file_part, attribute_part, parameter_part) - - -def _clean(mapping): - mapping.pop('', '') - try: - return { - 'requirement': int(mapping['Requirement']), - 'tier': int(mapping['TestTier']), - 'id': generate_nodeid(mapping), - 'type': mapping['TestType'].lower(), - } - except (TypeError, ValueError): - return None - - -def parse(path): - if not path.check(): - return [] - with path.open() as fp: - return [_f for _f in map(_clean, csv.DictReader(fp)) if _f] - - -if __name__ == '__main__': - mapping_file = project_path.join(py.std.sys.argv[1]) - print(yaml.safe_dump(parse(mapping_file), default_flow_style=False)) diff --git a/cfme/markers/__init__.py b/cfme/markers/__init__.py index 00da77d697..a1c74c2735 100644 --- a/cfme/markers/__init__.py +++ b/cfme/markers/__init__.py @@ -3,13 +3,14 @@ "cfme.markers.crud", "cfme.markers.fixtureconf", "cfme.markers.meta", - "cfme.markers.stream_excluder", + "cfme.markers.polarion", "cfme.markers.requires", "cfme.markers.rhv", "cfme.markers.sauce", "cfme.markers.skipper", + "cfme.markers.smoke", + "cfme.markers.stream_excluder", + "cfme.markers.marker_filters", "cfme.markers.uses", "cfme.markers.uncollect", - "cfme.markers.smoke", - "cfme.markers.polarion", ] diff --git a/cfme/markers/manual.py b/cfme/markers/manual.py index 557034499d..b7093acdcb 100644 --- a/cfme/markers/manual.py +++ b/cfme/markers/manual.py @@ -1,4 +1,4 @@ -"""manual: Marker for marking tests asmanual tests.""" +"""manual: Marker for marking tests as manual tests.""" import pytest from cfme.fixtures.pytest_store import store diff --git a/cfme/markers/marker_filters.py b/cfme/markers/marker_filters.py new file mode 100644 index 0000000000..642fe7e7e0 --- /dev/null +++ b/cfme/markers/marker_filters.py @@ -0,0 +1,78 @@ +"""Marker definitions for tier and requirement, and meta filter plugin + +""" +import re + +from cfme.fixtures.pytest_store import store + + +TEST_PARAM_FILTER = re.compile(r"\[.*\]") + + +# Markers +def pytest_configure(config): + if config.getoption('--help'): + return + markers_to_add = [ + 'tier: mark a test case with a tier', + 'requirement: mark a test case with a requirement', + 'customer_scenario: mark a test case as a customer story', + ] + for marker in markers_to_add: + config.addinivalue_line('markers', marker) + + +# Filtering options +def pytest_addoption(parser): + group = parser.getgroup('cfme') + group.addoption('--tier', + type=int, + action='append', + help='only run tests of the given tier levels') + group.addoption('--requirement', + type=str, + action='append', + help='only run tests with given requirement markers') + group.addoption('--customer-scenario', + action='store_true', + default=False, + help='only run tests marked with customer_scenario') + + +def pytest_collection_modifyitems(session, config, items): + """Provide filtering of test case collection based on the CLI options""" + tiers = config.getoption('tier') + requirements = config.getoption('requirement') + customer = config.getoption('customer_scenario') + if not tiers and not requirements and not customer: + return + # TODO(rpfannsc) trim after pytest #1373 is done + keep, discard_tier, discard_requirement, discard_customer = [], [], [], [] + + for item in items: + # for each filter, check if its active and that the item has the marker + # Then check if the marker content matches the passed filter + # Discard items without the matching value + if (tiers and + not getattr(item.get_marker('tier'), 'args', [False])[0] in tiers): + discard_tier.append(item) + continue + if (requirements and + not getattr(item.get_marker('requirement'), 'args', [False])[0] in requirements): + discard_requirement.append(item) + continue + if customer and item.get_marker('customer_scenario') is None: + discard_customer.append(item) + continue + keep.append(item) + + items[:] = keep + # TODO(rpfannsc) add a reason after pytest #1372 is fixed + discarded = discard_tier + discard_requirement + discard_customer + config.hook.pytest_deselected(items=discarded) + if tiers: + store.uncollection_stats['tier mark'] = len(discard_tier) + if requirements: + store.uncollection_stats['requirement mark'] = len(discard_requirement) + if customer: + store.uncollection_stats['customer_scenario mark'] = len(discard_customer) diff --git a/cfme/test_framework/pytest_plugin.py b/cfme/test_framework/pytest_plugin.py index 8864d833d9..47b15af32f 100644 --- a/cfme/test_framework/pytest_plugin.py +++ b/cfme/test_framework/pytest_plugin.py @@ -70,7 +70,6 @@ def pytest_collection_finish(session): 'cfme.fixtures.maximized', 'cfme.fixtures.merkyl', 'cfme.fixtures.nelson', - 'cfme.fixtures.node_annotate', 'cfme.fixtures.page_screenshots', 'cfme.fixtures.perf', 'cfme.fixtures.provider', diff --git a/cfme/test_requirements.py b/cfme/test_requirements.py index 5116fbf46f..5c698f45d2 100644 --- a/cfme/test_requirements.py +++ b/cfme/test_requirements.py @@ -108,18 +108,6 @@ def test_quota_alert(): assignee_id='nachandr', ) -custom_button = pytest.mark.requirement( - "Custom Buttons", - description='Custom Buttons and Custom Groups', - assignee_id='ndhandre', -) - -customer_stories = pytest.mark.requirement( - "Customer Stories", - description='Integration of multiple FAs, Customer Day2 Scenarios', - assignee_id='ndhandre', -) - chargeback = pytest.mark.requirement( "Chargeback", description='Chargeback rates, calculations, and reports', @@ -150,6 +138,17 @@ def test_quota_alert(): assignee_id='juwatts', ) +custom_button = pytest.mark.requirement( + "Custom Buttons", + description='Custom Buttons and Custom Groups', + assignee_id='ndhandre', +) + +customer_stories = pytest.mark.requirement( + "Customer Stories", + description='Integration of multiple FAs, Day 2 Operations type tests', + assignee_id='ndhandre',) + dashboard = pytest.mark.requirement( "Dashboard", description='MIQ/CFME Dashboards creation, usability', diff --git a/cfme/tests/automate/custom_button/test_service_vm_custom_button.py b/cfme/tests/automate/custom_button/test_service_vm_custom_button.py index ce29826b66..2f612f0318 100644 --- a/cfme/tests/automate/custom_button/test_service_vm_custom_button.py +++ b/cfme/tests/automate/custom_button/test_service_vm_custom_button.py @@ -134,6 +134,7 @@ def test_custom_button_display_service_vm(request, appliance, service_vm, button assert custom_button_group.has_item(button.text) +@pytest.mark.customer_scenario @test_requirements.customer_stories @pytest.mark.tier(1) @pytest.mark.meta(automates=[1687061]) diff --git a/cfme/tests/v2v/test_csv_import.py b/cfme/tests/v2v/test_csv_import.py index 518892f552..d358a83db2 100644 --- a/cfme/tests/v2v/test_csv_import.py +++ b/cfme/tests/v2v/test_csv_import.py @@ -19,6 +19,7 @@ pytestmark = [ test_requirements.v2v, + pytest.mark.customer_scenario, pytest.mark.provider( classes=[RHEVMProvider, OpenStackProvider], selector=ONE_PER_VERSION, @@ -32,7 +33,7 @@ required_flags=["v2v"], scope="module", ), - pytest.mark.usefixtures("v2v_provider_setup") + pytest.mark.usefixtures("v2v_provider_setup"), ] @@ -137,7 +138,6 @@ def test_non_csv(appliance, infra_map): caseposneg: negative startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ error_text = "Invalid file extension. Only .csv files are accepted." @@ -152,7 +152,6 @@ def test_blank_csv(appliance, infra_map): caseposneg: negative startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ error_msg = "Error: Possibly a blank .CSV file" @@ -167,7 +166,6 @@ def test_column_headers(appliance, infra_map): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = fauxfactory.gen_alpha(10) @@ -183,7 +181,6 @@ def test_inconsistent_columns(appliance, infra_map): caseposneg: negative startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n{}, {}".format(fauxfactory.gen_alpha(10), fauxfactory.gen_alpha(10)) @@ -199,7 +196,6 @@ def test_csv_empty_vm(appliance, infra_map): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n\n" @@ -216,7 +212,6 @@ def test_csv_invalid_vm(appliance, infra_map): caseposneg: negative startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n{}".format(fauxfactory.gen_alpha(10)) @@ -233,7 +228,6 @@ def test_csv_valid_vm(appliance, infra_map, valid_vm): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n{}".format(valid_vm) @@ -250,7 +244,6 @@ def test_csv_duplicate_vm(appliance, infra_map, valid_vm): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n{}\n{}".format(valid_vm, valid_vm) @@ -267,7 +260,6 @@ def test_csv_archived_vm(appliance, infra_map, archived_vm): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/8h """ content = "Name\n{}".format(archived_vm) @@ -285,7 +277,6 @@ def test_csv_security_group_flavor(appliance, infra_map, valid_vm, provider): caseposneg: positive startsin: 5.10 casecomponent: V2V - customerscenario: true initialEstimate: 1/4h """ try: diff --git a/cfme/tests/webui/test_advanced_search.py b/cfme/tests/webui/test_advanced_search.py index 69e5f4c4fe..39b815abe1 100644 --- a/cfme/tests/webui/test_advanced_search.py +++ b/cfme/tests/webui/test_advanced_search.py @@ -18,7 +18,8 @@ from cfme.utils.appliance.implementations.ui import navigate_to from cfme.utils.blockers import BZ -Param = namedtuple("Param", ["collection", "destination", "entity", "filter", "my_filters"]) +SearchParam = namedtuple("SearchParam", + ["collection", "destination", "entity", "filter", "my_filters"]) pytestmark = [ pytest.mark.uncollectif( @@ -57,49 +58,23 @@ def _select_filter(filters, filter_name, param): filters.navigation.select(filter_name) -def _advanced_search_button_displayed(param, appliance): - """ - Polarion: - assignee: anikifor - casecomponent: WebUI - caseimportance: high - initialEstimate: 1/30h - """ - view = _navigation(param, appliance) - if not view.search.is_advanced_search_possible: - pytest.fail( - "Advanced search button is not displayed for {}_{}".format( - param.entity, param.destination.lower()) - ) - - def _can_open_advanced_search(param, appliance): - """ - Polarion: - assignee: anikifor - casecomponent: WebUI - caseimportance: high - initialEstimate: 1/30h - """ view = _navigation(param, appliance) + assert view.search.is_advanced_search_possible, (f"Advanced search not displayed " + f"for {param.entity} " + f"on {param.destination.lower()}") view.search.open_advanced_search() - if not view.search.is_advanced_search_opened: - pytest.fail("Advanced search cannot be opened for {}_{}".format( - param.destination, param.entity.lower()) - ) + assert view.search.is_advanced_search_opened, (f"Advanced search failed to open " + f"for {param.entity} " + f"on {param.destination.lower()}") + view.search.close_advanced_search() + assert not view.search.is_advanced_search_opened, (f"Advanced search failed to close " + f"for {param.entity} " + f"on {param.destination.lower()}") -# TODO make metadata to be collected only in this function -# @pytest.mark.meta(automates=[BZ(1402392)]) def _filter_crud(param, appliance): - """ - Polarion: - assignee: anikifor - casecomponent: WebUI - caseimportance: high - initialEstimate: 1/10h - """ filter_name = fauxfactory.gen_string('alphanumeric', 10) filter_value = fauxfactory.gen_string('alphanumeric', 10) filter_value_updated = fauxfactory.gen_string('alphanumeric', 10) @@ -165,9 +140,6 @@ def _filter_crud(param, appliance): assert not view.my_filters.navigation.has_item(filter_name), "Filter wasn't deleted!" -_tests = [_advanced_search_button_displayed, _can_open_advanced_search, _filter_crud] - - def methodized(metafunc): """Transform function to method by adding self argument @@ -183,9 +155,12 @@ def func(self, param, appliance): def inject_tests(metaclass): """Attach tests to decorated class - uses _tests - list of test functions""" - for test in _tests: - setattr(metaclass, f"test{test.__name__}", methodized(test)) + uses _tests - list of test functions + TODO: inject with __doc__ set and meta parsed by pytest-polarion-collect/polarion-docstrings + """ + for test in []: # test names, see TODO + method = methodized(test) + setattr(metaclass, f"test{test.__name__}", method) return metaclass @@ -200,150 +175,339 @@ def base_pytestmarks(param_values, setup_prov=False): )] + ([pytest.mark.usefixtures("setup_provider")] if setup_prov else []) -@inject_tests -@pytest.mark.provider([CloudProvider], selector=ONE_PER_CATEGORY, override=True) +@pytest.mark.provider([CloudProvider], selector=ONE_PER_CATEGORY) class TestCloud(object): params_values = [ - Param('cloud_providers', 'All', 'cloudprovider', 'Cloud Provider : Name', None), - Param('cloud_av_zones', 'All', 'availabilityzone', 'Availability Zone : Name', None), - Param('cloud_host_aggregates', 'All', 'hostaggregate', 'Host Aggregate : Name', None), - Param('cloud_tenants', 'All', 'tenant', 'Cloud Tenant : Name', None), - Param('cloud_flavors', 'All', 'flavor', 'Flavor : Name', None), - Param('cloud_instances', 'All', 'instances', 'Instance : Name', + SearchParam('cloud_providers', 'All', 'cloudprovider', 'Cloud Provider : Name', None), + SearchParam('cloud_av_zones', 'All', 'availabilityzone', 'Availability Zone : Name', None), + SearchParam('cloud_host_aggregates', 'All', 'hostaggregate', 'Host Aggregate : Name', None), + SearchParam('cloud_tenants', 'All', 'tenant', 'Cloud Tenant : Name', None), + SearchParam('cloud_flavors', 'All', 'flavor', 'Flavor : Name', None), + SearchParam('cloud_instances', 'All', 'instances', 'Instance : Name', ('sidebar.instances', "All Instances")), - Param('cloud_images', 'All', 'images', 'Image : Name', ('sidebar.images', "All Images")), - Param('cloud_stacks', 'All', 'orchestration_stacks', 'Orchestration Stack : Name', None), - Param('cloud_keypairs', 'All', 'key_pairs', 'Key Pair : Name', None)] + SearchParam('cloud_images', 'All', 'images', 'Image : Name', + ('sidebar.images', "All Images")), + SearchParam('cloud_stacks', 'All', 'orchestration_stacks', + 'Orchestration Stack : Name', None), + SearchParam('cloud_keypairs', 'All', 'key_pairs', 'Key Pair : Name', None) + ] pytestmark = base_pytestmarks(params_values, True) - -@inject_tests -@pytest.mark.provider([CloudProvider], selector=ONE_PER_CATEGORY, override=True) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + + +@pytest.mark.provider([CloudProvider], selector=ONE_PER_CATEGORY) class TestNetwork(object): params_values = [ - Param('network_providers', 'All', 'network_managers', 'Network Manager : Name', None), - Param('network_providers', 'All', 'network_managers', 'Network Manager : Name', None), - Param('cloud_networks', 'All', 'network_networks', 'Cloud Network : Name', None), - Param('network_subnets', 'All', 'network_subnets', 'Cloud Subnet : Name', None), - Param('network_routers', 'All', 'network_routers', 'Network Router : Name', None), - Param('network_security_groups', 'All', 'network_security_groups', + SearchParam('network_providers', 'All', 'network_managers', 'Network Manager : Name', None), + SearchParam('network_providers', 'All', 'network_managers', 'Network Manager : Name', None), + SearchParam('cloud_networks', 'All', 'network_networks', 'Cloud Network : Name', None), + SearchParam('network_subnets', 'All', 'network_subnets', 'Cloud Subnet : Name', None), + SearchParam('network_routers', 'All', 'network_routers', 'Network Router : Name', None), + SearchParam('network_security_groups', 'All', 'network_security_groups', 'Security Group : Name', None), - Param('network_floating_ips', 'All', 'network_floating_ips', + SearchParam('network_floating_ips', 'All', 'network_floating_ips', 'Floating IP : Address', None), - Param('network_ports', 'All', 'network_ports', 'Network Port : Name', None), - Param('balancers', 'All', 'network_load_balancers', 'Load Balancer : Name', None)] + SearchParam('network_ports', 'All', 'network_ports', 'Network Port : Name', None), + SearchParam('balancers', 'All', 'network_load_balancers', 'Load Balancer : Name', None)] pytestmark = base_pytestmarks(params_values, True) - -@inject_tests -@pytest.mark.provider([InfraProvider], selector=ONE_PER_CATEGORY, override=True) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + + +@pytest.mark.provider([InfraProvider], selector=ONE_PER_CATEGORY, ) class TestInfra(object): params_values = [ - Param('infra_providers', 'All', 'infraproviders', 'Infrastructure Provider : Name', None), - Param('clusters', 'All', 'clusters', 'Cluster / Deployment Role : Name', None), - Param('hosts', 'All', 'hosts', 'Host / Node : Name', None), - Param('hosts', 'All', 'hosts', 'Host / Node.VMs', None), - Param('infra_vms', 'VMsOnly', 'vms', 'Virtual Machine : Name', ('sidebar.vms', "All VMs")), - Param('infra_templates', 'TemplatesOnly', 'templates', 'Template : Name', - ('sidebar.templates', "All Templates")), - Param('resource_pools', 'All', 'resource_pools', 'Resource Pool : Name', None), - Param('datastores', 'All', 'datastores', 'Datastore : Name', - ('sidebar.datastores', "All Datastores")), - Param(VmsInstances, 'All', 'workloads_vms', 'VM and Instance : Name', - ('vms', "All VMs & Instances")), - Param(TemplatesImages, 'All', 'workloads_templates', 'VM Template and Image : Name', - ('templates', "All Templates & Images")), + SearchParam('infra_providers', 'All', 'infraproviders', + 'Infrastructure Provider : Name', None), + SearchParam('clusters', 'All', 'clusters', 'Cluster / Deployment Role : Name', None), + SearchParam('hosts', 'All', 'hosts', 'Host / Node : Name', None), + SearchParam('hosts', 'All', 'hosts', 'Host / Node.VMs', None), + SearchParam('infra_vms', 'VMsOnly', 'vms', 'Virtual Machine : Name', + ('sidebar.vms', "All VMs")), + SearchParam('infra_templates', 'TemplatesOnly', 'templates', 'Template : Name', + ('sidebar.templates', "All Templates")), + SearchParam('resource_pools', 'All', 'resource_pools', 'Resource Pool : Name', None), + SearchParam('datastores', 'All', 'datastores', 'Datastore : Name', + ('sidebar.datastores', "All Datastores")), + SearchParam(VmsInstances, 'All', 'workloads_vms', 'VM and Instance : Name', + ('vms', "All VMs & Instances")), + SearchParam(TemplatesImages, 'All', 'workloads_templates', 'VM Template and Image : Name', + ('templates', "All Templates & Images")), ] pytestmark = base_pytestmarks(params_values, True) - -@inject_tests -@pytest.mark.provider([PhysicalProvider], selector=ONE_PER_CATEGORY, override=True) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + + +@pytest.mark.provider([PhysicalProvider], selector=ONE_PER_CATEGORY) class TestPhysical(object): - params_values = [Param('physical_providers', 'All', 'physical_providers', - 'Physical Infrastructure Provider : Name', None), - Param('physical_servers', 'All', 'physical_servers', 'Physical Server : Name', None)] + params_values = [ + SearchParam('physical_providers', 'All', 'physical_providers', + 'Physical Infrastructure Provider : Name', None), + SearchParam('physical_servers', 'All', 'physical_servers', 'Physical Server : Name', None) + ] pytestmark = base_pytestmarks(params_values, True) - -@inject_tests -@pytest.mark.provider([ContainersProvider], selector=ONE_PER_CATEGORY, override=True) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + + +@pytest.mark.provider([ContainersProvider], selector=ONE_PER_CATEGORY) class TestContainers(object): - params_values = [Param('containers_providers', 'All', 'container_providers', - 'Containers Provider : Name', None), - Param('container_projects', 'All', 'container_projects', 'Container Project : Name', + params_values = [ + SearchParam( + 'containers_providers', 'All', 'container_providers', 'Containers Provider : Name', + None), + SearchParam('container_projects', 'All', 'container_projects', 'Container Project : Name', None), - Param('container_routes', 'All', 'container_routes', 'Container Route : Name', + SearchParam('container_routes', 'All', 'container_routes', 'Container Route : Name', None), - Param('container_services', 'All', 'container_services', + SearchParam('container_services', 'All', 'container_services', 'Container Service : Name', None), - Param('container_replicators', 'All', 'container_replicators', + SearchParam('container_replicators', 'All', 'container_replicators', 'Container Replicator : Name', None), - Param('container_pods', 'All', 'container_pods', 'Container Pod : Name', None), - Param('containers', 'All', 'containers', 'Container : Name', None), - Param('container_nodes', 'All', 'container_nodes', 'Container Node : Name', None), - Param('container_volumes', 'All', 'container_volumes', 'Persistent Volume : Name', + SearchParam('container_pods', 'All', 'container_pods', 'Container Pod : Name', None), + SearchParam('containers', 'All', 'containers', 'Container : Name', None), + SearchParam('container_nodes', 'All', 'container_nodes', 'Container Node : Name', None), + SearchParam('container_volumes', 'All', 'container_volumes', 'Persistent Volume : Name', None), - Param('container_builds', 'All', 'container_builds', 'Container Build : Name', + SearchParam('container_builds', 'All', 'container_builds', 'Container Build : Name', None), - Param('container_image_registries', 'All', 'image_registries', + SearchParam('container_image_registries', 'All', 'image_registries', 'Container Image Registry : Name', None), - Param('container_images', 'All', 'container_images', 'Container Image : Name', + SearchParam('container_images', 'All', 'container_images', 'Container Image : Name', None), - Param('container_templates', 'All', 'container_templates', - 'Container Template : Name', None)] + SearchParam('container_templates', 'All', 'container_templates', + 'Container Template : Name', None) + ] pytestmark = base_pytestmarks(params_values, True) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + -@inject_tests class TestAnsibleTower(object): - params_values = [Param('ansible_tower_providers', 'All', 'ansible_tower_explorer_provider', - 'Automation Manager (Ansible Tower) : Name', - ('sidebar.providers', 'All Ansible Tower Providers')), - Param('ansible_tower_systems', 'All', 'ansible_tower_explorer_system', - 'Configured System (Ansible Tower) : Hostname', - ('sidebar.configured_systems', 'All Ansible Tower Configured Systems')), - Param('ansible_tower_job_templates', 'All', 'ansible_tower_explorer_job_templates', - 'Job Template (Ansible Tower) : Name', - ('sidebar.job_templates', 'All Ansible Tower Job Templates')), - - Param('ansible_tower_jobs', 'All', 'ansible_tower_jobs', 'Ansible Tower Job : Name', - None)] + params_values = [ + SearchParam('ansible_tower_providers', 'All', 'ansible_tower_explorer_provider', + 'Automation Manager (Ansible Tower) : Name', + ('sidebar.providers', 'All Ansible Tower Providers')), + SearchParam('ansible_tower_systems', 'All', 'ansible_tower_explorer_system', + 'Configured System (Ansible Tower) : Hostname', + ('sidebar.configured_systems', 'All Ansible Tower Configured Systems')), + SearchParam('ansible_tower_job_templates', 'All', 'ansible_tower_explorer_job_templates', + 'Job Template (Ansible Tower) : Name', + ('sidebar.job_templates', 'All Ansible Tower Job Templates')), + SearchParam('ansible_tower_jobs', 'All', 'ansible_tower_jobs', + 'Ansible Tower Job : Name', None)] pytestmark = base_pytestmarks(params_values) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + -@inject_tests class TestStorage(object): params_values = [ - Param('volumes', 'All', 'block_store_volumes', 'Cloud Volume : Name', None), - Param('volume_snapshots', 'All', 'block_store_snapshots', - 'Cloud Volume Snapshot : Name', None), - Param('volume_backups', 'All', 'block_store_backups', 'Cloud Volume Backup : Name', - None), - - Param('object_store_containers', 'All', 'object_store_containers', - 'Cloud Object Store Container : Name', None), - Param('object_store_objects', 'All', 'object_store_objects', - 'Cloud Object Store Object : Name', None), + SearchParam('volumes', 'All', 'block_store_volumes', 'Cloud Volume : Name', None), + SearchParam('volume_snapshots', 'All', 'block_store_snapshots', + 'Cloud Volume Snapshot : Name', None), + SearchParam('volume_backups', 'All', 'block_store_backups', + 'Cloud Volume Backup : Name', None), + SearchParam('object_store_containers', 'All', 'object_store_containers', + 'Cloud Object Store Container : Name', None), + SearchParam('object_store_objects', 'All', 'object_store_objects', + 'Cloud Object Store Object : Name', None), ] pytestmark = base_pytestmarks(params_values) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + -@inject_tests class TestConfigManagement(object): params_values = [ - Param(ConfigManager, 'All', 'configuration_management', - 'Configuration Manager : Name', - ('sidebar.providers', "All Configuration Management Providers")), - Param(ConfigSystem, 'All', 'configuration_management_systems', - 'Configured System (Red Hat Satellite) : Hostname', - ('sidebar.configured_systems', "All Configured Systems")), + SearchParam(ConfigManager, 'All', 'configuration_management', + 'Configuration Manager : Name', + ('sidebar.providers', "All Configuration Management Providers")), + SearchParam(ConfigSystem, 'All', 'configuration_management_systems', + 'Configured System (Red Hat Satellite) : Hostname', + ('sidebar.configured_systems', "All Configured Systems")), ] pytestmark = base_pytestmarks(params_values) + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) + @pytest.mark.meta(blockers=[BZ(1733489)]) -@inject_tests class TestServices(object): - params_values = [Param(MyService, 'All', 'myservices', 'Service : Name', 'myservice')] + params_values = [SearchParam(MyService, 'All', 'myservices', 'Service : Name', 'myservice')] pytestmark = base_pytestmarks(params_values) + + def test_can_open_advanced_search(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _can_open_advanced_search(param, appliance) + + @pytest.mark.meta(automates=[BZ(1402392)]) # TODO apply marker when using inject_tests + def test_filter_crud(self, param, appliance): + """ + Polarion: + assignee: anikifor + casecomponent: WebUI + caseimportance: high + initialEstimate: 1/10h + """ + _filter_crud(param, appliance) diff --git a/cfme/utils/smem_memory_monitor.py b/cfme/utils/smem_memory_monitor.py index 4ca04f96f7..379b44b973 100644 --- a/cfme/utils/smem_memory_monitor.py +++ b/cfme/utils/smem_memory_monitor.py @@ -246,7 +246,7 @@ def get_miq_server_id(self): def get_pids_memory(self): result = self.ssh_client.run_command( - 'smem -c \'pid rss pss uss vss swap name command\' | sed 1d') + "/usr/bin/python2.7 /usr/bin/smem -c 'pid rss pss uss vss swap name command' | sed 1d") pids_memory = result.output.strip().split('\n') memory_by_pid = {} for line in pids_memory: diff --git a/conf/polarion_tools.yaml b/conf/polarion_tools.yaml index d61fc9158f..f7d6ddad8a 100644 --- a/conf/polarion_tools.yaml +++ b/conf/polarion_tools.yaml @@ -7,7 +7,7 @@ default_fields: caseimportance: high caselevel: component caseposneg: positive - customerscenario: "" + customerscenario: false description: "" endsin: "" expectedResults: "" @@ -63,6 +63,7 @@ docstrings: marker_fields: caselevel: "@pytest.mark.tier" caseautomation: "@pytest.mark.manual" + customerscenario: "@pytest.mark.customer_scenario" # default for manual mark is 'notautomated' # @pytest.mark.manual('manualonly') to set 'manualonly' linkedWorkItems: "@pytest.mark.requirements" diff --git a/requirements/frozen.py3.txt b/requirements/frozen.py3.txt index 5a63f5b310..cfac6feb2d 100644 --- a/requirements/frozen.py3.txt +++ b/requirements/frozen.py3.txt @@ -130,7 +130,7 @@ docker-py==1.10.6 docker-pycreds==0.4.0 docutils==0.15.2 dogpile.cache==0.7.1 -dump2polarion==0.39.1 +dump2polarion==0.40.0 entrypoints==0.3 fauxfactory==3.0.6 flake8==3.7.7 @@ -217,7 +217,7 @@ pickleshare==0.7.5 pika==1.0.1 Pillow==6.0.0 pluggy==0.6.0 -polarion-docstrings==0.16.1 +polarion-docstrings==0.17.0 pre-commit==1.17.0 prettytable==0.7.2 progress==1.5 @@ -243,7 +243,7 @@ pyparsing==2.4.0 pyperclip==1.7.0 pytesseract==0.2.6 pytest==3.4.1 -pytest-polarion-collect==0.15 +pytest-polarion-collect==0.16.2 python-box==3.2.4 python-bugzilla==2.3.0 python-cinderclient==4.1.0 diff --git a/requirements/frozen_docs.py3.txt b/requirements/frozen_docs.py3.txt index 9b012a8de0..37929c939d 100644 --- a/requirements/frozen_docs.py3.txt +++ b/requirements/frozen_docs.py3.txt @@ -129,7 +129,7 @@ docker-py==1.10.6 docker-pycreds==0.4.0 docutils==0.15.2 dogpile.cache==0.7.1 -dump2polarion==0.39.1 +dump2polarion==0.40.0 entrypoints==0.3 fauxfactory==3.0.6 flake8==3.7.7 @@ -215,7 +215,7 @@ pickleshare==0.7.5 pika==1.0.1 Pillow==6.0.0 pluggy==0.6.0 -polarion-docstrings==0.16.1 +polarion-docstrings==0.17.0 prettytable==0.7.2 progress==1.5 prometheus-client==0.6.0 @@ -239,7 +239,7 @@ pyparsing==2.4.0 pyperclip==1.7.0 pytesseract==0.2.6 pytest==3.4.1 -pytest-polarion-collect==0.15 +pytest-polarion-collect==0.16.2 python-box==3.2.4 python-bugzilla==2.2.0 python-cinderclient==4.1.0