本文整理汇总了Python中CustomServiceOrchestrator.CustomServiceOrchestrator.get_allowed_port_list方法的典型用法代码示例。如果您正苦于以下问题:Python CustomServiceOrchestrator.get_allowed_port_list方法的具体用法?Python CustomServiceOrchestrator.get_allowed_port_list怎么用?Python CustomServiceOrchestrator.get_allowed_port_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomServiceOrchestrator.CustomServiceOrchestrator
的用法示例。
在下文中一共展示了CustomServiceOrchestrator.get_allowed_port_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parse_allowed_port_values
# 需要导入模块: from CustomServiceOrchestrator import CustomServiceOrchestrator [as 别名]
# 或者: from CustomServiceOrchestrator.CustomServiceOrchestrator import get_allowed_port_list [as 别名]
def test_parse_allowed_port_values(self):
dummy_controller = MagicMock()
tempdir = tempfile.gettempdir()
tempWorkDir = tempdir + "W"
config = MagicMock()
config.get.return_value = "something"
config.getResolvedPath.return_value = tempdir
config.getWorkRootPath.return_value = tempWorkDir
config.getLogPath.return_value = tempdir
orchestrator = CustomServiceOrchestrator(config, dummy_controller, self.agentToggleLogger)
port_range = "48000-48005"
port_range_full_list = [48000, 48001, 48002, 48003, 48004, 48005]
allowed_ports = orchestrator.get_allowed_port_list(port_range, 3)
self.assertTrue(set(allowed_ports).issubset(port_range_full_list))
port_range = "48000 , 48005"
port_range_full_list = [48000, 48005]
allowed_ports = orchestrator.get_allowed_port_list(port_range, 1)
self.assertTrue(set(allowed_ports).issubset(port_range_full_list))
port_range = "48000 , 48004-48005"
port_range_full_list = [48000, 48004, 48005]
allowed_ports = orchestrator.get_allowed_port_list(port_range, 2)
self.assertTrue(set(allowed_ports).issubset(port_range_full_list))