workflows: ignore missing previous mark in jump with timeouts (#42854)
This commit is contained in:
parent
aecfdde465
commit
db75dcc850
|
@ -2253,6 +2253,36 @@ def test_timeout_with_mark(two_pubs):
|
|||
assert formdata.workflow_data.get('_markers_stack') == [{'status_id': 'st1'}]
|
||||
|
||||
|
||||
def test_jump_missing_previous_mark(two_pubs):
|
||||
workflow = Workflow(name='jump-mark')
|
||||
st1 = workflow.add_status('Status1', 'st1')
|
||||
|
||||
jump = JumpWorkflowStatusItem()
|
||||
jump.id = '_jump'
|
||||
jump.by = ['_submitter', '_receiver']
|
||||
jump.status = '_previous'
|
||||
jump.timeout = 0.1
|
||||
st1.items.append(jump)
|
||||
jump.parent = st1
|
||||
|
||||
workflow.store()
|
||||
|
||||
formdef = FormDef()
|
||||
formdef.name = 'baz'
|
||||
formdef.fields = []
|
||||
formdef.workflow_id = workflow.id
|
||||
formdef.store()
|
||||
|
||||
formdata = formdef.data_class()()
|
||||
formdata.just_created()
|
||||
formdata.store()
|
||||
|
||||
time.sleep(0.3)
|
||||
LoggedError.wipe()
|
||||
_apply_timeouts(two_pubs)
|
||||
assert LoggedError.count() == 1
|
||||
|
||||
|
||||
def test_sms(pub, sms_mocking):
|
||||
pub.cfg['sms'] = {'mode': 'xxx'}
|
||||
formdef = FormDef()
|
||||
|
|
|
@ -569,9 +569,14 @@ class FormData(StorableObject):
|
|||
return self.formdef.workflow.get_status(status_id)
|
||||
|
||||
def jump_status(self, status_id):
|
||||
import pdb; pdb.set_trace()
|
||||
if status_id == '_previous':
|
||||
previous_status = self.pop_previous_marked_status()
|
||||
assert previous_status, 'failed to compute previous status'
|
||||
if not previous_status:
|
||||
from wcs.logged_errors import LoggedError
|
||||
summary = _('Failed to compute previous status')
|
||||
LoggedError.record(summary, formdata=self)
|
||||
return
|
||||
status_id = previous_status.id
|
||||
status = 'wf-%s' % status_id
|
||||
if not self.evolution:
|
||||
|
|
Loading…
Reference in New Issue