本文整理汇总了Python中appscale.tools.appscale.AppScale.get_head_node方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.get_head_node方法的具体用法?Python AppScale.get_head_node怎么用?Python AppScale.get_head_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.appscale.AppScale
的用法示例。
在下文中一共展示了AppScale.get_head_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_head_node
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get_head_node [as 别名]
def test_get_head_node(self):
shadow_node_1 = {'public_ip': 'public2', 'roles': ['shadow']}
appengine_node = {'public_ip': 'public1', 'roles': ['appengine']}
shadow_node_2 = {'public_ip': 'public3', 'roles': ['shadow']}
appscale = AppScale()
# If the list of nodes does not have a node with the shadow role, the
# tools should raise an AppScaleException.
with self.assertRaises(AppScaleException):
appscale.get_head_node([appengine_node])
# If the list of nodes contains any nodes with the shadow role, the tools
# should return the public IP address of the first node which has that
# role.
self.assertEqual(shadow_node_1['public_ip'],
appscale.get_head_node([shadow_node_1, appengine_node, shadow_node_2]))