Commit 15bee843 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: test slapos_crm_check_instance_in_error

parent 68c7c0d0
......@@ -606,41 +606,14 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
return instance_tree
def _makeSoftwareInstance(self, instance_tree):
kw = dict(
software_release=instance_tree.getUrlString(),
software_type=self.generateNewSoftwareType(),
instance_xml=self.generateSafeXml(),
sla_xml=self.generateSafeXml(),
shared=False,
software_title=instance_tree.getTitle(),
state='started'
)
instance_tree.requestStart(**kw)
instance_tree.requestInstance(**kw)
def test_checkInstanceInError_validated_instance_tree(self):
def test_InstanceTree_checkSoftwareInstanceState_alarm_validated(self):
host_sub = self._makeInstanceTree()
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_instance_in_error
self._test_alarm(alarm, host_sub, "InstanceTree_checkSoftwareInstanceState")
def test_checkInstanceInError_validated_instance_tree_with_monitor_disabled(self):
host_sub = self._makeInstanceTree()
host_sub.edit(monitor_scope="disabled")
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_instance_in_error
self._test_alarm(alarm, host_sub, "InstanceTree_checkSoftwareInstanceState")
# This is an un-optimal case, as the query cannot be used in negated form
# on the searchAndActivate, so we end up callind the script in any situation.
self.assertEqual('Visited by InstanceTree_checkSoftwareInstanceState',
host_sub.workflow_history['edit_workflow'][-1]['comment'])
def test_checkInstanceInError_archived_instance_tree(self):
def test_InstanceTree_checkSoftwareInstanceState_alarm_archived(self):
host_sub = self._makeInstanceTree()
host_sub.archive()
self.tic()
......
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