Fix backtrace filtering for producer own code
Using /producer-\w+ as pattern is incorrect, we have no guarantee that the canonical repository or gem name will be included in the install path. Just use /producer pattern to match lib files or executables.
This commit is contained in:
parent
c9971d7ca0
commit
dbe7fea204
@ -8,6 +8,6 @@ Feature: CLI debug option
|
|||||||
Scenario: does not exclude anything from backtrace
|
Scenario: does not exclude anything from backtrace
|
||||||
Given a recipe using a remote
|
Given a recipe using a remote
|
||||||
When I execute the recipe on unknown remote target with option -d
|
When I execute the recipe on unknown remote target with option -d
|
||||||
Then the output must contain "producer-core"
|
Then the output must contain "producer"
|
||||||
And the output must contain "net-ssh"
|
And the output must contain "net-ssh"
|
||||||
And the output must contain ruby lib directory
|
And the output must contain ruby lib directory
|
||||||
|
@ -2,7 +2,7 @@ module Producer
|
|||||||
module Core
|
module Core
|
||||||
class ErrorFormatter
|
class ErrorFormatter
|
||||||
FILTERS = [
|
FILTERS = [
|
||||||
/\/producer-\w+/,
|
/\/producer/,
|
||||||
Regexp.new(RbConfig::CONFIG['rubylibdir']),
|
Regexp.new(RbConfig::CONFIG['rubylibdir']),
|
||||||
/\/net-ssh/,
|
/\/net-ssh/,
|
||||||
/\/net-sftp/
|
/\/net-sftp/
|
||||||
|
@ -24,7 +24,7 @@ module Producer
|
|||||||
|
|
||||||
describe '#format' do
|
describe '#format' do
|
||||||
let(:rubylibdir) { RbConfig::CONFIG['rubylibdir'] }
|
let(:rubylibdir) { RbConfig::CONFIG['rubylibdir'] }
|
||||||
let(:bt) { %W[backtrace /producer-core /net-ssh #{rubylibdir}] }
|
let(:bt) { %W[backtrace /producer /net-ssh #{rubylibdir}] }
|
||||||
let(:exception) { RuntimeError.new('some exception').tap { |o| o.set_backtrace bt } }
|
let(:exception) { RuntimeError.new('some exception').tap { |o| o.set_backtrace bt } }
|
||||||
|
|
||||||
def exception_with_cause
|
def exception_with_cause
|
||||||
@ -43,7 +43,7 @@ module Producer
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'excludes producer code from the backtrace' do
|
it 'excludes producer code from the backtrace' do
|
||||||
expect(formatter.format exception).not_to include 'producer-core'
|
expect(formatter.format exception).not_to include 'producer'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'excludes net-ssh from the backtrace' do
|
it 'excludes net-ssh from the backtrace' do
|
||||||
@ -65,7 +65,7 @@ module Producer
|
|||||||
let(:debug) { true }
|
let(:debug) { true }
|
||||||
|
|
||||||
it 'does not filter the backtrace' do
|
it 'does not filter the backtrace' do
|
||||||
expect(formatter.format exception).to include 'producer-core'
|
expect(formatter.format exception).to include 'producer'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when exception has a cause' do
|
context 'when exception has a cause' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user