Skip to content

Commit

Permalink
Fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka authored and ofedoren committed Jan 19, 2024
1 parent ae01eef commit abbe071
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions test/process_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ProcessManagerTest
end
pm.stdin.add_data("10\n")
pm.run!
assert_equal '', pm.stderr.to_s
assert_equal pm.stdout.to_s.lines.map(&:chomp), %w[10 9 8 7 6 5 4 3 2 1 0]
end
end
Expand Down
17 changes: 6 additions & 11 deletions test/task_launcher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ class TaskLauncherTest < Minitest::Spec

class DummyDynflowAction < Dynflow::Action
def plan(input)
callback input
plan_self received_input: input
end

def callback(_input); end
end

describe TaskLauncher do
Expand All @@ -27,10 +25,8 @@ def callback(_input); end
let(:launcher_class) { Single }

it 'triggers an action' do
DummyDynflowAction.any_instance.expects(:callback).with do |arg|
Dynflow::Utils::IndifferentHash.new(arg) == expected_result
end
launcher.launch!(launcher_input)
plan = launcher.launch!(launcher_input).finished.value!
_(plan.entry_action.input[:received_input]).must_equal expected_result
end

it 'provides results' do
Expand All @@ -44,17 +40,16 @@ def callback(_input); end
let(:launcher_class) { Batch }

it 'triggers the actions' do
DummyDynflowAction.any_instance.expects(:callback).with do |arg|
arg == expected_result
end.twice

parent = launcher.launch!('foo' => launcher_input, 'bar' => launcher_input)
wait_until(iterations: 15, interval: 1) do
load_execution_plan(parent[:task_id]).state == :stopped
end
plan = load_execution_plan(parent[:task_id])
_(plan.result).must_equal :success
_(plan.sub_plans.count).must_equal 2
plan.sub_plans.each do |plan|
_(plan.entry_action.input[:received_input]).must_equal expected_result
end
end

it 'provides results' do
Expand Down

0 comments on commit abbe071

Please sign in to comment.