diff options
author | stark, steven <steven.stark@att.com> | 2018-12-17 12:43:02 -0800 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2018-12-17 13:04:00 -0800 |
commit | 1f4df7c7ad27b23773ad9cdbe4db1632ce388cf1 (patch) | |
tree | 8092104f8be23051ff81c9f71ee34116df4d33ba /ice_validator/tests/test_volume_templates_outputs.py | |
parent | ca9085f0f77d442d3741a8c754e65cc45b6a318d (diff) |
[VVP] updating validation scripts in dublin
- adding backlog of new validation scripts for dublin
- updating existing tests
- removing outdated tests
Issue-ID: VVP-123
Change-Id: Ib8260889ac957c1dd28d8ede450fc8edc6fb0ec0
Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'ice_validator/tests/test_volume_templates_outputs.py')
-rw-r--r-- | ice_validator/tests/test_volume_templates_outputs.py | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/ice_validator/tests/test_volume_templates_outputs.py b/ice_validator/tests/test_volume_templates_outputs.py index 1a779c6..19fd1e9 100644 --- a/ice_validator/tests/test_volume_templates_outputs.py +++ b/ice_validator/tests/test_volume_templates_outputs.py @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # org.onap.vvp/validation-scripts # =================================================================== -# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. # =================================================================== # # Unless otherwise specified, all software contained herein is licensed @@ -37,14 +37,51 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # +import pytest from tests import cached_yaml as yaml +from .helpers import validates +@validates("R-89913") def test_volume_templates_contains_outputs(volume_template): - ''' + """ Check that all volume templates include outputs - ''' + """ with open(volume_template) as fh: yml = yaml.load(fh) - assert "outputs" in yml + + resources = yml.get("resources") + volume_resources = [] + invalid_resource_ids = [] + output_resources = [] + + if not resources: + pytest.skip("No resources detected in template") + + for rid, rprop in resources.items(): + rtype = rprop.get("type") + if not rtype: + continue + if rtype == "OS::Cinder::Volume": + volume_resources.append(rid) + + outputs = yml.get("outputs") + if not outputs: + pytest.fail("No outputs detected in volume template") + + for k1, v1 in outputs.items(): + output_value = v1.get("value", {}).get("get_resource") + if not output_value: + continue + output_resources.append(output_value) + + for rid in volume_resources: + if rid not in output_resources: + invalid_resource_ids.append(rid) + + assert ( + not invalid_resource_ids + ), "volumes resource IDs not found in outputs of volume module {}".format( + invalid_resource_ids + ) |