Implement retry on tests which pull key from a key server which sometimes times out...
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / apt_spec.rb
index 86c93ffa87913540069653d707974f67282c011a..52415f5afaecb4e0cfe28fbe2af689c3ffad3f77 100644 (file)
@@ -1,5 +1,9 @@
 require 'spec_helper_acceptance'
 
+MAX_TIMEOUT_RETRY              = 3
+TIMEOUT_RETRY_WAIT             = 5
+TIMEOUT_ERROR_MATCHER    = /no valid OpenPGP data found/
+
 describe 'apt class' do
 
   context 'reset' do
@@ -42,8 +46,12 @@ describe 'apt class' do
       }
       EOS
 
+      #Apply the manifest (Retry if timeout error is received from key pool)
+      retry_on_error_matching(MAX_TIMEOUT_RETRY, TIMEOUT_RETRY_WAIT, TIMEOUT_ERROR_MATCHER) do
+        apply_manifest(pp, :catch_failures => true)
+      end
+
       apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
     end
     it 'should still work' do
       shell('apt-get update')