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


Python Job.runJob方法代码示例

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


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

示例1: test_runTest_deletes_bad_node

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import runJob [as 别名]
    def test_runTest_deletes_bad_node(self, mock_getSSHObject, mock_update):
        job = Job(change_num="change_num", project_name="project")

        nodepool = mock.Mock()
        nodepool.getNode.return_value = ('new_node', 'ip')
        mock_getSSHObject.return_value = None

        job.runJob("DB", nodepool)

        nodepool.deleteNode.assert_called_once_with('new_node')
        mock_update.assert_called_once_with("DB", node_id=0)
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:13,代码来源:test_job.py

示例2: test_runTest_deletes_existing_node

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import runJob [as 别名]
    def test_runTest_deletes_existing_node(self, mock_getSSHObject, mock_update):
        job = Job(change_num="change_num", project_name="project")
        job.node_id='existing_node'

        nodepool = mock.Mock()
        nodepool.getNode.return_value = (None, None)

        job.runJob("DB", nodepool)

        nodepool.deleteNode.assert_called_once_with('existing_node')
        mock_update.assert_called_once_with("DB", node_id=0)
        self.assertEqual(0, mock_getSSHObject.call_count)
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:14,代码来源:test_job.py

示例3: test_runTest_update_test_runner

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import runJob [as 别名]
    def test_runTest_update_test_runner(self, mock_update_testrunner,
                                mock_execute_command,
                                mock_update, mock_sleep):
        job = Job(change_num="change_num", change_ref='change_ref',
                  project_name="openstack/xenapi-os-testing")

        nodepool = mock.Mock()
        nodepool.getNode.return_value = ('new_node', 'ip')
        ssh = mock.Mock()

        job.runJob("DB", nodepool)

        mock_update_testrunner.assert_has_calls([mock.call('change_ref')])
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:15,代码来源:test_job.py

示例4: test_runTest_happy_path

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import runJob [as 别名]
    def test_runTest_happy_path(self, mock_execute_command,
                                mock_update, mock_sleep):
        job = Job(change_num="change_num", project_name="project")

        nodepool = mock.Mock()
        nodepool.getNode.return_value = ('new_node', 'ip')
        ssh = mock.Mock()

        job.runJob("DB", nodepool)

        # The node should not be deleted(!)
        self.assertEqual(0, nodepool.deleteNode.call_count)
        # Two calls - one to set the node ID and the other to set the state to running
        update_call1 = mock.call("DB", node_id='new_node', result='', node_ip='ip')
        update_call2 = mock.call("DB", state=constants.RUNNING)
        mock_update.assert_has_calls([update_call1, update_call2])
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:18,代码来源:test_job.py


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