From b9c712426530848ae54adeeffa66d9ff15e0f1f7 Mon Sep 17 00:00:00 2001 From: Richard Pijnenburg Date: Mon, 19 Oct 2015 12:44:09 +0200 Subject: [PATCH] Add retry to ensure service is reachable Also modify Gemfile for ruby version issue --- Gemfile | 2 +- test/integration/standard/serverspec/Gemfile | 3 +++ test/integration/standard/serverspec/default_spec.rb | 11 ++++++++--- test/integration/standard/serverspec/spec_helper.rb | 9 +++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 test/integration/standard/serverspec/Gemfile diff --git a/Gemfile b/Gemfile index a6d769123c811..460bf04545ebf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' gem 'test-kitchen' -gem "kitchen-docker" +gem "kitchen-docker", '< 2.2.0' gem 'kitchen-ansible' diff --git a/test/integration/standard/serverspec/Gemfile b/test/integration/standard/serverspec/Gemfile new file mode 100644 index 0000000000000..e6aafc0bcc8c4 --- /dev/null +++ b/test/integration/standard/serverspec/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'rspec-retry' diff --git a/test/integration/standard/serverspec/default_spec.rb b/test/integration/standard/serverspec/default_spec.rb index c067acb58c7bc..115a81a6d216c 100644 --- a/test/integration/standard/serverspec/default_spec.rb +++ b/test/integration/standard/serverspec/default_spec.rb @@ -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 diff --git a/test/integration/standard/serverspec/spec_helper.rb b/test/integration/standard/serverspec/spec_helper.rb index 590c2fa95fe6c..5bef120b80f69 100644 --- a/test/integration/standard/serverspec/spec_helper.rb +++ b/test/integration/standard/serverspec/spec_helper.rb @@ -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