Merge pull request #33 from electrical/testing_wait
Add retry to ensure service is reachable
This commit is contained in:
commit
a11d0950b3
4 changed files with 21 additions and 4 deletions
2
Gemfile
2
Gemfile
|
|
@ -1,5 +1,5 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'test-kitchen'
|
gem 'test-kitchen'
|
||||||
gem "kitchen-docker"
|
gem "kitchen-docker", '< 2.2.0'
|
||||||
gem 'kitchen-ansible'
|
gem 'kitchen-ansible'
|
||||||
|
|
|
||||||
3
test/integration/standard/serverspec/Gemfile
Normal file
3
test/integration/standard/serverspec/Gemfile
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'rspec-retry'
|
||||||
|
|
@ -18,9 +18,14 @@ context "basic tests" do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe command('curl localhost:9200/_nodes/?plugin | grep kopf') do
|
describe 'plugin' do
|
||||||
its(:stdout) { should match /kopf/ }
|
|
||||||
its(:exit_status) { should eq 0 }
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,11 @@
|
||||||
require 'serverspec'
|
require 'serverspec'
|
||||||
set :backend, :exec
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue