diff options
author | Lovett, Trevor <trevor.lovett@att.com> | 2019-10-08 13:32:34 -0500 |
---|---|---|
committer | Lovett, Trevor (tl2972) <tl2972@att.com> | 2019-10-08 13:37:18 -0500 |
commit | 842888dc28ebccab45e627669f7ee23f04920dc7 (patch) | |
tree | f3cbc0bdc74dddd63ca9ce6f2bd8d6503f62def9 /ice_validator/tests/test_initial_configuration.py | |
parent | d78c645df31a19567667d3e6d3acdf0474f39bf1 (diff) |
[VVP] Flag duplicate parameters in .env files
Also some minor tweaks to preload generation so it doesn't fail on
partial heat templates
Change-Id: If39288dde645b0b53a338e7672336807ffa1b6d7
Issue-ID: VVP-284
Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Diffstat (limited to 'ice_validator/tests/test_initial_configuration.py')
-rw-r--r-- | ice_validator/tests/test_initial_configuration.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/ice_validator/tests/test_initial_configuration.py b/ice_validator/tests/test_initial_configuration.py index 654d75d..e4d8b01 100644 --- a/ice_validator/tests/test_initial_configuration.py +++ b/ice_validator/tests/test_initial_configuration.py @@ -65,24 +65,26 @@ def test_00_valid_yaml(filename): ).format(str(e).replace("\n", " ")) +def check_duplicate_keys(yaml_path): + import yaml as normal_yaml + + try: + with open(yaml_path) as fh: + normal_yaml.load(fh, yaml_custom_utils.UniqueKeyLoader) # nosec + except ConstructorError as e: + pytest.fail("{} {}".format(e.problem, e.problem_mark)) + + @pytest.mark.base @validates("R-92635") def test_02_no_duplicate_keys_in_file(yaml_file): - """ - Checks that no duplicate keys exist in a given YAML file. - """ - import yaml as normal_yaml # we can't use the caching version in this test + check_duplicate_keys(yaml_file) - normal_yaml.add_constructor( - yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, - yaml_custom_utils.raise_duplicates_keys, - ) - try: - with open(yaml_file) as fh: - normal_yaml.safe_load(fh) - except ConstructorError as e: - pytest.fail("{} {}".format(e.problem, e.problem_mark)) +@pytest.mark.base +@validates("R-92635") +def test_02a_no_duplicate_keys_in_env(env_file): + check_duplicate_keys(env_file) @pytest.mark.base |