Commit 97edd25d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Test, Ensure computer is indexed before call alarm

  Otherwise it will lead to random failures caused by some race conditions
parent 5328b1c0
...@@ -765,6 +765,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -765,6 +765,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope='open/public') self.computer.edit(allocation_scope='open/public')
self.tic()
self._simulateComputer_checkState() self._simulateComputer_checkState()
try: try:
...@@ -779,6 +780,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -779,6 +780,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_check_friend_computer_state(self): def test_alarm_check_friend_computer_state(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope='open/friend') self.computer.edit(allocation_scope='open/friend')
self.tic()
self._simulateComputer_checkState() self._simulateComputer_checkState()
...@@ -795,6 +797,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -795,6 +797,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def _test_alarm_check_computer_state_not_selected(self, allocation_scope): def _test_alarm_check_computer_state_not_selected(self, allocation_scope):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope=allocation_scope) self.computer.edit(allocation_scope=allocation_scope)
self.tic()
self._simulateComputer_checkState() self._simulateComputer_checkState()
...@@ -865,6 +868,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -865,6 +868,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_not_allowed_allocation_scope_OpenPublic(self): def test_alarm_not_allowed_allocation_scope_OpenPublic(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope = 'open/public') self.computer.edit(allocation_scope = 'open/public')
self.tic()
self._simulateComputer_checkAndUpdateAllocationScope() self._simulateComputer_checkAndUpdateAllocationScope()
...@@ -880,6 +884,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -880,6 +884,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_not_allowed_allocation_scope_OpenFriend(self): def test_alarm_not_allowed_allocation_scope_OpenFriend(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope = 'open/friend') self.computer.edit(allocation_scope = 'open/friend')
self.tic()
self._simulateComputer_checkAndUpdateAllocationScope() self._simulateComputer_checkAndUpdateAllocationScope()
...@@ -895,6 +900,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -895,6 +900,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_not_allowed_allocationScope_open_personal(self): def test_alarm_not_allowed_allocationScope_open_personal(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope = 'open/personal') self.computer.edit(allocation_scope = 'open/personal')
self.tic()
self._simulateComputer_checkAndUpdateAllocationScope() self._simulateComputer_checkAndUpdateAllocationScope()
...@@ -951,6 +957,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -951,6 +957,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def getCreationDate(self): def getCreationDate(self):
return DateTime() - 31 return DateTime() - 31
self.computer.edit(allocation_scope = 'open/personal') self.computer.edit(allocation_scope = 'open/personal')
self.tic()
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
...@@ -974,6 +981,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -974,6 +981,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def getCreationDate(self): def getCreationDate(self):
return DateTime() - 28 return DateTime() - 28
self.computer.edit(allocation_scope = 'open/personal') self.computer.edit(allocation_scope = 'open/personal')
self.tic()
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
...@@ -993,7 +1001,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -993,7 +1001,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_allowed_allocation_scope_OpenPersonal_already_closed(self): def test_alarm_allowed_allocation_scope_OpenPersonal_already_closed(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope = 'open/oudated') self.computer.edit(allocation_scope = 'close/outdated')
self.tic()
self._simulateComputer_checkAndUpdatePersonalAllocationScope() self._simulateComputer_checkAndUpdatePersonalAllocationScope()
......
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