Commit dfad12ed authored by Douwe Maan's avatar Douwe Maan

Merge branch 'backport-system-check-fix' into 'master'

Make the SimpleExecutor rescue exceptions in the executing Checks

See merge request !12487
parents 585e6aa5 758e0200
......@@ -75,6 +75,8 @@ module SystemCheck
check.show_error
end
rescue StandardError => e
$stdout.puts "Exception: #{e.message}".color(:red)
end
private
......
......@@ -75,6 +75,24 @@ describe SystemCheck::SimpleExecutor, lib: true do
end
end
class BugousCheck < SystemCheck::BaseCheck
CustomError = Class.new(StandardError)
set_name 'my bugous check'
def check?
raise CustomError, 'omg'
end
end
before do
@rainbow = Rainbow.enabled
Rainbow.enabled = false
end
after do
Rainbow.enabled = @rainbow
end
describe '#component' do
it 'returns stored component name' do
expect(subject.component).to eq('Test')
......@@ -219,5 +237,11 @@ describe SystemCheck::SimpleExecutor, lib: true do
end
end
end
context 'when there is an exception' do
it 'rescues the exception' do
expect{ subject.run_check(BugousCheck) }.not_to raise_exception
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment