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

(CAT-2026) Update how pdk test unit --list detects an error #1388

Merged
merged 2 commits into from
Aug 29, 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
6 changes: 3 additions & 3 deletions lib/pdk/tests/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@
raise PDK::CLI::FatalError, format('Failed to find valid JSON in output from rspec: %{output}', output: output[:stdout]) unless rspec_json

if rspec_json['examples'].empty?
rspec_message = rspec_json['messages'][0]
return [] if rspec_message == 'No examples found.'
return [] if rspec_json['messages'][0] == 'No examples found.'
return [] if rspec_json['messages'].include?("\nAll examples were filtered out")

Check warning on line 250 in lib/pdk/tests/unit.rb

View check run for this annotation

Codecov / codecov/patch

lib/pdk/tests/unit.rb#L250

Added line #L250 was not covered by tests

raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_message)
raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_json['messages'])

Check warning on line 252 in lib/pdk/tests/unit.rb

View check run for this annotation

Codecov / codecov/patch

lib/pdk/tests/unit.rb#L252

Added line #L252 was not covered by tests
else
examples = []
rspec_json['examples'].each do |example|
Expand Down
8 changes: 3 additions & 5 deletions spec/acceptance/test_unit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@
require 'spec_helper'

RSpec.describe 'passing test' do
on_supported_os(:facterversion => '2.4.6').each do |os, facts|
context "On OS \#{os}" do
it 'should pass' do
expect(true).to eq(true)
end
context 'On OS' do
it 'should pass' do
expect(true).to eq(true)
end
end
end
Expand Down
Loading