diff options
-rw-r--r-- | ice_validator/tests/test_network_format.py | 23 | ||||
-rw-r--r-- | ice_validator/tests/test_nova_servers_vm_types_use_get_param.py | 10 | ||||
-rw-r--r-- | ice_validator/tests/utils/vm_types.py | 8 | ||||
-rw-r--r-- | ice_validator/version.py | 2 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | releases/5.0.0-container.yaml | 8 |
6 files changed, 23 insertions, 30 deletions
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" @@ -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' |