当前位置: 首页>>代码示例>>Python>>正文


Python utils.get_fake_cluster函数代码示例

本文整理汇总了Python中sahara.tests.unit.plugins.cdh.utils.get_fake_cluster函数的典型用法代码示例。如果您正苦于以下问题:Python get_fake_cluster函数的具体用法?Python get_fake_cluster怎么用?Python get_fake_cluster使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_fake_cluster函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_swift_enabled

    def test_is_swift_enabled(self):
        cluster = ctu.get_fake_cluster(cluster_configs={})
        self.assertTrue(c_h.is_swift_enabled(cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general': {c_h.ENABLE_SWIFT.name: False}})
        self.assertFalse(c_h.is_swift_enabled(cluster))
开发者ID:Imperat,项目名称:sahara,代码行数:7,代码来源:test_config_helper_550.py

示例2: test_is_hbase_common_lib_enabled

    def test_is_hbase_common_lib_enabled(self):
        cluster = ctu.get_fake_cluster(cluster_configs={})
        self.assertTrue(c_h.is_hbase_common_lib_enabled(cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general':
                             {c_h.ENABLE_HBASE_COMMON_LIB.name: False}})
        self.assertFalse(c_h.is_hbase_common_lib_enabled(cluster))
开发者ID:Imperat,项目名称:sahara,代码行数:8,代码来源:test_config_helper_550.py

示例3: test_get_cdh5_key_url

    def test_get_cdh5_key_url(self):
        cluster = ctu.get_fake_cluster(cluster_configs={})
        self.assertEqual(c_h.CDH5_REPO_KEY_URL.default_value,
                         c_h.get_cdh5_key_url(cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general': {c_h.CDH5_REPO_KEY_URL.name: 'spam'}})
        self.assertEqual('spam', c_h.get_cdh5_key_url(cluster))
开发者ID:Imperat,项目名称:sahara,代码行数:8,代码来源:test_config_helper_550.py

示例4: test_get_extjs_lib_url

    def test_get_extjs_lib_url(self):
        cluster = ctu.get_fake_cluster(cluster_configs={})
        self.assertEqual(c_h.DEFAULT_EXTJS_LIB_URL,
                         c_h.get_extjs_lib_url(cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general': {c_h.EXTJS_LIB_URL.name: 'spam'}})
        self.assertEqual('spam', c_h.get_extjs_lib_url(cluster))
开发者ID:Imperat,项目名称:sahara,代码行数:8,代码来源:test_config_helper_550.py

示例5: test_get_required_anti_affinity

    def test_get_required_anti_affinity(self):
        self.assertTrue(c_h.get_required_anti_affinity(self.cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general': {
                c_h.REQUIRE_ANTI_AFFINITY.name: False}})
        self.assertFalse(c_h.get_required_anti_affinity(cluster))
开发者ID:egafford,项目名称:sahara,代码行数:7,代码来源:test_config_helper_540.py

示例6: test_get_swift_lib_url

    def test_get_swift_lib_url(self):
        self.assertEqual(c_h.DEFAULT_SWIFT_LIB_URL,
                         c_h.get_swift_lib_url(self.cluster))

        cluster = ctu.get_fake_cluster(
            cluster_configs={'general': {c_h.SWIFT_LIB_URL.name: 'spam'}})
        self.assertEqual('spam', c_h.get_swift_lib_url(cluster))
开发者ID:egafford,项目名称:sahara,代码行数:7,代码来源:test_config_helper_540.py

示例7: test_get_service

    def test_get_service(self, mock_get_cl_cluster):
        self.assertRaises(ValueError, CU.get_service_by_role, 'NAMENODE')

        cluster = ctu.get_fake_cluster()
        inst = cluster.node_groups[0].instances[0]
        mock_get_cl_cluster.return_value = None

        self.assertRaises(ValueError, CU.get_service_by_role, 'spam',
                          cluster)
        self.assertRaises(ValueError, CU.get_service_by_role, 'spam',
                          instance=inst)

        mock_get_cl_cluster.reset_mock()

        mock_get_service = mock.MagicMock()
        mock_get_service.get_service.return_value = mock.Mock()
        mock_get_cl_cluster.return_value = mock_get_service

        CU.get_service_by_role('NAMENODE', cluster)
        args = ((CU.HDFS_SERVICE_NAME,),)
        self.assertEqual(args, mock_get_service.get_service.call_args)

        mock_get_service.reset_mock()
        CU.get_service_by_role('JOBHISTORY', instance=inst)
        args = ((CU.YARN_SERVICE_NAME,),)
        self.assertEqual(args, mock_get_service.get_service.call_args)

        mock_get_service.reset_mock()
        CU.get_service_by_role('OOZIE_SERVER', cluster)
        args = ((CU.OOZIE_SERVICE_NAME,),)
        self.assertEqual(args, mock_get_service.get_service.call_args)
开发者ID:Imperat,项目名称:sahara,代码行数:31,代码来源:test_cloudera_utils.py

示例8: get_concrete_cluster

def get_concrete_cluster():
    cluster = ctu.get_fake_cluster()

    # add configs to cluster
    configs = {"SQOOP": {}, "HUE": {}, "general": {}, "KMS": {}, "HIVE": {},
               "SOLR": {}, "FLUME": {}, "HDFS": {"dfs_replication": 1},
               "KS_INDEXER": {}, "SPARK_ON_YARN": {}, "SENTRY": {}, "YARN": {},
               "ZOOKEEPER": {}, "OOZIE": {}, "HBASE": {}, "IMPALA": {}}
    # cluster is immutable, a work around
    dict.__setitem__(cluster, "cluster_config", configs)

    # add fake remotes to instances
    instances = [i for ng in cluster.node_groups for i in ng.instances]
    for i in instances:
        object.__setattr__(i, 'remote', mock.MagicMock())

    # add cluster_id to each node group
    for ng in cluster.node_groups:
        dict.__setitem__(ng, "cluster_id", ng.cluster.id)

    # add extra config
    dict.__setitem__(cluster, "extra", {})
    return cluster
开发者ID:Imperat,项目名称:sahara,代码行数:23,代码来源:base_plugin_utils_test.py

示例9: get_cluster

def get_cluster(version='5.3.0'):
    cluster = c_u.get_fake_cluster(plugin_name='CDH', hadoop_version=version)
    return cluster
开发者ID:Imperat,项目名称:sahara,代码行数:3,代码来源:test_edp_engine.py

示例10: test_get_oozie

 def test_get_oozie(self):
     cluster = tu.get_fake_cluster()
     inst = u.get_oozie(cluster)
     self.assertEqual('id2', inst.instance_id)
开发者ID:COSHPC,项目名称:sahara,代码行数:4,代码来源:test_utils.py

示例11: test_get_historyserver

 def test_get_historyserver(self):
     cluster = tu.get_fake_cluster()
     inst = u.get_historyserver(cluster)
     self.assertEqual('id2', inst.instance_id)
开发者ID:COSHPC,项目名称:sahara,代码行数:4,代码来源:test_utils.py

示例12: test_get_nodemanagers

 def test_get_nodemanagers(self):
     cluster = tu.get_fake_cluster()
     nms = u.get_nodemanagers(cluster)
     ids = [nm.instance_id for nm in nms]
     self.assertEqual(sorted(['id00', 'id01', 'id02']), sorted(ids))
开发者ID:COSHPC,项目名称:sahara,代码行数:5,代码来源:test_utils.py

示例13: test_get_datanodes

 def test_get_datanodes(self):
     cluster = tu.get_fake_cluster()
     dns = u.get_datanodes(cluster)
     ids = [dn.instance_id for dn in dns]
     self.assertEqual(sorted(['id00', 'id01', 'id02']), sorted(ids))
开发者ID:COSHPC,项目名称:sahara,代码行数:5,代码来源:test_utils.py

示例14: test_get_resourcemanager

 def test_get_resourcemanager(self):
     cluster = tu.get_fake_cluster()
     inst = u.get_resourcemanager(cluster)
     self.assertEqual('id2', inst.instance_id)
开发者ID:COSHPC,项目名称:sahara,代码行数:4,代码来源:test_utils.py

示例15: test_get_manager

 def test_get_manager(self):
     cluster = tu.get_fake_cluster()
     inst = PU.get_manager(cluster)
     self.assertEqual('id1', inst.instance_id)
开发者ID:Imperat,项目名称:sahara,代码行数:4,代码来源:test_utils_540.py


注:本文中的sahara.tests.unit.plugins.cdh.utils.get_fake_cluster函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。