Exemplo n.º 1
0
 def test_create_multiple_clusters_success(self, check_cluster):
     MULTIPLE_CLUSTERS = api_base.SAMPLE_CLUSTER.copy()
     MULTIPLE_CLUSTERS['count'] = 2
     clusters = api.create_multiple_clusters(MULTIPLE_CLUSTERS)
     self.assertEqual(2, check_cluster.call_count)
     result_cluster1 = api.get_cluster(clusters['clusters'][0])
     result_cluster2 = api.get_cluster(clusters['clusters'][1])
     self.assertEqual(c_u.CLUSTER_STATUS_ACTIVE, result_cluster1.status)
     self.assertEqual(c_u.CLUSTER_STATUS_ACTIVE, result_cluster2.status)
     expected_count = {
         'ng_1': 1,
         'ng_2': 3,
         'ng_3': 1,
     }
     ng_count = 0
     for ng in result_cluster1.node_groups:
         self.assertEqual(expected_count[ng.name], ng.count)
         ng_count += 1
     self.assertEqual(3, ng_count)
     api.terminate_cluster(result_cluster1.id)
     api.terminate_cluster(result_cluster2.id)
     self.assertEqual(
         ['get_open_ports', 'recommend_configs', 'validate',
          'ops.provision_cluster',
          'get_open_ports', 'recommend_configs', 'validate',
          'ops.provision_cluster',
          'ops.terminate_cluster',
          'ops.terminate_cluster'], self.calls_order)
Exemplo n.º 2
0
 def test_create_multiple_clusters_success(self, check_cluster):
     MULTIPLE_CLUSTERS = api_base.SAMPLE_CLUSTER.copy()
     MULTIPLE_CLUSTERS['count'] = 2
     clusters = api.create_multiple_clusters(MULTIPLE_CLUSTERS)
     self.assertEqual(2, check_cluster.call_count)
     result_cluster1 = api.get_cluster(
         clusters['clusters'][0]['cluster']['id'])
     result_cluster2 = api.get_cluster(
         clusters['clusters'][1]['cluster']['id'])
     self.assertEqual(c_u.CLUSTER_STATUS_ACTIVE, result_cluster1.status)
     self.assertEqual(c_u.CLUSTER_STATUS_ACTIVE, result_cluster2.status)
     expected_count = {
         'ng_1': 1,
         'ng_2': 3,
         'ng_3': 1,
     }
     ng_count = 0
     for ng in result_cluster1.node_groups:
         self.assertEqual(expected_count[ng.name], ng.count)
         ng_count += 1
     self.assertEqual(3, ng_count)
     api.terminate_cluster(result_cluster1.id)
     api.terminate_cluster(result_cluster2.id)
     self.assertEqual(
         ['get_open_ports', 'recommend_configs', 'validate',
          'ops.provision_cluster',
          'get_open_ports', 'recommend_configs', 'validate',
          'ops.provision_cluster',
          'ops.terminate_cluster',
          'ops.terminate_cluster'], self.calls_order)
Exemplo n.º 3
0
def clusters_create(data):
    # renaming hadoop_version -> plugin_version
    # this can be removed once APIv1 is deprecated
    data['hadoop_version'] = data['plugin_version']
    del data['plugin_version']
    if data.get('count', None) is not None:
        return u.render(api.create_multiple_clusters(data))
    else:
        return u.render(api.create_cluster(data).to_wrapped_dict())
Exemplo n.º 4
0
def clusters_create(data):
    # renaming hadoop_version -> plugin_version
    # this can be removed once APIv1 is deprecated
    data['hadoop_version'] = data['plugin_version']
    del data['plugin_version']
    if data.get('count', None) is not None:
        result = api.create_multiple_clusters(data)
        for c in result['clusters']:
            u._replace_hadoop_version_plugin_version(c['cluster'])
        return u.render(result)
    else:
        result = api.create_cluster(data).to_wrapped_dict()
        u._replace_hadoop_version_plugin_version(result['cluster'])
        return u.render(result)
Exemplo n.º 5
0
def clusters_create(data):
    # renaming hadoop_version -> plugin_version
    # this can be removed once APIv1 is deprecated
    data['hadoop_version'] = data['plugin_version']
    del data['plugin_version']
    if data.get('count', None) is not None:
        result = api.create_multiple_clusters(data)
        for c in result['clusters']:
            u._replace_hadoop_version_plugin_version(c['cluster'])
            u._replace_tenant_id_project_id(c['cluster'])
        return u.render(result)
    else:
        result = api.create_cluster(data).to_wrapped_dict()
        u._replace_hadoop_version_plugin_version(result['cluster'])
        u._replace_tenant_id_project_id(result['cluster'])
        return u.render(result)
Exemplo n.º 6
0
def clusters_create_multiple(data):
    data['hadoop_version'] = data['plugin_version']
    del data['plugin_version']
    return u.render(api.create_multiple_clusters(data))
Exemplo n.º 7
0
def clusters_create_multiple(data):
    return u.render(api.create_multiple_clusters(data))
Exemplo n.º 8
0
def clusters_create_multiple(data):
    return u.render(api.create_multiple_clusters(data))