Commit c74c4c09 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Add tests for SupportRequest_recheckMonitoring

parent 5722db7d
......@@ -202,13 +202,19 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
self.portal.REQUEST['test_ComputeNode_checkMonitoringState_empty_cache_notify'] = \
self._makeNotificationMessage(compute_node.getReference())
error_dict = compute_node.ComputeNode_getReportedErrorDict()
compute_node.ComputeNode_checkMonitoringState()
self.tic()
ticket_title = "Lost contact with compute_node %s" % compute_node.getReference()
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None)
self.assertEqual(ticket.getTitle(), ticket_title)
self.assertEqual(ticket_title, error_dict['ticket_title'])
self.assertEqual(ticket_title, ticket.getTitle())
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertEqual("No Contact Information", message)
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
......@@ -229,6 +235,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(event.getPortalType(), "Web Message")
compute_node.setAccessStatus("")
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(None, message)
@simulate('Project_isSupportRequestCreationClosed', '*args, **kwargs', 'return 0')
@simulate('NotificationTool_getDocumentValue',
'reference=None, **kw',
......@@ -249,13 +259,21 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
with PinnedDateTime(self, DateTime() - 1.1):
self.start_requested_software_instance.setAccessStatus("")
error_dict = compute_node.ComputeNode_getReportedErrorDict()
compute_node.ComputeNode_checkMonitoringState()
self.tic()
ticket_title = "Compute Node %s has a stalled instance process" % compute_node.getReference()
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None)
self.assertEqual(ticket.getTitle(), ticket_title)
self.assertEqual(ticket_title, error_dict['ticket_title'])
self.assertEqual(ticket_title, ticket.getTitle())
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertEqual(message,
"%s has a stalled instance process" % compute_node.getReference())
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
......@@ -276,6 +294,11 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(event.getPortalType(), "Web Message")
self.start_requested_software_instance.setAccessStatus("")
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(message, None)
@simulate('Project_isSupportRequestCreationClosed', '*args, **kwargs', 'return 0')
@simulate('NotificationTool_getDocumentValue',
'reference=None, **kw',
......@@ -297,13 +320,20 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
self.start_requested_software_instance.setAccessStatus("")
self.start_requested_software_installation.setAccessStatus("")
error_dict = compute_node.ComputeNode_getReportedErrorDict()
compute_node.ComputeNode_checkMonitoringState()
self.tic()
ticket_title = "Compute Node %s has a stalled instance process" % compute_node.getReference()
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None)
self.assertEqual(ticket.getTitle(), ticket_title)
self.assertEqual(ticket_title, error_dict['ticket_title'])
self.assertEqual(ticket_title, ticket.getTitle())
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertEqual(message,
"%s has a stalled instance process" % compute_node.getReference())
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
......@@ -324,6 +354,12 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(event.getPortalType(), "Web Message")
self.start_requested_software_instance.setAccessStatus("")
self.start_requested_software_installation.setAccessStatus("")
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(message, None)
@simulate('Project_isSupportRequestCreationClosed', '*args, **kwargs', 'return 0')
@simulate('NotificationTool_getDocumentValue',
'reference=None, **kw',
......@@ -351,13 +387,21 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
# Computer is getting access
compute_node.setAccessStatus("")
error_dict = compute_node.ComputeNode_getReportedErrorDict()
compute_node.ComputeNode_checkMonitoringState()
self.tic()
ticket_title = "Compute Node %s has modified file" % compute_node.getReference()
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None)
self.assertEqual(ticket.getTitle(), ticket_title)
self.assertEqual(ticket_title, error_dict['ticket_title'])
self.assertEqual(ticket_title, ticket.getTitle())
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertEqual("%s has modified file" % compute_node.getReference(),
message)
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
......@@ -472,10 +516,14 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
)
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None)
self.assertEqual(ticket_title, error_dict['ticket_title'])
self.assertEqual(ticket_title, ticket.getTitle())
self.assertNotEqual(ticket, None)
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertIn(" is building for mode them 12 hours on", message)
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
event = event_list[0]
......@@ -526,9 +574,14 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin)
)
ticket = self._getGeneratedSupportRequest(compute_node.getUid())
self.assertNotEqual(ticket, None, error_dict)
self.assertNotEqual(ticket, None)
self.assertEqual(error_dict['ticket_title'], ticket_title)
self.assertEqual(ticket.getTitle(), ticket_title)
message = ticket.SupportRequest_recheckMonitoring()
self.assertEqual(error_dict['message'], message)
self.assertIn(" is failing to build for too long on", message)
event_list = ticket.getFollowUpRelatedValueList()
self.assertEqual(len(event_list), 1)
event = event_list[0]
......
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