Added check for images tags
The check that the image contains required tags is needed because of we added ability to chose base image for node group template Closes-bug: 1528182 Change-Id: I285fb0ba0df22b8c17c1cb6ea60469fc85fc3b0f
This commit is contained in:
parent
600032aca6
commit
f90193376f
@ -28,6 +28,11 @@ def check_node_group_template_create(data, **kwargs):
|
||||
data['hadoop_version'])
|
||||
b.check_node_group_basic_fields(data['plugin_name'],
|
||||
data['hadoop_version'], data)
|
||||
if data.get('image_id'):
|
||||
b.check_image_registered(data['image_id'])
|
||||
b.check_required_image_tags(data['plugin_name'],
|
||||
data['hadoop_version'],
|
||||
data['image_id'])
|
||||
if data.get('shares'):
|
||||
shares.check_shares(data['shares'])
|
||||
|
||||
@ -77,6 +82,12 @@ def check_node_group_template_update(node_group_template_id, data, **kwargs):
|
||||
else:
|
||||
version = ngt.hadoop_version
|
||||
|
||||
if data.get('image_id'):
|
||||
b.check_image_registered(data['image_id'])
|
||||
b.check_required_image_tags(plugin,
|
||||
version,
|
||||
data['image_id'])
|
||||
|
||||
b.check_node_group_basic_fields(plugin, version, data)
|
||||
|
||||
if data.get('shares'):
|
||||
|
@ -236,6 +236,59 @@ class TestNGTemplateCreateValidation(u.ValidationTestCase):
|
||||
"Requested flavor '1' not found")
|
||||
)
|
||||
|
||||
def test_ng_template_create_validate_image(self):
|
||||
self._assert_create_object_validation(
|
||||
data={
|
||||
'name': 'test-ng',
|
||||
'flavor_id': '42',
|
||||
'plugin_name': 'fake',
|
||||
'hadoop_version': '0.1',
|
||||
'node_processes': ['namenode'],
|
||||
'image_id': '12345'
|
||||
},
|
||||
bad_req_i=(1, 'VALIDATION_ERROR',
|
||||
"'12345' is not a 'uuid'")
|
||||
)
|
||||
self._assert_create_object_validation(
|
||||
data={
|
||||
'name': 'test-ng',
|
||||
'flavor_id': '42',
|
||||
'plugin_name': 'fake',
|
||||
'hadoop_version': '0.1',
|
||||
'node_processes': ['namenode'],
|
||||
'image_id': '12345678-1234-1234-1234-123456789000'
|
||||
},
|
||||
bad_req_i=(1, 'INVALID_REFERENCE',
|
||||
"Requested image "
|
||||
"'12345678-1234-1234-1234-123456789000' "
|
||||
"is not registered")
|
||||
)
|
||||
self._assert_create_object_validation(
|
||||
data={
|
||||
'name': 'test-ng',
|
||||
'flavor_id': '42',
|
||||
'plugin_name': 'fake',
|
||||
'hadoop_version': '0.1',
|
||||
'node_processes': ['namenode'],
|
||||
'image_id': '813fe450-40d2-4acc-ade5-ea753a1bd5bc'
|
||||
},
|
||||
bad_req_i=(1, 'INVALID_REFERENCE',
|
||||
"Requested image "
|
||||
"'813fe450-40d2-4acc-ade5-ea753a1bd5bc' "
|
||||
"doesn't contain required tags: "
|
||||
"['0.1']")
|
||||
)
|
||||
self._assert_create_object_validation(
|
||||
data={
|
||||
'name': 'test-ng',
|
||||
'flavor_id': '42',
|
||||
'plugin_name': 'fake',
|
||||
'hadoop_version': '0.1',
|
||||
'node_processes': ['namenode'],
|
||||
'image_id': '550e8400-e29b-41d4-a716-446655440000'
|
||||
}
|
||||
)
|
||||
|
||||
def test_ng_template_create_v_ng_configs(self):
|
||||
self._assert_create_object_validation(
|
||||
data={
|
||||
|
Loading…
Reference in New Issue
Block a user