-
Notifications
You must be signed in to change notification settings - Fork 89
/
parent_close_workflow_spec.rb
55 lines (45 loc) · 1.43 KB
/
parent_close_workflow_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'workflows/parent_close_workflow'
describe ParentCloseWorkflow, :integration do
subject { described_class }
it 'SlowChildWorkflow terminates if parent_close_policy is TERMINATE' do
workflow_id = 'parent_close_test_wf-' + SecureRandom.uuid
child_workflow_id = 'slow_child_test_wf-' + SecureRandom.uuid
run_id = Temporal.start_workflow(
ParentCloseWorkflow,
child_workflow_id,
:terminate,
options: { workflow_id: workflow_id }
)
Temporal.await_workflow_result(
ParentCloseWorkflow,
workflow_id: workflow_id,
run_id: run_id,
)
expect do
Temporal.await_workflow_result(
SlowChildWorkflow,
workflow_id: child_workflow_id,
)
end.to raise_error(Temporal::WorkflowTerminated)
end
it 'SlowChildWorkflow completes if parent_close_policy is ABANDON' do
workflow_id = 'parent_close_test_wf-' + SecureRandom.uuid
child_workflow_id = 'slow_child_test_wf-' + SecureRandom.uuid
run_id = Temporal.start_workflow(
ParentCloseWorkflow,
child_workflow_id,
:abandon,
options: { workflow_id: workflow_id }
)
Temporal.await_workflow_result(
ParentCloseWorkflow,
workflow_id: workflow_id,
run_id: run_id,
)
result = Temporal.await_workflow_result(
SlowChildWorkflow,
workflow_id: child_workflow_id,
)
expect(result).to eq({ parent_workflow_id: workflow_id })
end
end