Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-3550: Handle optional waiting results #570

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/inferno/result_summarizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def initialize(results)
end

def summarize
return 'wait' if results.any? { |result| result.result == 'wait' }

return 'pass' if optional_results_passing_criteria_met?

prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string }
Expand Down
8 changes: 8 additions & 0 deletions spec/inferno/result_summarizer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
RSpec.describe Inferno::ResultSummarizer do
let(:passing_result) { repo_create(:result, result: 'pass') }
let(:failing_result) { repo_create(:result, result: 'fail') }
let(:waiting_result) { repo_create(:result, result: 'wait') }

context 'when all results are required' do
it 'returns the highest priority result' do
Expand All @@ -29,5 +30,12 @@

expect(result).to eq('pass')
end

it 'returns "wait" if an optional result is waiting' do
allow(waiting_result).to receive(:optional?).and_return(true)
result = described_class.new([passing_result, waiting_result]).summarize

expect(result).to eq('wait')
end
end
end
Loading