def test_cluster_create_cluster_tmpl_node_group_mixin(self):
        ng_id = self._create_node_group_template(flavor='10')
        ctmpl_id = self._create_cluster_template(ng_id)

        data = {
            "name":
            "testtmplnodegroups",
            "plugin_name":
            "vanilla",
            "hadoop_version":
            "1.2.1",
            "cluster_template_id":
            '%s' % ctmpl_id,
            'default_image_id':
            '550e8400-e29b-41d4-a716-446655440000',
            "node_groups": [{
                "name":
                "allinone",
                "count":
                1,
                "flavor_id":
                "42",
                "node_processes":
                ["namenode", "jobtracker", "datanode", "tasktracker"]
            }]
        }
        patchers = u.start_patch(False)
        c.check_cluster_create(data)
        u.stop_patch(patchers)
 def test_cluster_create_node_group_tmpl_mixin(self):
     ng_id = self._create_node_group_template(flavor='23')
     data = {
         "name":
         "testtmplnodegroups",
         "plugin_name":
         "vanilla",
         "hadoop_version":
         "1.2.1",
         "node_groups": [
             {
                 "node_group_template_id":
                 '%s' % ng_id,
                 "name":
                 "allinone",
                 "count":
                 1,
                 "flavor_id":
                 "42",
                 "node_processes":
                 ["namenode", "jobtracker", "datanode", "tasktracker"]
             },
         ],
         'default_image_id':
         '550e8400-e29b-41d4-a716-446655440000'
     }
     with self.assertRaises(exceptions.InvalidException):
         try:
             patchers = u.start_patch(False)
             c.check_cluster_create(data)
             u.stop_patch(patchers)
         except exceptions.InvalidException as e:
             self.assertEqual("Requested flavor '23' not found", e.message)
             raise e
 def test_cluster_create_node_group_tmpl_mixin(self):
     ng_id = self._create_node_group_template(flavor='23')
     data = {
         "name": "testtmplnodegroups",
         "plugin_name": "vanilla",
         "hadoop_version": "1.2.1",
         "node_groups": [
             {
                 "node_group_template_id": '%s' % ng_id,
                 "name": "allinone",
                 "count": 1,
                 "flavor_id": "42",
                 "node_processes": [
                     "namenode",
                     "jobtracker",
                     "datanode",
                     "tasktracker"
                 ]
             },
         ],
         'default_image_id': '550e8400-e29b-41d4-a716-446655440000'
     }
     with self.assertRaises(exceptions.InvalidException):
         try:
             patchers = u.start_patch(False)
             c.check_cluster_create(data)
             u.stop_patch(patchers)
         except exceptions.InvalidException as e:
             self.assertEqual("Requested flavor '23' not found",
                              e.message)
             raise e
    def test_cluster_create_cluster_tmpl_node_group_mixin(self):
        ng_id = self._create_node_group_template(flavor='10')
        ctmpl_id = self._create_cluster_template(ng_id)

        data = {
            "name": "testtmplnodegroups",
            "plugin_name": "vanilla",
            "hadoop_version": "1.2.1",
            "cluster_template_id": '%s' % ctmpl_id,
            'default_image_id': '550e8400-e29b-41d4-a716-446655440000',
            "node_groups": [
                {
                    "name": "allinone",
                    "count": 1,
                    "flavor_id": "42",
                    "node_processes": [
                        "namenode",
                        "jobtracker",
                        "datanode",
                        "tasktracker"
                    ]
                }
            ]
        }
        patchers = u.start_patch(False)
        c.check_cluster_create(data)
        u.stop_patch(patchers)
    def test_cluster_scaling_v_right_data(self):
        self._create_object_fun = c_s.check_cluster_scaling
        cluster = m.Cluster('test-cluster', 'tenant', 'vanilla', '1.2.2')
        ng = m.NodeGroup('ng', '42', ['namenode'], 1)
        cluster.node_groups.append(ng)
        cluster.status = 'Active'

        data = {
            'resize_node_groups': [
                {
                    'name': 'ng',
                    'count': 4
                }
            ],
            'add_node_groups': [
                {
                    'name': 'a',
                    'flavor_id': '42',
                    'node_processes': ['namenode'],
                    'count': 3
                },
            ]
        }
        patchers = u.start_patch()
        self._assert_cluster_scaling_validation(data=data)
        u.stop_patch(patchers)
