本文整理汇总了Python中MilkCheck.Engine.ServiceGroup.ServiceGroup.inherits_from方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceGroup.inherits_from方法的具体用法?Python ServiceGroup.inherits_from怎么用?Python ServiceGroup.inherits_from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MilkCheck.Engine.ServiceGroup.ServiceGroup
的用法示例。
在下文中一共展示了ServiceGroup.inherits_from方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_inheritance
# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import inherits_from [as 别名]
def test_inheritance(self):
"""Test inheritance between services"""
ser = Service('parent')
ser.target = '127.0.0.1'
ser.timeout = 15
group = ServiceGroup('group')
subser1 = Service('subser1')
subser1.target = HOSTNAME
subser2 = Service('subser2')
subser2.timeout = 3
group.add_inter_dep(target=subser1)
group.add_inter_dep(target=subser2)
group.inherits_from(ser)
self.assertEqual(group.target, NodeSet('127.0.0.1'))
self.assertEqual(group.timeout, 15)
self.assertEqual(subser1.target, NodeSet(HOSTNAME))
self.assertEqual(subser1.timeout, 15)
self.assertEqual(subser2.target, NodeSet('127.0.0.1'))
self.assertEqual(subser2.timeout, 3)