From 079622e0b69ec1e5c50af08c8312937609929233 Mon Sep 17 00:00:00 2001 From: "Lovett, Trevor" Date: Tue, 3 Dec 2019 15:18:03 -0600 Subject: [VVP] Support pluggable data sources for preload data Change-Id: Ia7fcfa25203a93eac93381f472e3ba1e6c11235f Issue-ID: VVP-339 Signed-off-by: Lovett, Trevor --- ice_validator/tests/conftest.py | 32 ++++++++++++++-------- .../tests/test_vm_class_has_unique_type.py | 10 +++---- ice_validator/tests/test_volume_module_naming.py | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'ice_validator/tests') diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py index 9a839b5..e0aa864 100644 --- a/ice_validator/tests/conftest.py +++ b/ice_validator/tests/conftest.py @@ -44,8 +44,7 @@ import os import re import time -from preload.model import create_preloads -from config import get_generator_plugin_names +from preload.engine import PLUGIN_MGR, create_preloads from tests.helpers import get_output_dir try: @@ -829,13 +828,6 @@ def pytest_addoption(parser): help="optional category of test to execute", ) - parser.addoption( - "--env-directory", - dest="env_dir", - action="store", - help="optional directory of .env files for preload generation", - ) - parser.addoption( "--preload-format", dest="preload_formats", @@ -843,7 +835,24 @@ def pytest_addoption(parser): help=( "Preload format to create (multiple allowed). If not provided " "then all available formats will be created: {}" - ).format(", ".join(get_generator_plugin_names())), + ).format(", ".join(g.format_name() for g in PLUGIN_MGR.preload_generators)), + ) + + parser.addoption( + "--preload-source-type", + dest="preload_source_type", + action="store", + default="envfiles", + help=( + "Preload source type to create (multiple allowed): {}" + ).format(", ".join(s.get_identifier() for s in PLUGIN_MGR.preload_sources)), + ) + + parser.addoption( + "--preload-source", + dest="preload_source", + action="store", + help="File or directory containing the source dat for the preloads", ) @@ -859,7 +868,8 @@ def pytest_configure(config): or config.getoption("self_test") or config.getoption("help") ): - raise Exception('One of "--template-dir" or' ' "--self-test" must be specified') + raise Exception('One of "--template-directory" or' + ' "--self-test" must be specified') def pytest_generate_tests(metafunc): diff --git a/ice_validator/tests/test_vm_class_has_unique_type.py b/ice_validator/tests/test_vm_class_has_unique_type.py index b158f5b..7020a14 100644 --- a/ice_validator/tests/test_vm_class_has_unique_type.py +++ b/ice_validator/tests/test_vm_class_has_unique_type.py @@ -134,18 +134,18 @@ def key_diff(d1, d2, prefix=""): @validates("R-01455") def test_vm_class_has_unique_type(yaml_files): """ - When a VNF’s Heat Orchestration Template creates a Virtual - Machine (i.e., OS::Nova::Server), each “class” of VMs MUST be - assigned a VNF unique vm-type; where “class” defines VMs that + When a VNF's Heat Orchestration Template creates a Virtual + Machine (i.e., OS::Nova::Server), each "class" of VMs MUST be + assigned a VNF unique vm-type; where "class" defines VMs that MUST have the following identical characteristics: 1. OS::Nova::Server resource property flavor value 2. OS::Nova::Server resource property image value 3. Cinder Volume attachments - Each VM in the “class” MUST have the identical Cinder + Each VM in the "class" MUST have the identical Cinder Volume configuration 4. Network attachments and IP address requirements - Each VM in the “class” MUST have the the identical number of + Each VM in the "class" MUST have the the identical number of ports connecting to the identical networks and requiring the identical IP address configuration """ diff --git a/ice_validator/tests/test_volume_module_naming.py b/ice_validator/tests/test_volume_module_naming.py index fdd4894..459c132 100644 --- a/ice_validator/tests/test_volume_module_naming.py +++ b/ice_validator/tests/test_volume_module_naming.py @@ -75,6 +75,6 @@ def test_detected_volume_module_follows_naming_convention(template_dir): errors.append(yaml_file) msg = ( "Volume modules detected, but they do not follow the expected " - + " naming convention {{module_name}}_volume.[yaml|yml]: {}" + + " naming convention {{module_label}}_volume.[yaml|yml]: {}" ).format(", ".join(errors)) assert not errors, msg -- cgit 1.2.3-korg