Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Ensure execute is called with RetryWithBackoff
Browse files Browse the repository at this point in the history
  • Loading branch information
mandrews committed Mar 20, 2016
1 parent 34a5377 commit bb35623
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/masamune/actions/execute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def initialize(delegate)
end
end if block_given?

command = Masamune::Commands::Shell.new(klass.new(self), {fail_fast: false}.merge(opts))
command = klass.new(self)
command = Masamune::Commands::RetryWithBackoff.new(command, opts)
command = Masamune::Commands::Shell.new(command, {fail_fast: false}.merge(opts))
opts.fetch(:interactive, false) ? command.replace(opts) : command.execute
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/masamune/actions/execute_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def after_execute
let(:instance) { klass.new }

describe '.execute' do
before do
expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, anything).once.and_call_original
end

context 'with a simple command' do
let(:command) { %w(echo ping) }
let(:options) { {fail_fast: true} }
Expand Down

0 comments on commit bb35623

Please sign in to comment.