本文整理汇总了Python中ambari_agent.ActionQueue.ActionQueue.execute_status_command方法的典型用法代码示例。如果您正苦于以下问题:Python ActionQueue.execute_status_command方法的具体用法?Python ActionQueue.execute_status_command怎么用?Python ActionQueue.execute_status_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ambari_agent.ActionQueue.ActionQueue
的用法示例。
在下文中一共展示了ActionQueue.execute_status_command方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_execute_status_command_with_alerts
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import execute_status_command [as 别名]
def test_execute_status_command_with_alerts(self, CustomServiceOrchestrator_mock,
build_mock, execute_command_mock,
requestComponentStatus_mock, read_stack_version_mock,
status_update_callback):
CustomServiceOrchestrator_mock.return_value = None
dummy_controller = MagicMock()
actionQueue = ActionQueue(AmbariConfig().getConfig(), dummy_controller)
requestComponentStatus_mock.reset_mock()
requestComponentStatus_mock.return_value = {
'exitcode': 0,
'stdout': 'out',
'stderr': 'err',
'structuredOut': {'alerts': [ {'name': 'flume_alert'} ] }
}
build_mock.return_value = {'somestatusresult': 'aresult'}
actionQueue.execute_status_command(self.status_command_for_alerts)
report = actionQueue.result()
self.assertTrue(requestComponentStatus_mock.called)
self.assertEqual(len(report['componentStatus']), 1)
self.assertTrue(report['componentStatus'][0].has_key('alerts'))
示例2: test_execute_status_command
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import execute_status_command [as 别名]
def test_execute_status_command(self, CustomServiceOrchestrator_mock,
build_mock, execute_command_mock, requestComponentSecurityState_mock,
requestComponentStatus_mock, read_stack_version_mock,
status_update_callback):
CustomServiceOrchestrator_mock.return_value = None
dummy_controller = MagicMock()
actionQueue = ActionQueue(AmbariConfig(), dummy_controller)
build_mock.return_value = {'dummy report': '' }
dummy_controller.recovery_manager = RecoveryManager(tempfile.mktemp())
requestComponentStatus_mock.reset_mock()
requestComponentStatus_mock.return_value = {'exitcode': 0 }
requestComponentSecurityState_mock.reset_mock()
requestComponentSecurityState_mock.return_value = 'UNKNOWN'
actionQueue.execute_status_command(self.status_command)
report = actionQueue.result()
expected = {'dummy report': '',
'securityState' : 'UNKNOWN'}
self.assertEqual(len(report['componentStatus']), 1)
self.assertEqual(report['componentStatus'][0], expected)
self.assertTrue(requestComponentStatus_mock.called)
示例3: test_execute_status_command
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import execute_status_command [as 别名]
def test_execute_status_command(self, CustomServiceOrchestrator_mock,
build_mock, execute_command_mock,
requestComponentStatus_mock, read_stack_version_mock,
status_update_callback):
CustomServiceOrchestrator_mock.return_value = None
dummy_controller = MagicMock()
actionQueue = ActionQueue(AmbariConfig().getConfig(), dummy_controller)
build_mock.return_value = "dummy report"
requestComponentStatus_mock.reset_mock()
requestComponentStatus_mock.return_value = {'exitcode': 0}
actionQueue.execute_status_command(self.status_command)
report = actionQueue.result()
expected = 'dummy report'
self.assertEqual(len(report['componentStatus']), 1)
self.assertEqual(report['componentStatus'][0], expected)
self.assertTrue(requestComponentStatus_mock.called)