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


Python cluster.is_clustered方法代码示例

本文整理汇总了Python中charmhelpers.contrib.hahelpers.cluster.is_clustered方法的典型用法代码示例。如果您正苦于以下问题:Python cluster.is_clustered方法的具体用法?Python cluster.is_clustered怎么用?Python cluster.is_clustered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.contrib.hahelpers.cluster的用法示例。


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

示例1: test_is_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_is_clustered(self):
        '''It determines whether or not a unit is clustered'''
        self.relation_ids.return_value = ['ha:0']
        self.relation_list.return_value = ['ha/0']
        self.relation_get.return_value = 'yes'
        self.assertTrue(cluster_utils.is_clustered()) 
开发者ID:juju,项目名称:charm-helpers,代码行数:8,代码来源:test_cluster_utils.py

示例2: test_is_not_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_is_not_clustered(self):
        '''It determines whether or not a unit is clustered'''
        self.relation_ids.return_value = ['ha:0']
        self.relation_list.return_value = ['ha/0']
        self.relation_get.return_value = None
        self.assertFalse(cluster_utils.is_clustered()) 
开发者ID:juju,项目名称:charm-helpers,代码行数:8,代码来源:test_cluster_utils.py

示例3: test_is_elected_leader_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_is_elected_leader_clustered(self, is_clustered, is_crm_leader):
        '''It detects it is the eligible leader in a hacluster of units'''
        is_clustered.return_value = True
        is_crm_leader.return_value = True
        self.assertTrue(cluster_utils.is_elected_leader('vip')) 
开发者ID:juju,项目名称:charm-helpers,代码行数:7,代码来源:test_cluster_utils.py

示例4: test_not_is_elected_leader_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_not_is_elected_leader_clustered(self, is_clustered, is_crm_leader):
        '''It detects it is not the eligible leader in a hacluster of units'''
        is_clustered.return_value = True
        is_crm_leader.return_value = False
        self.assertFalse(cluster_utils.is_elected_leader('vip')) 
开发者ID:juju,项目名称:charm-helpers,代码行数:7,代码来源:test_cluster_utils.py

示例5: test_is_is_elected_leader_unclustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_is_is_elected_leader_unclustered(self, is_clustered,
                                              peer_units, oldest_peer):
        '''It detects it is the eligible leader in non-clustered peer group'''
        is_clustered.return_value = False
        oldest_peer.return_value = True
        self.assertTrue(cluster_utils.is_elected_leader('vip')) 
开发者ID:juju,项目名称:charm-helpers,代码行数:8,代码来源:test_cluster_utils.py

示例6: test_determine_api_port_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_determine_api_port_clustered(self, peer_units, https,
                                          is_clustered):
        '''It determines API port in presence of an hacluster'''
        peer_units.return_value = []
        is_clustered.return_value = True
        https.return_value = False
        self.assertEquals(9686, cluster_utils.determine_api_port(9696)) 
开发者ID:juju,项目名称:charm-helpers,代码行数:9,代码来源:test_cluster_utils.py

示例7: test_determine_api_port_clustered_https

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_determine_api_port_clustered_https(self, peer_units, https,
                                                is_clustered):
        '''It determines API port in presence of hacluster + https'''
        peer_units.return_value = []
        is_clustered.return_value = True
        https.return_value = True
        self.assertEquals(9676, cluster_utils.determine_api_port(9696)) 
开发者ID:juju,项目名称:charm-helpers,代码行数:9,代码来源:test_cluster_utils.py

示例8: test_determine_apache_port_clustered

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_determine_apache_port_clustered(self, https, is_clustered):
        '''It determines haproxy port with https disabled'''
        https.return_value = True
        is_clustered.return_value = True
        self.assertEquals(9686, cluster_utils.determine_apache_port(9696)) 
开发者ID:juju,项目名称:charm-helpers,代码行数:7,代码来源:test_cluster_utils.py

示例9: test_determine_apache_port_nopeers_singlemode

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_determine_apache_port_nopeers_singlemode(self, https,
                                                      is_clustered,
                                                      peer_units):
        '''It determines haproxy port with a single unit in singlemode'''
        peer_units.return_value = []
        https.return_value = False
        is_clustered.return_value = False
        port = cluster_utils.determine_apache_port(9696, singlenode_mode=True)
        self.assertEquals(9686, port) 
开发者ID:juju,项目名称:charm-helpers,代码行数:11,代码来源:test_cluster_utils.py

示例10: test_canonical_url_bare

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_canonical_url_bare(self, is_clustered):
        '''It constructs a URL to host with no https or cluster present'''
        self.unit_get.return_value = 'foohost1'
        is_clustered.return_value = False
        configs = MagicMock()
        configs.complete_contexts = MagicMock()
        configs.complete_contexts.return_value = []
        url = cluster_utils.canonical_url(configs)
        self.assertEquals('http://foohost1', url) 
开发者ID:juju,项目名称:charm-helpers,代码行数:11,代码来源:test_cluster_utils.py

示例11: test_canonical_url_https_cluster

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_canonical_url_https_cluster(self, is_clustered):
        '''It constructs a URL to host with https and cluster present'''
        self.config_get.return_value = '10.0.0.1'
        is_clustered.return_value = True
        configs = MagicMock()
        configs.complete_contexts = MagicMock()
        configs.complete_contexts.return_value = ['https']
        url = cluster_utils.canonical_url(configs)
        self.assertEquals('https://10.0.0.1', url) 
开发者ID:juju,项目名称:charm-helpers,代码行数:11,代码来源:test_cluster_utils.py

示例12: test_canonical_url_cluster_no_https

# 需要导入模块: from charmhelpers.contrib.hahelpers import cluster [as 别名]
# 或者: from charmhelpers.contrib.hahelpers.cluster import is_clustered [as 别名]
def test_canonical_url_cluster_no_https(self, is_clustered):
        '''It constructs a URL to host with no https and cluster present'''
        self.config_get.return_value = '10.0.0.1'
        self.unit_get.return_value = 'foohost1'
        is_clustered.return_value = True
        configs = MagicMock()
        configs.complete_contexts = MagicMock()
        configs.complete_contexts.return_value = []
        url = cluster_utils.canonical_url(configs)
        self.assertEquals('http://10.0.0.1', url) 
开发者ID:juju,项目名称:charm-helpers,代码行数:12,代码来源:test_cluster_utils.py


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