X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Ftests%2Ftest_availability_zone.py;h=7feefc95db419485649570c4418490f3d27c3613;hb=3471cfeb1a864f20ca0f8c7e33c14a4bd87d1258;hp=4f250b88b689153a2d0f0e94ec41db04212d1965;hpb=f5edc06be0d8bedeb0904b348ba5e3e67c74f186;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/tests/test_availability_zone.py b/ice_validator/tests/test_availability_zone.py index 4f250b8..7feefc9 100644 --- a/ice_validator/tests/test_availability_zone.py +++ b/ice_validator/tests/test_availability_zone.py @@ -35,7 +35,6 @@ # # ============LICENSE_END============================================ # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. # """test """ @@ -43,7 +42,7 @@ import re import pytest -import yaml +from tests import cached_yaml as yaml from .helpers import validates @@ -51,12 +50,12 @@ VERSION = "1.1.0" @validates("R-98450") -def test_availability_zone_naming(heat_template): +def test_availability_zone_naming(yaml_file): """ Make sure all availability zones are properly formatted """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined @@ -65,7 +64,7 @@ def test_availability_zone_naming(heat_template): invalid_availability_zones = set() - for v1 in yml["resources"].values(): + for k1, v1 in yml["resources"].items(): if not isinstance(v1, dict): continue if "properties" not in v1: @@ -79,6 +78,11 @@ def test_availability_zone_naming(heat_template): continue if "str_replace" in v2: continue + if "get_param" not in v2: + invalid_availability_zones.add(k1) + continue + if not isinstance(v2["get_param"], str): + continue if not re.match(r"availability_zone_\d+", v2["get_param"]): invalid_availability_zones.add(v2["get_param"])