Merge "Allow compose node without properties"

This commit is contained in:
Jenkins 2017-07-24 10:40:32 +00:00 committed by Gerrit Code Review
commit a31acd11b0
2 changed files with 34 additions and 1 deletions

View File

@ -168,6 +168,7 @@ class TestNodeApi(TestApiValidation):
def test_compose_request_invalid_params(self):
req = {
"name": "test_request1",
"properties": {"invalid_key": "invalid_value"}
}
resp = self.app.post('/v1/nodes',
content_type='application/json',

View File

@ -95,10 +95,42 @@ compose_node_with_flavor = {
'additionalProperties': False,
}
compose_node_with_properties = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'properties': {
'type': 'object',
'properties': {
'memory': {
'type': 'object',
'properties': {
'capacity_mib': {'type': 'string'},
'type': {'type': 'string'}
},
'additionalProperties': False,
},
'processor': {
'type': 'object',
'properties': {
'total_cores': {'type': 'string'},
'model': {'type': 'string'},
},
'additionalProperties': False,
},
},
'additionalProperties': False,
},
},
'required': ['name'],
'additionalProperties': False,
}
compose_node_schema = {
'anyOf': [
compose_node_with_flavor,
flavor_schema,
compose_node_with_properties
]
}