diff options
author | Lovett, Trevor (tl2972) <tl2972@att.com> | 2018-08-22 11:13:45 -0500 |
---|---|---|
committer | Lovett, Trevor (tl2972) <tl2972@att.com> | 2018-08-22 12:52:32 -0500 |
commit | f5edc06be0d8bedeb0904b348ba5e3e67c74f186 (patch) | |
tree | 5fba01ca97aebe14f4b7004551bc58c17a858169 /ice_validator/tests/test_nova_servers_index.py | |
parent | 1af0d577ab6d8c431ae1322657c50efd5e0a1a93 (diff) |
[VVP] Added new three new reports
Resolves VVP-81 by introducing three new reports to the validation
script output.
Each report is written to the output directory under ice_validator.
* mapping_errors.csv - each row represents an issue where a test is
mapped to a requirement that does not exist
in the requirement.json file
* traceability.csv - Shows a mapping between all test cases and
requirements. Rows will also be shown
where a requirement does not have a tests, and
where tests are not mapped to a requirement
* report.{html|csv|xlsx} - Formatted error report that shows each
failure that was detected and maps it to
a the file name, requirement(s) violated if
known, possible resolution steps, error
message, and raw output from pytest. The
report can be written in html, csv, or Excel
format
Other minor changes:
* Replaced smart quotes with regular quotes to resolve issues with py3
* Updated copyright of modified files
* Fixed Flake-8 errors
Issue-ID: VVP-81
Change-Id: I659836cb20262ae44652c03639281a817dd051ae
Signed-off-by: Lovett, Trevor (tl2972) <tl2972@att.com>
Diffstat (limited to 'ice_validator/tests/test_nova_servers_index.py')
-rw-r--r-- | ice_validator/tests/test_nova_servers_index.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/ice_validator/tests/test_nova_servers_index.py b/ice_validator/tests/test_nova_servers_index.py index 3ca99a0..85ce335 100644 --- a/ice_validator/tests/test_nova_servers_index.py +++ b/ice_validator/tests/test_nova_servers_index.py @@ -38,11 +38,11 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. # -''' +""" Ensure that if a resource_id has an {index}, then all resources of the same vm-type have an index, the indices are consecutive and start with 0. -''' +""" import collections import re @@ -53,15 +53,15 @@ from .structures import Heat from .helpers import validates from .utils import vm_types -VERSION = '1.1.0' +VERSION = "1.1.0" -RE_INDEXED_RESOURCE_ID = re.compile(r'\w+_(?P<index>\d+)$') +RE_INDEXED_RESOURCE_ID = re.compile(r"\w+_(?P<index>\d+)$") -@validates('R-11690') +@validates("R-11690") def test_indices(heat_templates): - '''validate indices - ''' + """validate indices + """ indexed_resource_ids = {} resources = {} for heat_template in heat_templates: @@ -70,14 +70,14 @@ def test_indices(heat_templates): indexed_resource_ids.update(get_indexed_resource_ids(h.resources)) resources.update(h.resources) if not resources: - pytest.skip('No resources found') + pytest.skip("No resources found") if not indexed_resource_ids: - pytest.skip('No resources with {index} found') + pytest.skip("No resources with {index} found") types = get_types(resources, indexed_resource_ids) if not types: - pytest.skip('No resources with {vm-type} found') + pytest.skip("No resources with {vm-type} found") indices = collections.defaultdict(list) for resource_id, vm_type in types.items(): @@ -89,10 +89,18 @@ def test_indices(heat_templates): bad[vm_type] = index_list break assert not bad, ( - 'vm-type indices must be consecutive, unique,' - ' and start at 0.\n %s' % ( - '\n '.join(['Resource ID %s: VM Type: %s' % (x, y) - for x, y in types.items() if y in bad]))) + "vm-type indices must be consecutive, unique," + " and start at 0.\n %s" + % ( + "\n ".join( + [ + "Resource ID %s: VM Type: %s" % (x, y) + for x, y in types.items() + if y in bad + ] + ) + ) + ) def get_indexed_resource_ids(resources): @@ -103,7 +111,7 @@ def get_indexed_resource_ids(resources): for resource in resources: match = RE_INDEXED_RESOURCE_ID.match(resource) if match: - indexed_resource_ids[resource] = int(match.groupdict()['index']) + indexed_resource_ids[resource] = int(match.groupdict()["index"]) return indexed_resource_ids |