X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fforce_spec.rb;h=5f4dec3fc76487705b147c368a3563bf194da2e3;hb=a68eca58a658e432fbfffcd91862134082ac7dc0;hp=4f74ff01fd7a3b4a05aa418b1a5dc4941c27e24e;hpb=16e57d4e4525b83d865db71f3bba300c54467255;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/force_spec.rb b/spec/acceptance/force_spec.rb index 4f74ff0..5f4dec3 100644 --- a/spec/acceptance/force_spec.rb +++ b/spec/acceptance/force_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper_acceptance' -describe 'apt::force define' do +codename = fact('lsbdistcodename') + +describe 'apt::force define', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do context 'defaults' do it 'should work with no errors' do pp = <<-EOS @@ -8,6 +10,7 @@ describe 'apt::force define' do apt::force { 'vim': } EOS + shell('apt-get remove -y vim') apply_manifest(pp, :catch_failures => true) end @@ -16,4 +19,58 @@ describe 'apt::force define' do end end + context 'release' do + it 'should work with no errors' do + pp = <<-EOS + include apt + apt::force { 'vim': release => '#{codename}' } + EOS + + shell('apt-get remove -y vim') + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/apt-get -y -t #{codename} install vim/) + end + end + + describe package('vim') do + it { should be_installed } + end + end + + context 'version' do + it 'should work with no errors' do + pp = <<-EOS + include apt + apt::force { 'vim': version => '1.1.1' } + EOS + + shell('apt-get remove -y vim') + apply_manifest(pp, :catch_failures => false) do |r| + expect(r.stdout).to match(/apt-get -y install vim=1.1.1/) + end + end + + describe package('vim') do + it { should_not be_installed } + end + end + + context 'timeout' do + it 'should work with no errors' do + pp = <<-EOS + include apt + apt::force { 'ocaml': timeout => '1' } + EOS + + shell('apt-get clean') + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/Error: Command exceeded timeout/) + end + end + + describe package('ocaml') do + it { should_not be_installed } + end + end + end