diff --git a/features/cli/error_reporting.feature b/features/cli/error_reporting.feature index 50a8bb6..707189c 100644 --- a/features/cli/error_reporting.feature +++ b/features/cli/error_reporting.feature @@ -18,3 +18,7 @@ Feature: CLI error reporting Scenario: prepends recipe file path in the backtrace When I execute the recipe 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" diff --git a/features/steps/recipe_steps.rb b/features/steps/recipe_steps.rb index 1255925..d2960f1 100644 --- a/features/steps/recipe_steps.rb +++ b/features/steps/recipe_steps.rb @@ -14,6 +14,10 @@ When /^I execute the recipe on remote target$/ do run_simple 'producer recipe.rb -t some_host.test', false 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 step 'I execute the recipe' assert_exit_status 0 diff --git a/spec/producer/core/error_formatter_spec.rb b/spec/producer/core/error_formatter_spec.rb index e833c30..268c61c 100644 --- a/spec/producer/core/error_formatter_spec.rb +++ b/spec/producer/core/error_formatter_spec.rb @@ -39,12 +39,18 @@ module Producer end 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 expect(formatter.format exception).not_to include 'producer-core' 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 let(:debug) { true }