示例#1
0
    def test_hdp2_create_sqoop_service(self, patched):
        s = self.get_services_processor('2.0.6')
        service = s.create_service('SQOOP')
        self.assertEqual('SQOOP', service.name)
        expected_configs = set(['global', 'core-site'])
        self.assertEqual(expected_configs,
                         expected_configs & service.configurations)
        self.assertFalse(service.is_mandatory())

        # ensure that hdfs and mr clients are added implicitly
        master_host = hdp_test_base.TestServer(
            'master.novalocal', 'master', '11111', 3,
            '111.11.1111', '222.11.1111')
        master_ng = hdp_test_base.TestNodeGroup(
            'master', [master_host], ["NAMENODE", "RESOURCEMANAGER",
                                      "HISTORYSERVER", "SECONDARY_NAMENODE",
                                      "NODEMANAGER", "DATANODE",
                                      "AMBARI_SERVER", "ZOOKEEPER_SERVER"])
        sqoop_host = hdp_test_base.TestServer(
            'sqoop.novalocal', 'sqoop', '11111', 3,
            '111.11.1111', '222.11.1111')
        sqoop_ng = hdp_test_base.TestNodeGroup(
            'sqoop', [sqoop_host], ["SQOOP"])
        cluster = hdp_test_base.TestCluster([master_ng, sqoop_ng])

        cluster_spec = hdp_test_base.create_clusterspec(hdp_version='2.0.6')
        cluster_spec.create_operational_config(cluster, [])

        components = cluster_spec.get_node_groups_containing_component(
            'SQOOP')[0].components
        self.assertIn('HDFS_CLIENT', components)
        self.assertIn('MAPREDUCE2_CLIENT', components)
示例#2
0
    def test__get_ambari_info(self, patched):
        cluster_config_file = pkg.resource_string(
            version.version_info.package,
            'plugins/hdp/versions/version_1_3_2/resources/'
            'default-cluster.template')

        test_host = base.TestServer('host1', 'test-master', '11111', 3,
                                    '111.11.1111', '222.11.1111')

        node_group = base.TestNodeGroup('ng1', [test_host], [
            "AMBARI_SERVER", "NAMENODE", "DATANODE", "JOBTRACKER",
            "TASKTRACKER"
        ])
        cluster = base.TestCluster([node_group])
        cluster_config = cs.ClusterSpec(cluster_config_file)
        cluster_config.create_operational_config(cluster, [])
        plugin = ap.AmbariPlugin()

        #change port
        cluster_config.configurations['ambari']['server.port'] = '9000'

        ambari_info = plugin.get_ambari_info(cluster_config)
        self.assertEqual('9000', ambari_info.port)

        #remove port
        del cluster_config.configurations['ambari']['server.port']
        ambari_info = plugin.get_ambari_info(cluster_config)

        self.assertEqual('8080', ambari_info.port)
示例#3
0
    def test_get_oozie_server(self):
        test_host = base.TestServer('host1', 'test-master', '11111', 3,
                                    '111.11.1111', '222.11.1111')

        node_group = base.TestNodeGroup('ng1', [test_host], [
            "AMBARI_SERVER", "NAMENODE", "DATANODE", "JOBTRACKER",
            "TASKTRACKER", "OOZIE_SERVER"
        ])
        cluster = base.TestCluster([node_group])
        plugin = ap.AmbariPlugin()

        self.assertIsNotNone(plugin.get_oozie_server(cluster))

        node_group = base.TestNodeGroup('ng1', [test_host], [
            "AMBARI_SERVER", "NAMENODE", "DATANODE", "JOBTRACKER",
            "TASKTRACKER", "NOT_OOZIE"
        ])
        cluster = base.TestCluster([node_group])
        self.assertIsNone(plugin.get_oozie_server(cluster))
