Merge "[VVP] Fix issue floating IP params for R-35666"
authorsteven stark <steven.stark@att.com>
Tue, 12 Nov 2019 21:52:48 +0000 (21:52 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 12 Nov 2019 21:52:48 +0000 (21:52 +0000)
ice_validator/tests/helpers.py
ice_validator/tests/test_non_server_name.py
ice_validator/tests/test_vm_type_case.py

index 424dde1..f4a368c 100644 (file)
@@ -53,6 +53,23 @@ __path__ = [os.path.dirname(os.path.abspath(__file__))]
 DEFAULT_OUTPUT_DIR = "{}/../output".format(__path__[0])
 RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)")
 
+INTRINSIC_FUNCTIONS = [
+    "get_resource",
+    "get_attr",
+    "str_replace",
+    "get_param",
+    "list_join",
+    "get_file",
+    "resource_facade",
+    "Fn::Select",
+    "repeat",
+    "digest",
+    "str_split",
+    "yaql",
+    "map_replace",
+    "map_merge",
+]
+
 
 def is_base_module(template_path):
     basename = os.path.basename(template_path).lower()
@@ -321,12 +338,13 @@ def parameter_type_to_heat_type(parameter):
 
 
 def prop_iterator(resource, *props):
-    terminators = ["get_resource", "get_attr", "str_replace", "get_param"]
     if "properties" in resource:
         resource = resource.get("properties")
     props = list(props)
 
-    if isinstance(resource, dict) and any(x for x in terminators if x in resource):
+    if isinstance(resource, dict) and any(
+        x for x in INTRINSIC_FUNCTIONS if x in resource
+    ):
         yield resource
     else:
         prop = resource.get(props.pop(0))
@@ -426,5 +444,9 @@ def is_nova_server(resource):
     """
     checks resource is a nova server
     """
-    return isinstance(resource, dict) and "type" in resource and "properties" in resource and resource.get("type") == "OS::Nova::Server"
-
+    return (
+        isinstance(resource, dict)
+        and "type" in resource
+        and "properties" in resource
+        and resource.get("type") == "OS::Nova::Server"
+    )
index 9361389..7a5c11f 100644 (file)
@@ -42,7 +42,6 @@ resource property name
 """
 import os
 import collections
-import pytest
 
 from .structures import Heat
 from .structures import HeatProcessor
@@ -74,12 +73,7 @@ def test_non_server_name(yaml_file):
 
     """
     h = Heat(filepath=yaml_file)
-    if not h.resources:
-        pytest.skip("No resources in this template")
-
     non_servers = get_non_servers(h)
-    if not non_servers:
-        pytest.skip("No non-server resources in this template")
 
     bad = []
     for rid, resource in non_servers.items():
index 3ecd8de..db4646c 100644 (file)
@@ -65,8 +65,6 @@ resources:
 import collections
 import re
 
-import pytest
-
 from .structures import Heat
 from .helpers import validates
 
@@ -101,8 +99,6 @@ def test_vm_type_case(yaml_file):
     """
     heat = Heat(filepath=yaml_file)
     resources = heat.resources
-    if not resources:
-        pytest.skip("No resources found")
     bad = collections.defaultdict(list)
     for rid, resource in resources.items():
         vm_type = heat.get_vm_type(rid, resource=resource)