X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Ftests%2Ftest_heat_pairs_provided.py;h=149a5474f4f0a2c526d11ef49cd6fd3d3c5e9317;hb=0c4e64d87728b89aa9cd4d41d738f5bfe64ceee3;hp=b9c82909524e5db19cb587c874b09f20857a1180;hpb=f5edc06be0d8bedeb0904b348ba5e3e67c74f186;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/tests/test_heat_pairs_provided.py b/ice_validator/tests/test_heat_pairs_provided.py index b9c8290..149a547 100644 --- a/ice_validator/tests/test_heat_pairs_provided.py +++ b/ice_validator/tests/test_heat_pairs_provided.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 @@ -35,30 +35,61 @@ # # ============LICENSE_END============================================ # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. # -from .helpers import validates + from os import path +from .helpers import validates + -@validates('R-86285', 'R-38474', 'R-81725', 'R-53433', 'R-56438', - 'R-74304', 'R-91342', 'R-94509', 'R-31141') +@validates( + "R-86285", + "R-38474", + "R-81725", + "R-53433", + "R-56438", + "R-74304", + "R-91342", + "R-94509", + "R-31141", +) def test_heat_pairs_provided(heat_templates, env_files, volume_templates): - ''' + """ Check that every yaml file is submitted with an associated env file, and every env has an associated yaml file. - ''' + """ + env_files_missing_template = [] for filename in env_files: basename = path.splitext(filename)[0] - assert basename + '.yaml' in heat_templates or \ - basename + '.yml' in heat_templates or \ - basename + '.yml' in volume_templates or \ - basename + '.yaml' in volume_templates + if not ( + basename + ".yaml" in heat_templates + or basename + ".yml" in heat_templates + or basename + ".yml" in volume_templates + or basename + ".yaml" in volume_templates + ): + env_files_missing_template.append(filename) + + heat_template_missing_env = [] for filename in heat_templates: basename = path.splitext(filename)[0] - assert basename + '.env' in env_files + if not basename + ".env" in env_files: + heat_template_missing_env.append(filename) + for filename in volume_templates: basename = path.splitext(filename)[0] - assert basename + '.env' in env_files + if not basename + ".env" in env_files: + heat_template_missing_env.append(filename) + + msg = ( + "Mismatched template and environment file pairs detected. " + + "Environment files with no matching template: {} ".format( + env_files_missing_template + ) + + "Heat templates with no matching environment file: {}".format( + heat_template_missing_env + ) + ) + + assert not (env_files_missing_template or heat_template_missing_env), msg