aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ice_validator/tests/test_availability_zone.py31
-rw-r--r--ice_validator/tests/test_network_format.py23
-rw-r--r--ice_validator/tests/test_nova_servers_vm_types_use_get_param.py10
-rw-r--r--ice_validator/tests/utils/vm_types.py8
-rw-r--r--ice_validator/version.py2
-rw-r--r--pom.xml2
-rw-r--r--releases/5.0.0-container.yaml8
7 files changed, 35 insertions, 49 deletions
diff --git a/ice_validator/tests/test_availability_zone.py b/ice_validator/tests/test_availability_zone.py
index aee6890..0cbb0d2 100644
--- a/ice_validator/tests/test_availability_zone.py
+++ b/ice_validator/tests/test_availability_zone.py
@@ -45,7 +45,7 @@ import pytest
from tests import cached_yaml as yaml
from tests.utils import nested_files
-from .helpers import validates
+from .helpers import validates, is_nova_server
VERSION = "1.1.0"
@@ -69,26 +69,19 @@ def test_availability_zone_naming(yaml_file):
invalid_availability_zones = set()
for k1, v1 in yml["resources"].items():
- if not isinstance(v1, dict):
- continue
- if "properties" not in v1:
- continue
- if "type" not in v1:
+ if not is_nova_server(v1):
continue
- if v1["type"] == "OS::Nova::Server":
- for k2, v2 in v1["properties"].items():
- if k2 != "availability_zone":
- 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"])
+ for k2, v2 in v1["properties"].items():
+ if k2 != "availability_zone" or "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"])
assert not invalid_availability_zones, "invalid availability zones %s" % list(
invalid_availability_zones
diff --git a/ice_validator/tests/test_network_format.py b/ice_validator/tests/test_network_format.py
index f146f75..e360795 100644
--- a/ice_validator/tests/test_network_format.py
+++ b/ice_validator/tests/test_network_format.py
@@ -70,9 +70,7 @@ def test_network_resource_id_format(yaml_file):
invalid_networks = []
for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if "properties" not in v:
+ if not has_properties(v):
continue
if property_uses_get_resource(v, "network"):
continue
@@ -106,23 +104,15 @@ def test_network_has_subnet(yaml_file):
networks = []
for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if "properties" not in v:
+ if not has_properties(v) or v.get("type") not in ["OS::Neutron::Net"]:
continue
# need to check if contrail networks also require subnet
# and it is defined the same as neutron networks
# if v.get("type") not in NETWORK_RESOURCE_TYPES:
- if v.get("type") not in ["OS::Neutron::Net"]:
- continue
networks.append(k)
for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if "properties" not in v:
- continue
- if v.get("type") != "OS::Neutron::Subnet":
+ if not has_properties(v) and v.get("type") != "OS::Neutron::Subnet":
continue
network_prop = v.get("properties", {}).get("network", {}).get("get_resource")
@@ -136,3 +126,10 @@ def test_network_has_subnet(yaml_file):
x += 1
assert not networks, "Networks detected without subnet {}".format(networks)
+
+
+def has_properties(resource):
+ """
+ checks resource is a Neutron Subnet
+ """
+ return isinstance(resource, dict) and "properties" in resource
diff --git a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
index 63698f1..ce653f6 100644
--- a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
+++ b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
@@ -40,7 +40,7 @@
import pytest
from tests import cached_yaml as yaml
-from .helpers import validates
+from .helpers import validates, is_nova_server
@validates("R-901331", "R-481670", "R-663631")
@@ -59,13 +59,7 @@ def test_vm_type_assignments_on_nova_servers_only_use_get_param(yaml_file):
invalid_nova_servers = set()
for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if "properties" not in v:
- continue
- if "type" not in v:
- continue
- if v["type"] != "OS::Nova::Server":
+ if not is_nova_server(v):
continue
for k2, v2 in v["properties"].items():
diff --git a/ice_validator/tests/utils/vm_types.py b/ice_validator/tests/utils/vm_types.py
index ae6d7ff..7570581 100644
--- a/ice_validator/tests/utils/vm_types.py
+++ b/ice_validator/tests/utils/vm_types.py
@@ -50,8 +50,6 @@ def get_vm_types_for_resource(resource):
- If more than one vm_type is detected all vm_types will
be returned
"""
- if not isinstance(resource, dict):
- return set()
if not is_nova_server(resource):
return set()
@@ -83,11 +81,7 @@ def get_vm_types_for_resource(resource):
def is_nova_server(resource):
- return (
- "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"
def get_vm_type_for_nova_server(resource):
diff --git a/ice_validator/version.py b/ice_validator/version.py
index f628f8e..1ef4a2c 100644
--- a/ice_validator/version.py
+++ b/ice_validator/version.py
@@ -37,6 +37,6 @@
#
#
-VERSION = "5.0.0"
+VERSION = "5.0.1"
BRANCH = "master"
RELEASE = "elalto"
diff --git a/pom.xml b/pom.xml
index 8c1fab1..3f867ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
<groupId>org.onap.vvp.validation-scripts</groupId>
<artifactId>validation-scripts</artifactId>
<packaging>pom</packaging>
- <version>5.0.0</version>
+ <version>5.0.1</version>
<name>vvp-validation-scripts</name>
<properties>
diff --git a/releases/5.0.0-container.yaml b/releases/5.0.0-container.yaml
new file mode 100644
index 0000000..b6ee846
--- /dev/null
+++ b/releases/5.0.0-container.yaml
@@ -0,0 +1,8 @@
+distribution_type: 'container'
+container_release_tag: '5.0.1'
+project: 'vvp'
+log_dir: 'vvp-validation-scripts-master-docker-java-daily/259/'
+ref: f5190cf61981eff1eb59157d4d2f8bd06acb3570
+containers:
+ - name: 'vvp/validation-scripts'
+ version: '5.0.0-20190925T142421Z'