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


Python CustomServiceOrchestrator.allocate_port方法代码示例

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


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

示例1: test_allocate_port_no_def

# 需要导入模块: from CustomServiceOrchestrator import CustomServiceOrchestrator [as 别名]
# 或者: from CustomServiceOrchestrator.CustomServiceOrchestrator import allocate_port [as 别名]
  def test_allocate_port_no_def(self, socket_bind_mock, socket_getsockname_mock):
    tempdir = tempfile.gettempdir()
    config = MagicMock()
    config.get.return_value = "something"
    config.getResolvedPath.return_value = tempdir
    config.getWorkRootPath.return_value = tempdir
    config.getLogPath.return_value = tempdir

    dummy_controller = MagicMock()
    orchestrator = CustomServiceOrchestrator(config, dummy_controller, self.agentToggleLogger)
    socket_getsockname_mock.return_value = [100, 102]
    ret = orchestrator.allocate_port()
    self.assertEqual(ret, 102)
开发者ID:OpenPOWER-BigData,项目名称:HDP-slider,代码行数:15,代码来源:TestCustomServiceOrchestrator.py

示例2: test_port_allocation

# 需要导入模块: from CustomServiceOrchestrator import CustomServiceOrchestrator [as 别名]
# 或者: from CustomServiceOrchestrator.CustomServiceOrchestrator import allocate_port [as 别名]
  def test_port_allocation(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 = orchestrator.allocate_port()
    self.assertFalse(port == -1)
    self.assertTrue(port > 0)
开发者ID:OpenPOWER-BigData,项目名称:HDP-slider,代码行数:16,代码来源:TestCustomServiceOrchestrator.py

示例3: test_allocate_port_def

# 需要导入模块: from CustomServiceOrchestrator import CustomServiceOrchestrator [as 别名]
# 或者: from CustomServiceOrchestrator.CustomServiceOrchestrator import allocate_port [as 别名]
  def test_allocate_port_def(self, socket_connect_mock, socket_close_mock):
    e = OSError()
    socket_connect_mock.side_effect = e
    tempdir = tempfile.gettempdir()
    config = MagicMock()
    config.get.return_value = "something"
    config.getResolvedPath.return_value = tempdir
    config.getWorkRootPath.return_value = tempdir
    config.getLogPath.return_value = tempdir

    dummy_controller = MagicMock()
    orchestrator = CustomServiceOrchestrator(config, dummy_controller, self.agentToggleLogger)
    ret = orchestrator.allocate_port(10)
    self.assertEqual(ret, 10)
开发者ID:OpenPOWER-BigData,项目名称:HDP-slider,代码行数:16,代码来源:TestCustomServiceOrchestrator.py


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