aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator
diff options
context:
space:
mode:
Diffstat (limited to 'ice_validator')
-rw-r--r--ice_validator/tests/test_nova_servers_workload_context.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/ice_validator/tests/test_nova_servers_workload_context.py b/ice_validator/tests/test_nova_servers_workload_context.py
index 4c2ec10..dc4c437 100644
--- a/ice_validator/tests/test_nova_servers_workload_context.py
+++ b/ice_validator/tests/test_nova_servers_workload_context.py
@@ -43,7 +43,7 @@
import pytest
from tests import cached_yaml as yaml
-from .helpers import validates
+from .helpers import validates, get_param
VERSION = "1.0.0"
@@ -89,16 +89,7 @@ def validate_metadata(metadata, parameters):
Return error message string or None if no errors.
"""
for value in metadata.values():
- if isinstance(value, dict):
- if "get_param" in value:
- if value["get_param"] == "workload_context":
- wc = parameters.get("workload_context", {})
- if wc.get("type") == "string":
- break
- else:
- return (
- 'must have parameter "workload_context"' ' of type "string"'
- )
- break
- else:
- return None
+ if get_param(value) == "workload_context" and parameters.get("workload_context", {}).get("type", "") != "string":
+ return 'must have parameter "workload_context" of type "string"'
+ else:
+ return None