示例#4
0
 def _create_hbase_cluster(self, version='1.3.2'):
     master_host = hdp_test_base.TestServer(
         'master.novalocal', 'master', '11111', 3,
         '111.11.1111', '222.11.1111')
     if version == '1.3.2':
         master_ng = hdp_test_base.TestNodeGroup(
             'master', [master_host], ["NAMENODE", "JOBTRACKER",
                                       "SECONDARY_NAMENODE", "TASKTRACKER",
                                       "DATANODE", "AMBARI_SERVER",
                                       "ZOOKEEPER_SERVER"])
     elif version == '2.0.6':
         master_ng = hdp_test_base.TestNodeGroup(
             'master', [master_host], ["NAMENODE", "RESOURCEMANAGER",
                                       "SECONDARY_NAMENODE", "NODEMANAGER",
                                       "DATANODE", "AMBARI_SERVER",
                                       "HISTORYSERVER", "ZOOKEEPER_SERVER"])
     hbase_host = hdp_test_base.TestServer(
         'hbase.novalocal', 'hbase', '11111', 3,
         '222.22.2222', '222.11.1111')
     hbase_ng = hdp_test_base.TestNodeGroup(
         'hbase', [hbase_host], ["HBASE_MASTER"])
     return hdp_test_base.TestCluster([master_ng, hbase_ng])
示例#5
0
    def test_hdp2_hbase_validation(self, patched):
        master_host = hdp_test_base.TestServer(
            'master.novalocal', 'master', '11111', 3,
            '111.11.1111', '222.11.1111')
        master_ng = hdp_test_base.TestNodeGroup(
            'master', [master_host], ["NAMENODE", "RESOURCEMANAGER",
                                      "SECONDARY_NAMENODE", "HISTORYSERVER",
                                      "NODEMANAGER", "DATANODE",
                                      "AMBARI_SERVER", "ZOOKEEPER_SERVER"])
        hbase_host = hdp_test_base.TestServer(
            'hbase.novalocal', 'hbase', '11111', 3,
            '111.11.1111', '222.11.1111')

        hbase_ng = hdp_test_base.TestNodeGroup(
            'hbase', [hbase_host], ["HBASE_MASTER"])

        hbase_ng2 = hdp_test_base.TestNodeGroup(
            'hbase2', [hbase_host], ["HBASE_MASTER"])

        hbase_client_host = hdp_test_base.TestServer(
            'hbase-client.novalocal', 'hbase-client', '11111', 3,
            '111.11.1111', '222.11.1111')

        hbase_client_ng = hdp_test_base.TestNodeGroup(
            'hbase-client', [hbase_client_host], ["HBASE_CLIENT"])

        hbase_slave_host = hdp_test_base.TestServer(
            'hbase-rs.novalocal', 'hbase-rs', '11111', 3,
            '111.11.1111', '222.11.1111')

        hbase_slave_ng = hdp_test_base.TestNodeGroup(
            'hbase-rs', [hbase_slave_host], ["HBASE_REGIONSERVER"])

        cluster = hdp_test_base.TestCluster([master_ng, hbase_client_ng])
        cluster_spec = hdp_test_base.create_clusterspec(hdp_version='2.0.6')

        # validation should fail due to lack of hbase master
        self.assertRaises(
            ex.InvalidComponentCountException,
            cluster_spec.create_operational_config, cluster, [])

        cluster = hdp_test_base.TestCluster(
            [master_ng, hbase_client_ng, hbase_slave_ng])
        cluster_spec = hdp_test_base.create_clusterspec(hdp_version='2.0.6')

        # validation should fail due to lack of hbase master

        self.assertRaises(
            ex.InvalidComponentCountException,
            cluster_spec.create_operational_config, cluster, [])

        cluster = hdp_test_base.TestCluster(
            [master_ng, hbase_client_ng, hbase_ng])
        cluster_spec = hdp_test_base.create_clusterspec(hdp_version='2.0.6')

        # validation should succeed with hbase master included
        cluster_spec.create_operational_config(cluster, [])

        cluster = hdp_test_base.TestCluster(
            [master_ng, hbase_client_ng, hbase_ng, hbase_ng2])
        cluster_spec = hdp_test_base.create_clusterspec(hdp_version='2.0.6')

        # validation should fail with multiple hbase master components
        self.assertRaises(
            ex.InvalidComponentCountException,
            cluster_spec.create_operational_config, cluster, [])