Allow arrays in 'value' in environment_config.yaml
Since Fuel 9.0 we have a new type for environment attributes: "text_list". In that case, attribute's value must be an array. FPB didn't handle that case, and throws error for any case when value is array. This patch add "array" as a valid type for "value". In order to keep simplicity and do not overcomplicate JSON schema, it allows arrays for all types, not only for "text_list". It's consistent with Nailgun code, where we don't have such check either. Change-Id: I2ab401e4cdc7c1a1eb276aa71253818c688fdca1 Closes-Bug: #1616466
This commit is contained in:
parent
d6d8b0de6e
commit
4cd808c39b
|
@ -148,6 +148,21 @@ class TestValidatorV4(TestValidatorV3):
|
||||||
self.validator.check_env_config_attrs
|
self.validator.check_env_config_attrs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('fuel_plugin_builder.validators.base.utils')
|
||||||
|
def test_environment_config_type_attrs(self, utils_mock):
|
||||||
|
mock_data = {
|
||||||
|
'attributes': {
|
||||||
|
'server-name': {
|
||||||
|
'value': [],
|
||||||
|
'label': 'test',
|
||||||
|
'weight': 1,
|
||||||
|
'type': 'text_list',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
utils_mock.parse_yaml.return_value = mock_data
|
||||||
|
self.assertEqual(None, self.validator.check_env_config_attrs())
|
||||||
|
|
||||||
@mock.patch('fuel_plugin_builder.validators.base.utils')
|
@mock.patch('fuel_plugin_builder.validators.base.utils')
|
||||||
def test_check_components_schema_validation_failed(self, utils_mock):
|
def test_check_components_schema_validation_failed(self, utils_mock):
|
||||||
data_sets = [
|
data_sets = [
|
||||||
|
|
|
@ -173,7 +173,10 @@ class BaseSchema(object):
|
||||||
{'type': 'string'},
|
{'type': 'string'},
|
||||||
{'type': 'boolean'},
|
{'type': 'boolean'},
|
||||||
{'type': 'object',
|
{'type': 'object',
|
||||||
'properties': {'generator': {'type': 'string'}}}
|
'properties': {'generator': {'type': 'string'}}},
|
||||||
|
{'type': 'array',
|
||||||
|
'items': {'anyOf': [{'type': 'string'},
|
||||||
|
{'type': 'boolean'}]}},
|
||||||
]},
|
]},
|
||||||
'label': {'type': 'string'},
|
'label': {'type': 'string'},
|
||||||
'restrictions': self.restrictions,
|
'restrictions': self.restrictions,
|
||||||
|
|
Loading…
Reference in New Issue