本文整理汇总了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)
示例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)
示例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')])
示例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])