Commit df51a394 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: test slapos_crm_check_software_installation_state

parent 71149850
......@@ -9,11 +9,11 @@ monitor_enabled_category = portal.restrictedTraverse(
if monitor_enabled_category is not None:
portal.portal_catalog.searchAndActivate(
portal_type = 'Compute Node',
validation_state = 'validated',
default_monitor_scope_uid = monitor_enabled_category.getUid(),
method_id = 'ComputeNode_checkSoftwareInstallationState',
activate_kw = {'tag':tag}
portal_type='Compute Node',
validation_state='validated',
monitor_scope__uid=monitor_enabled_category.getUid(),
method_id='ComputeNode_checkSoftwareInstallationState',
activate_kw={'tag':tag}
)
context.activate(after_tag=tag).getId()
......@@ -558,80 +558,34 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCaseMixinWithAbort):
def test_checkSoftwareInstallationState_run_on_open_public(self):
#################################################################
# slapos_crm_check_software_installation_state
#################################################################
def test_ComputeNode_checkSoftwareInstallationState_alarm_monitorEnabled(self):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope = 'open')
self.compute_node.edit(monitor_scope="enabled")
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_checkSoftwareInstallationState_dont_run_on_open_public_with_monitor_scope_disabled(self):
def test_ComputeNode_checkSoftwareInstallationState_alarm_invalidated(self):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope = 'open')
self.tic()
self.compute_node.edit(monitor_scope = 'disabled')
self.compute_node.edit(monitor_scope="enabled")
self.compute_node.invalidate()
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def _test_checkSoftwareInstallationState_not_run_on_close(self, allocation_scope):
def test_ComputeNode_checkSoftwareInstallationState_alarm_monitorDisabled(self):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope=allocation_scope)
self.compute_node.edit(monitor_scope="disabled")
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def _test_alarm_run_on_close(self, allocation_scope):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope=allocation_scope)
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_alarm_not_run_on_close_forever(self):
self._test_alarm_not_run_on_close('close/forever')
def test_alarm_not_run_on_close_maintainence(self):
self._test_alarm_not_run_on_close('close/maintenence', monitor_scope="disabled")
def test_alarm_not_run_on_close_outdated(self):
self._test_alarm_not_run_on_close('close/outdated', monitor_scope="disabled")
def test_alarm_not_run_on_close_termination(self):
self._test_alarm_not_run_on_close('close/termination', monitor_scope="disabled")
def test_alarm_not_run_on_close_noallocation(self):
self._test_alarm_not_run_on_close('close/noallocation', monitor_scope="disabled")
def test_alarm_run_on_close_maintainence(self):
self._test_alarm_run_on_close('close/maintenence')
def test_alarm_run_on_close_outdated(self):
self._test_alarm_run_on_close('close/outdated')
def test_alarm_run_on_close_termination(self):
self._test_alarm_run_on_close('close/termination')
def test_alarm_run_on_close_noallocation(self):
self._test_alarm_run_on_close('close/noallocation')
def test_checkSoftwareInstallationState_not_run_on_close_forever(self):
self._test_checkSoftwareInstallationState_not_run_on_close('close/forever')
def test_checkSoftwareInstallationState_not_run_on_close_maintainence(self):
self._test_checkSoftwareInstallationState_not_run_on_close('close/maintenence')
def test_checkSoftwareInstallationState_not_run_on_close_outdated(self):
self._test_checkSoftwareInstallationState_not_run_on_close('close/outdated')
def test_checkSoftwareInstallationState_not_run_on_close_termination(self):
self._test_checkSoftwareInstallationState_not_run_on_close('close/termination')
class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment