aws-flow 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/aws-flow.gemspec +1 -0
- data/lib/aws/decider/activity.rb +8 -6
- data/lib/aws/decider/async_decider.rb +1 -0
- data/lib/aws/decider/async_retrying_executor.rb +3 -3
- data/lib/aws/decider/decider.rb +16 -14
- data/lib/aws/decider/executor.rb +35 -22
- data/lib/aws/decider/flow_defaults.rb +28 -14
- data/lib/aws/decider/generic_client.rb +3 -4
- data/lib/aws/decider/options.rb +91 -117
- data/lib/aws/decider/state_machines.rb +1 -0
- data/lib/aws/decider/utilities.rb +15 -0
- data/lib/aws/decider/version.rb +1 -1
- data/lib/aws/decider/worker.rb +14 -8
- data/lib/aws/decider/workflow_client.rb +16 -11
- data/lib/aws/runner.rb +43 -39
- data/spec/aws/decider/integration/activity_spec.rb +345 -0
- data/spec/aws/{integration → decider/integration}/integration_spec.rb +818 -1183
- data/spec/aws/decider/integration/setup.rb +3 -0
- data/spec/aws/decider/unit/activity_spec.rb +233 -0
- data/spec/aws/decider/unit/async_retrying_executor_spec.rb +131 -0
- data/spec/aws/{unit → decider/unit}/decider_spec.rb +171 -718
- data/spec/aws/decider/unit/executor_spec.rb +123 -0
- data/spec/aws/decider/unit/flow_defaults_spec.rb +62 -0
- data/spec/aws/decider/unit/misc_spec.rb +101 -0
- data/spec/aws/decider/unit/options_spec.rb +289 -0
- data/spec/aws/decider/unit/retry_spec.rb +217 -0
- data/spec/aws/{unit → decider/unit}/rubyflow.rb +0 -0
- data/spec/aws/decider/unit/setup.rb +3 -0
- data/spec/aws/decider/unit/worker_spec.rb +325 -0
- data/spec/aws/decider/unit/workflow_client_spec.rb +83 -0
- data/spec/aws/{unit → flow}/async_backtrace_spec.rb +0 -0
- data/spec/aws/{unit → flow}/async_scope_spec.rb +0 -0
- data/spec/aws/{unit → flow}/begin_rescue_ensure_spec.rb +1 -0
- data/spec/aws/{unit → flow}/external_task_spec.rb +0 -0
- data/spec/aws/{unit → flow}/factories.rb +0 -0
- data/spec/aws/{unit → flow}/fiber_condition_variable_spec.rb +0 -0
- data/spec/aws/{unit → flow}/fiber_spec.rb +0 -0
- data/spec/aws/{unit → flow}/flow_spec.rb +0 -0
- data/spec/aws/{unit → flow}/future_spec.rb +0 -0
- data/spec/aws/{unit → flow}/simple_dfa_spec.rb +0 -0
- data/spec/aws/{integration → runner/integration}/runner_integration_spec.rb +16 -43
- data/spec/aws/{unit → runner/unit}/runner_unit_spec.rb +18 -18
- data/spec/spec_helper.rb +264 -2
- metadata +37 -28
- data/spec/aws/unit/executor_spec.rb +0 -49
- data/spec/aws/unit/options_spec.rb +0 -293
- data/spec/aws/unit/preinclude_tests.rb +0 -149
@@ -1,149 +0,0 @@
|
|
1
|
-
|
2
|
-
describe "will test a patch that makes sure with_retry and decision_context can be called without importing AWS::Flow module" do
|
3
|
-
before(:all) do
|
4
|
-
class FakeDomain
|
5
|
-
def initialize(workflow_type_object)
|
6
|
-
@workflow_type_object = workflow_type_object
|
7
|
-
end
|
8
|
-
def page; FakePage.new(@workflow_type_object); end
|
9
|
-
def workflow_executions; FakeWorkflowExecutionCollecton.new; end
|
10
|
-
def name; "fake_domain"; end
|
11
|
-
end
|
12
|
-
|
13
|
-
class FakeWorkflowExecutionCollecton
|
14
|
-
def at(workflow_id, run_id); "Workflow_execution"; end
|
15
|
-
end
|
16
|
-
|
17
|
-
# A fake service client used to mock out calls to the Simple Workflow Service
|
18
|
-
class FakeServiceClient
|
19
|
-
attr_accessor :trace
|
20
|
-
def respond_decision_task_completed(task_completed_request)
|
21
|
-
@trace ||= []
|
22
|
-
@trace << task_completed_request
|
23
|
-
end
|
24
|
-
def start_workflow_execution(options)
|
25
|
-
@trace ||= []
|
26
|
-
@trace << options
|
27
|
-
{"runId" => "blah"}
|
28
|
-
end
|
29
|
-
def register_workflow_type(options)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class SynchronousWorkflowWorker < AWS::Flow::WorkflowWorker
|
34
|
-
def start
|
35
|
-
poller = SynchronousWorkflowTaskPoller.new(@service, nil, AWS::Flow::DecisionTaskHandler.new(@workflow_definition_map), @task_list)
|
36
|
-
poller.poll_and_process_single_task
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class FakeWorkflowType < AWS::Flow::WorkflowType
|
41
|
-
attr_accessor :domain, :name, :version
|
42
|
-
def initialize(domain, name, version)
|
43
|
-
@domain = domain
|
44
|
-
@name = name
|
45
|
-
@version = version
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class TestHistoryWrapper
|
50
|
-
def initialize(workflow_type, events)
|
51
|
-
@workflow_type = workflow_type
|
52
|
-
@events = events
|
53
|
-
end
|
54
|
-
def workflow_execution
|
55
|
-
FakeWorkflowExecution.new
|
56
|
-
end
|
57
|
-
def task_token
|
58
|
-
"1"
|
59
|
-
end
|
60
|
-
def previous_started_event_id
|
61
|
-
1
|
62
|
-
end
|
63
|
-
attr_reader :events, :workflow_type
|
64
|
-
end
|
65
|
-
|
66
|
-
class FakeWorkflowExecution
|
67
|
-
attr_accessor :run_id, :workflow_id, :task_list
|
68
|
-
def run_id
|
69
|
-
"1"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class TestHistoryEvent < AWS::SimpleWorkflow::HistoryEvent
|
74
|
-
def initialize(event_type, event_id, attributes)
|
75
|
-
@event_type = event_type
|
76
|
-
@attributes = attributes
|
77
|
-
@event_id = event_id
|
78
|
-
@created_at = Time.now
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
class SynchronousWorkflowTaskPoller < AWS::Flow::WorkflowTaskPoller
|
83
|
-
def get_decision_task
|
84
|
-
workflow_type = FakeWorkflowType.new(nil, "TestWorkflow.entry_point", "1")
|
85
|
-
TestHistoryWrapper.new(workflow_type,
|
86
|
-
[TestHistoryEvent.new("WorkflowExecutionStarted", 1, {:parent_initiated_event_id=>0, :child_policy=>:request_cancel, :execution_start_to_close_timeout=>3600, :task_start_to_close_timeout=>5, :workflow_type=> workflow_type, :task_list=>"TestWorkflow_tasklist"}),
|
87
|
-
TestHistoryEvent.new("DecisionTaskScheduled", 2, {:parent_initiated_event_id=>0, :child_policy=>:request_cancel, :execution_start_to_close_timeout=>3600, :task_start_to_close_timeout=>5, :workflow_type=> workflow_type, :task_list=>"TestWorkflow_tastlist"}),
|
88
|
-
TestHistoryEvent.new("DecisionTaskStarted", 3, {:scheduled_event_id=>2, :identity=>"some_identity"}),
|
89
|
-
])
|
90
|
-
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
it "makes sure that with_retry can be called without including AWS::Flow" do
|
96
|
-
|
97
|
-
class TestWorkflow
|
98
|
-
extend AWS::Flow::Workflows
|
99
|
-
workflow (:entry_point) { {:version => "1"} }
|
100
|
-
|
101
|
-
def entry_point
|
102
|
-
AWS::Flow::with_retry do
|
103
|
-
return "This is the entry point"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
workflow_type_object = double("workflow_type", :name => "TestWorkflow.entry_point", :start_execution => "" )
|
109
|
-
domain = FakeDomain.new(workflow_type_object)
|
110
|
-
swf_client = FakeServiceClient.new
|
111
|
-
task_list = "TestWorkflow_tasklist"
|
112
|
-
|
113
|
-
workflow_worker = SynchronousWorkflowWorker.new(swf_client, domain, task_list)
|
114
|
-
workflow_worker.add_workflow_implementation(TestWorkflow)
|
115
|
-
|
116
|
-
workflow_client = AWS::Flow::WorkflowClient.new(swf_client, domain, TestWorkflow, AWS::Flow::StartWorkflowOptions.new)
|
117
|
-
workflow_client.start_execution
|
118
|
-
|
119
|
-
workflow_worker.start
|
120
|
-
end
|
121
|
-
|
122
|
-
it "makes sure that decision_context can be called without including AWS::Flow" do
|
123
|
-
|
124
|
-
class TestWorkflow
|
125
|
-
extend AWS::Flow::Workflows
|
126
|
-
workflow (:entry_point) { {:version => "1"} }
|
127
|
-
|
128
|
-
def entry_point
|
129
|
-
return AWS::Flow::decision_context.workflow_clock.current_time
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
workflow_type_object = double("workflow_type", :name => "TestWorkflow.entry_point", :start_execution => "" )
|
134
|
-
domain = FakeDomain.new(workflow_type_object)
|
135
|
-
swf_client = FakeServiceClient.new
|
136
|
-
task_list = "TestWorkflow_tasklist"
|
137
|
-
|
138
|
-
workflow_worker = SynchronousWorkflowWorker.new(swf_client, domain, task_list)
|
139
|
-
workflow_worker.add_workflow_implementation(TestWorkflow)
|
140
|
-
|
141
|
-
workflow_client = AWS::Flow::WorkflowClient.new(swf_client, domain, TestWorkflow, AWS::Flow::StartWorkflowOptions.new)
|
142
|
-
workflow_client.start_execution
|
143
|
-
|
144
|
-
workflow_worker.start
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
|