From f8e99c669045e8ea1a00f86eaa9fdc1cc87e4666 Mon Sep 17 00:00:00 2001 From: Alexander Ignatov Date: Wed, 24 Jul 2013 16:46:20 +0400 Subject: [PATCH] Fixes issue with ng names duplicates Fixes: bug #1202732 Change-Id: I105812e4dd01525a0499c4085568ee8e5c13ad3a --- savanna/service/validations/base.py | 1 + ...test_cluster_template_create_validation.py | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/savanna/service/validations/base.py b/savanna/service/validations/base.py index 6f0b5e253d..307865ce4d 100644 --- a/savanna/service/validations/base.py +++ b/savanna/service/validations/base.py @@ -78,6 +78,7 @@ def check_all_configurations(data): plugin_configs=pl_confs) if data.get('node_groups'): + check_duplicates_node_groups_names(data['node_groups']) for ng in data['node_groups']: check_node_group_basic_fields(data['plugin_name'], data['hadoop_version'], diff --git a/savanna/tests/unit/service/validation/test_cluster_template_create_validation.py b/savanna/tests/unit/service/validation/test_cluster_template_create_validation.py index 26aef98c3f..da64d4548d 100644 --- a/savanna/tests/unit/service/validation/test_cluster_template_create_validation.py +++ b/savanna/tests/unit/service/validation/test_cluster_template_create_validation.py @@ -73,6 +73,29 @@ class TestClusterTemplateCreateValidation(u.ValidationTestCase): "'flavor_id': '42'} " "is not valid under any of the given schemas") ) + self._assert_create_object_validation( + data={ + 'name': "test-name", + 'plugin_name': "vanilla", + 'hadoop_version': "1.1.2", + 'node_groups': [ + { + 'name': 'a', + 'flavor_id': '42', + 'node_processes': ['namenode'], + 'count': 1 + }, + { + "node_group_template_id": "550e8400-e29b-41d4-a716-" + "446655440000", + "name": "a", + 'count': 2 + } + ] + }, + bad_req_i=(1, "INVALID_REFERENCE", + "Duplicates in node group names are detected") + ) def test_cluster_template_create_v_ng_templates(self): self._assert_create_object_validation(