Test net-ssh error filtering

This commit is contained in:
Thibault Jouan 2015-04-03 17:51:00 +00:00
parent 2e06d7d944
commit b1879ea9f9
3 changed files with 15 additions and 1 deletions

View File

@ -18,3 +18,7 @@ Feature: CLI error reporting
Scenario: prepends recipe file path in the backtrace Scenario: prepends recipe file path in the backtrace
When I execute the recipe When I execute the recipe
Then the output must match /^\s+recipe\.rb \(recipe\)\n\s+recipe\.rb:/ Then the output must match /^\s+recipe\.rb \(recipe\)\n\s+recipe\.rb:/
Scenario: excludes net-ssh from backtrace
When I execute the recipe on unknown remote target
Then the output must not contain "net-ssh"

View File

@ -14,6 +14,10 @@ When /^I execute the recipe on remote target$/ do
run_simple 'producer recipe.rb -t some_host.test', false run_simple 'producer recipe.rb -t some_host.test', false
end end
When /^I execute the recipe on unknown remote target$/ do
run_simple 'producer recipe.rb -t #unknown_host.test', false
end
When /^I successfully execute the recipe$/ do When /^I successfully execute the recipe$/ do
step 'I execute the recipe' step 'I execute the recipe'
assert_exit_status 0 assert_exit_status 0

View File

@ -39,12 +39,18 @@ module Producer
end end
context 'filtering' do context 'filtering' do
before { exception.set_backtrace %w[back trace /producer-core/lib/] } let(:bt) { %w[back trace producer-core net-ssh net-sftp] }
before { exception.set_backtrace bt }
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-core'
end end
it 'excludes net-ssh from the backtrace' do
expect(formatter.format exception).not_to include 'net-ssh'
end
context 'when debug is enabled' do context 'when debug is enabled' do
let(:debug) { true } let(:debug) { true }