Skip to content

Commit

Permalink
Add retry to ensure service is reachable
Browse files Browse the repository at this point in the history
Also modify Gemfile for ruby version issue
  • Loading branch information
Richard Pijnenburg committed Oct 19, 2015
1 parent 3643e70 commit b9c7124
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'https://rubygems.org'

gem 'test-kitchen'
gem "kitchen-docker"
gem "kitchen-docker", '< 2.2.0'
gem 'kitchen-ansible'
3 changes: 3 additions & 0 deletions test/integration/standard/serverspec/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'rspec-retry'
11 changes: 8 additions & 3 deletions test/integration/standard/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
it { should be_file }
end

describe command('curl localhost:9200/_nodes/?plugin | grep kopf') do
its(:stdout) { should match /kopf/ }
its(:exit_status) { should eq 0 }
describe 'plugin' do

it 'should be reported as existing', :retry => 3, :retry_wait => 10 do
command = command('curl localhost:9200/_nodes/?plugin | grep kopf')
expect(command.stdout).to match(/kopf/)
expect(command.exit_status).to eq(0)
end

end

end
Expand Down
9 changes: 9 additions & 0 deletions test/integration/standard/serverspec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
require 'serverspec'
set :backend, :exec

require 'rspec/retry'

RSpec.configure do |config|
# show retry status in spec process
config.verbose_retry = true
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
end

0 comments on commit b9c7124

Please sign in to comment.