Example #6
0
    def test_cluster_scaling_v_right_data(self):
        self._create_object_fun = c_s.check_cluster_scaling

        data = {
            'resize_node_groups': [{
                'name': 'ng',
                'count': 4
            }],
            'add_node_groups': [
                {
                    'name': 'a',
                    'flavor_id': '42',
                    'node_processes': ['namenode'],
                    'count': 3
                },
            ]
        }
        patchers = u.start_patch()
        self._assert_cluster_scaling_validation(data=data)
        u.stop_patch(patchers)
    def test_cluster_create_v_invalid_flavor(self):
        ng_id = self._create_node_group_template(flavor='10')
        ctmpl_id = self._create_cluster_template(ng_id)

        data = {
            "name": "testname",
            "plugin_name": "vanilla",
            "hadoop_version": "1.2.1",
            "cluster_template_id": '%s' % ctmpl_id,
            'default_image_id': '550e8400-e29b-41d4-a716-446655440000'
        }
        data1 = {
            "name":
            "testwithnodegroups",
            "plugin_name":
            "vanilla",
            "hadoop_version":
            "1.2.1",
            "node_groups": [{
                "name":
                "allinone",
                "count":
                1,
                "flavor_id":
                "10",
                "node_processes":
                ["namenode", "jobtracker", "datanode", "tasktracker"]
            }],
            'default_image_id':
            '550e8400-e29b-41d4-a716-446655440000'
        }
        for values in [data, data1]:
            with self.assertRaises(exceptions.InvalidException):
                try:
                    patchers = u.start_patch(False)
                    c.check_cluster_create(values)
                    u.stop_patch(patchers)
                except exceptions.InvalidException as e:
                    self.assertEqual("Requested flavor '10' not found",
                                     e.message)
                    raise e
    def test_cluster_create_v_invalid_flavor(self):
        ng_id = self._create_node_group_template(flavor='10')
        ctmpl_id = self._create_cluster_template(ng_id)

        data = {
            "name": "testname",
            "plugin_name": "vanilla",
            "hadoop_version": "1.2.1",
            "cluster_template_id": '%s' % ctmpl_id,
            'default_image_id': '550e8400-e29b-41d4-a716-446655440000'
        }
        data1 = {
            "name": "testwithnodegroups",
            "plugin_name": "vanilla",
            "hadoop_version": "1.2.1",
            "node_groups": [
                {
                    "name": "allinone",
                    "count": 1,
                    "flavor_id": "10",
                    "node_processes": [
                        "namenode",
                        "jobtracker",
                        "datanode",
                        "tasktracker"
                    ]
                }
            ],
            'default_image_id': '550e8400-e29b-41d4-a716-446655440000'
        }
        for values in [data, data1]:
            with self.assertRaises(exceptions.InvalidException):
                try:
                    patchers = u.start_patch(False)
                    c.check_cluster_create(values)
                    u.stop_patch(patchers)
                except exceptions.InvalidException as e:
                    self.assertEqual("Requested flavor '10' not found",
                                     e.message)
                    raise e
    def test_cluster_scaling_v_right_data(self):
        self._create_object_fun = c_s.check_cluster_scaling

        data = {
            'resize_node_groups': [
                {
                    'name': 'ng',
                    'count': 4
                }
            ],
            'add_node_groups': [
                {
                    'name': 'a',
                    'flavor_id': '42',
                    'node_processes': ['namenode'],
                    'count': 3
                },
            ]
        }
        patchers = u.start_patch()
        self._assert_cluster_scaling_validation(data=data)
        u.stop_patch(patchers)