mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Update to safe navigation exit code skip search. (#3541)
Signed-off-by: Jared Quick <jquick@chef.io>
This commit is contained in:
parent
955d444b95
commit
d40dc7c41f
2 changed files with 7 additions and 1 deletions
|
@ -84,7 +84,7 @@ module Inspec
|
|||
def exit_code
|
||||
return @rspec_exit_code if @formatter.results.empty?
|
||||
stats = @formatter.results[:statistics][:controls]
|
||||
skipped = @formatter.results[:profiles].first[:status] == 'skipped'
|
||||
skipped = @formatter.results&.fetch(:profiles, nil)&.first&.fetch(:status, nil) == 'skipped'
|
||||
if stats[:failed][:total] == 0 && stats[:skipped][:total] == 0 && !skipped
|
||||
0
|
||||
elsif stats[:failed][:total] > 0
|
||||
|
|
|
@ -36,6 +36,12 @@ describe Inspec::Runner do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'testing runner.run exit codes' do
|
||||
it 'returns proper exit code when no profile is added' do
|
||||
runner.run.must_equal 0
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when backend caching is enabled' do
|
||||
it 'returns a backend with caching' do
|
||||
opts = { command_runner: :generic, backend_cache: true }
|
||||
|
|
Loading…
Reference in a new issue