Skip to content

Commit 96b7739

Browse files
committed
Fix multiple dependencies not being stored properly
1 parent 4c5e39e commit 96b7739

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/dynflow/persistence_adapters/sequel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def save_delayed_plan(execution_plan_id, value)
196196
end
197197

198198
def chain_execution_plan(first, second)
199-
save :execution_plan_dependency, { execution_plan_uuid: second }, { execution_plan_uuid: second, blocked_by_uuid: first }, with_data: false
199+
save :execution_plan_dependency, {}, { execution_plan_uuid: second, blocked_by_uuid: first }, with_data: false
200200
end
201201

202202
def load_step(execution_plan_id, step_id)

test/future_execution_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ module FutureExecutionTest
218218
it 'chains onto multiple execution plans and waits for all to finish' do
219219
plan1 = world.plan(Support::DummyExample::Dummy)
220220
plan2 = world.plan(Support::DummyExample::Dummy)
221-
plan3 = world.chain([plan1.id, plan2.id], Support::DummyExample::Dummy)
221+
plan3 = world.chain([plan2.id, plan1.id], Support::DummyExample::Dummy)
222222

223223
# Execute and complete plan1
224224
Concurrent::Promises.resolvable_future.tap do |promise|

test/persistence_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,17 @@ def self.it_acts_as_persistence_adapter
382382
_(plans.first[:execution_plan_uuid]).must_equal 'plan1'
383383
end
384384

385+
it 'properly stored execution plan dependencies' do
386+
start_time = Time.now.utc
387+
prepare_and_save_plans
388+
389+
adapter.save_delayed_plan('plan1', :execution_plan_uuid => 'plan1', :frozen => false)
390+
adapter.chain_execution_plan('plan2', 'plan1')
391+
adapter.chain_execution_plan('plan3', 'plan1')
392+
dependencies = adapter.find_execution_plan_dependencies('plan1')
393+
_(dependencies.to_set).must_equal ['plan2', 'plan3'].to_set
394+
end
395+
385396
it 'does not find blocked plans' do
386397
start_time = Time.now.utc
387398
prepare_and_save_plans

0 commit comments

Comments
 (0)