Commit f3002bee authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: squash with allocation consistency

parent 5fe67cf7
Pipeline #38265 failed with stage
in 0 seconds
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
portal = context.getPortalObject() portal = context.getPortalObject()
monitor_enabled_category = portal.restrictedTraverse( monitor_enabled_category = portal.restrictedTraverse(
"portal_categories/monitor_scope/enabled", None) "portal_categories/monitor_scope/enabled", None)
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Compute Node',
validation_state='validated', validation_state='validated',
method_id='ComputeNode_checkProjectAllocationConsistencyState', method_id='ComputeNode_checkProjectAllocationConsistencyState',
node=ComplexQuery( monitor_scope__uid=monitor_enabled_category.getUid(),
SimpleQuery(portal_type='Compute Node'),
SimpleQuery(monitor_scope__uid=monitor_enabled_category.getUid()),
logical_operator='and'
),
group_by=['follow_up_uid'], group_by=['follow_up_uid'],
method_kw={'tag': tag}, method_kw={'tag': tag},
activate_kw={'tag': tag, 'priority': 2} activate_kw={'tag': tag, 'priority': 2}
......
...@@ -47,6 +47,58 @@ class TestSlapOSCrmMonitoringMixin(SlapOSTestCaseMixinWithAbort): ...@@ -47,6 +47,58 @@ class TestSlapOSCrmMonitoringMixin(SlapOSTestCaseMixinWithAbort):
return support_request_list[0] return support_request_list[0]
return None return None
class TestSlapOSCrmCheckProjectAllocationConsistencyState(TestSlapOSCrmMonitoringMixin):
launch_caucase = 1
##########################################################################
# slapos_crm_project_allocation_consistency > ComputeNode_checkMonitoringState
##########################################################################
def test_ComputeNode_checkProjectAllocationConsistencyState_alarm_remoteNode(self):
compute_node, _ = self.addComputeNodeAndPartition(self.addProject(),
portal_type='Remote Node')
self.tic()
alarm = self.portal.portal_alarms.slapos_crm_project_allocation_consistency
self._test_alarm_not_visited(alarm, compute_node,
"ComputeNode_checkProjectAllocationConsistencyState")
def test_ComputeNode_checkProjectAllocationConsistencyState_alarm_monitoredComputeNodeState(self):
self._makeComputeNode(self.addProject())
self.tic()
self.assertEqual(self.compute_node.getMonitorScope(), "enabled")
alarm = self.portal.portal_alarms.slapos_crm_project_allocation_consistency
self._test_alarm(alarm, self.compute_node,
"ComputeNode_checkProjectAllocationConsistencyState")
def test_ComputeNode_checkProjectAllocationConsistencyState_alarm_close_forever(self):
self._makeComputeNode(self.addProject())
# Set close forever disabled monitor
self.compute_node.edit(allocation_scope='close/forever')
self.tic()
self.assertEqual(self.compute_node.getMonitorScope(), "disabled")
alarm = self.portal.portal_alarms.slapos_crm_project_allocation_consistency
self._test_alarm_not_visited(alarm, self.compute_node,
"ComputeNode_checkProjectAllocationConsistencyState")
def test_ComputeNode_checkProjectAllocationConsistencyState_alarm_disabledMonitor(self):
self._makeComputeNode(self.addProject())
self.compute_node.edit(allocation_scope='open',
monitor_scope='disabled')
self.tic()
self.login()
alarm = self.portal.portal_alarms.slapos_crm_project_allocation_consistency
self._test_alarm_not_visited(alarm, self.compute_node,
"ComputeNode_checkProjectAllocationConsistencyState")
def test_ComputeNode_checkProjectAllocationConsistencyState_alarm_invalidated(self):
self._makeComputeNode(self.addProject())
self.compute_node.invalidate()
self.tic()
self.login()
alarm = self.portal.portal_alarms.slapos_crm_project_allocation_consistency
self._test_alarm_not_visited(alarm, self.compute_node,
"ComputeNode_checkProjectAllocationConsistencyState")
################################################################################
class TestSlapOSCrmMonitoringCheckComputeNodeProjectState(TestSlapOSCrmMonitoringMixin): class TestSlapOSCrmMonitoringCheckComputeNodeProjectState(TestSlapOSCrmMonitoringMixin):
launch_caucase = 1 launch_caucase = 1
......
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