Commit ca751a0a authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: update tests

parent 65da9b8c
......@@ -10,13 +10,17 @@
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkComputeNodeState</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Check if a public or a friend compute_node contacted master recently and create a ticket if the compute_node stops to contact master after some time.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -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_checkState',
activate_kw = {'tag':tag}
portal_type='Compute Node',
validation_state='validated',
monitor_scope__uid=monitor_enabled_category.getUid(),
method_id='ComputeNode_checkState',
activate_kw={'tag':tag}
)
context.activate(after_tag=tag).getId()
......@@ -458,7 +458,10 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
reference="TESTREGREQ-%s" % new_id,
)
def test_deleteInstanceTree_matching_regularisation_request(self):
#################################################################
# slapos_crm_delete_instance_tree
#################################################################
def test_RegularisationRequest_deleteInstanceTreeList_alarm_matchingRegularisationRequest(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_delete_acknowledgement')
ticket.validate()
......@@ -469,7 +472,7 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
slapos_crm_delete_instance_tree
self._test_alarm(alarm, ticket, "RegularisationRequest_deleteInstanceTreeList")
def test_deleteInstanceTree_not_suspended(self):
def test_RegularisationRequest_deleteInstanceTreeList_alarm_notSuspended(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_delete_acknowledgement')
ticket.validate()
......@@ -480,7 +483,7 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
self._test_alarm_not_visited(alarm, ticket, "RegularisationRequest_deleteInstanceTreeList")
def test_deleteInstanceTree_other_resource(self):
def test_RegularisationRequest_deleteInstanceTreeList_alarm_otherResource(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_delete_reminder')
ticket.validate()
......@@ -494,12 +497,13 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort):
def test_checkComputeNodeState_public_compute_node_state(self):
#################################################################
# slapos_crm_check_compute_node_state
#################################################################
def test_ComputeNode_checkState_alarm_monitoredComputeNodeState(self):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope='open')
self.tic()
self.assertEqual(self.compute_node.getMonitorScope(), "enabled")
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_compute_node_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkState")
......@@ -530,27 +534,28 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
slapos_crm_check_compute_node_state
self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkState")
def test_checkComputeNodeState_compute_node_state_on_public_compute_node_with_monitor_scope_disabled(self):
def test_ComputeNode_checkState_alarm_openAllocationAndDisabledMonitor(self):
self._test_checkComputeNodeState_compute_node_state_not_selected(
allocation_scope='open',
monitor_scope="disabled")
def test_checkComputeNodeState_compute_node_state_closed_forever_compute_node(self):
def test_ComputeNode_checkState_alarm_closedForeverAllocation(self):
self._test_checkComputeNodeState_compute_node_state_not_selected(
allocation_scope='closed/forever')
allocation_scope='close/forever')
def test_checkComputeNodeState_compute_node_state_closed_mantainence_compute_node(self):
self._test_checkComputeNodeState_compute_node_state_not_selected(
allocation_scope='closed/maintenance')
def test_ComputeNode_checkState_alarm_closedMaintainanceAllocation(self):
self._test_alarm_check_compute_node_state_selected(
allocation_scope='close/maintenance')
def test_checkComputeNodeState_compute_node_state_closed_termination_compute_node(self):
self._test_checkComputeNodeState_compute_node_state_not_selected(
allocation_scope='closed/termination')
def test_ComputeNode_checkState_alarm_closedTerminationAllocation(self):
self._test_alarm_check_compute_node_state_selected(
allocation_scope='close/termination')
def test_alarm_check_compute_node_state_closed_noallocation_compute_node(self):
def test_ComputeNode_checkState_alarm_closedNoAllocation(self):
self._test_alarm_check_compute_node_state_selected(
allocation_scope='close/noallocation')
class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCaseMixinWithAbort):
def test_checkSoftwareInstallationState_run_on_open_public(self):
......
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