apt_spec.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. require 'spec_helper_acceptance'
  2. describe 'apt class' do
  3. context 'reset' do
  4. it 'fixes the sources.list' do
  5. shell('cp /etc/apt/sources.list /tmp')
  6. end
  7. end
  8. context 'all the things' do
  9. it 'should work with no errors' do
  10. pp = <<-EOS
  11. class { 'apt':
  12. always_apt_update => true,
  13. purge_sources_list => true,
  14. purge_sources_list_d => true,
  15. purge_preferences => true,
  16. purge_preferences_d => true,
  17. update_timeout => '400',
  18. update_tries => '3',
  19. sources => {
  20. 'puppetlabs' => {
  21. 'ensure' => present,
  22. 'location' => 'http://apt.puppetlabs.com',
  23. 'repos' => 'main',
  24. 'key' => '4BD6EC30',
  25. 'key_server' => 'pgp.mit.edu',
  26. }
  27. },
  28. }
  29. EOS
  30. apply_manifest(pp, :catch_failures => true)
  31. apply_manifest(pp, :catch_failures => true)
  32. end
  33. it 'should still work' do
  34. shell('apt-get update')
  35. shell('apt-get -y --force-yes upgrade')
  36. end
  37. end
  38. context 'reset' do
  39. it 'fixes the sources.list' do
  40. shell('cp /tmp/sources.list /etc/apt')
  41. end
  42. end
  43. end