X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fapt_spec.rb;h=df312a756041025184ffd2c8d21f5f0de5b7d601;hb=d7af638793b6f5b6c5af6562923fa9ee0b025e1d;hp=843dd0a83d4ed8cc7b5aa82196648ead7216c1e8;hpb=a09dcafb3253aaddc1c6a69a85afef1e35a7fea1;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/apt_spec.rb b/spec/acceptance/apt_spec.rb index 843dd0a..df312a7 100644 --- a/spec/acceptance/apt_spec.rb +++ b/spec/acceptance/apt_spec.rb @@ -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 @@ -11,11 +15,26 @@ describe 'apt class' do context 'all the things' do it 'should work with no errors' do pp = <<-EOS + if $::lsbdistcodename == 'lucid' { + $sources = undef + } else { + $sources = { + 'puppetlabs' => { + 'ensure' => present, + 'location' => 'http://apt.puppetlabs.com', + 'repos' => 'main', + 'key' => { + 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', + 'server' => 'hkps.pool.sks-keyservers.net', + }, + }, + } + } class { 'apt': update => { 'frequency' => 'always', - 'timeout' => '400', - 'tries' => '3', + 'timeout' => 400, + 'tries' => 3, }, purge => { 'sources.list' => true, @@ -23,23 +42,15 @@ describe 'apt class' do 'preferences' => true, 'preferences.d' => true, }, - sources => $::lsbdiscodename ? { - 'lucid' => undef, - default => { 'puppetlabs' => { - 'ensure' => present, - 'location' => 'http://apt.puppetlabs.com', - 'repos' => 'main', - 'key' => { - 'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30', - 'server' => 'pgp.mit.edu', - }, - }, - }, - }, + sources => $sources, } EOS - apply_manifest(pp, :catch_failures => true) + #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) end it 'should still work' do