本文整理汇总了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))
示例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))
示例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))
示例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))
示例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))
示例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))
示例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)
示例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
示例9: get_cluster
def get_cluster(version='5.3.0'):
cluster = c_u.get_fake_cluster(plugin_name='CDH', hadoop_version=version)
return cluster
示例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)
示例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)
示例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))
示例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))
示例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)
示例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)