From 1f4df7c7ad27b23773ad9cdbe4db1632ce388cf1 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Mon, 17 Dec 2018 12:43:02 -0800 Subject: [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 --- ice_validator/tests/test_heat_pairs_provided.py | 50 ++++++++++++++++++++----- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'ice_validator/tests/test_heat_pairs_provided.py') diff --git a/ice_validator/tests/test_heat_pairs_provided.py b/ice_validator/tests/test_heat_pairs_provided.py index 76aa276..fd6c95b 100644 --- a/ice_validator/tests/test_heat_pairs_provided.py +++ b/ice_validator/tests/test_heat_pairs_provided.py @@ -43,24 +43,54 @@ 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 -- cgit 1.2.3-korg