backports_spec.rb 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. require 'spec_helper'
  2. describe 'apt::backports', :type => :class do
  3. describe 'when asigning a custom priority to backports' do
  4. let :facts do
  5. {
  6. 'lsbdistcodename' => 'Karmic',
  7. 'lsbdistid' => 'Ubuntu',
  8. 'osfamily' => 'Debian'
  9. }
  10. end
  11. context 'integer priority' do
  12. let :params do { :pin_priority => 500 } end
  13. it { should contain_apt__source('backports').with({
  14. 'location' => 'http://old-releases.ubuntu.com/ubuntu',
  15. 'release' => 'karmic-backports',
  16. 'repos' => 'main universe multiverse restricted',
  17. 'key' => '437D05B5',
  18. 'key_server' => 'pgp.mit.edu',
  19. 'pin' => 500,
  20. })
  21. }
  22. end
  23. context 'invalid priority' do
  24. let :params do { :pin_priority => 'banana' } end
  25. it 'should fail' do
  26. expect { subject }.to raise_error(/must be an integer/)
  27. end
  28. end
  29. end
  30. describe 'when turning on backports for ubuntu karmic' do
  31. let :facts do
  32. {
  33. 'lsbdistcodename' => 'Karmic',
  34. 'lsbdistid' => 'Ubuntu',
  35. 'osfamily' => 'Debian'
  36. }
  37. end
  38. it { should contain_apt__source('backports').with({
  39. 'location' => 'http://old-releases.ubuntu.com/ubuntu',
  40. 'release' => 'karmic-backports',
  41. 'repos' => 'main universe multiverse restricted',
  42. 'key' => '437D05B5',
  43. 'key_server' => 'pgp.mit.edu',
  44. 'pin' => 200,
  45. })
  46. }
  47. end
  48. describe "when turning on backports for debian squeeze" do
  49. let :facts do
  50. {
  51. 'lsbdistcodename' => 'Squeeze',
  52. 'lsbdistid' => 'Debian',
  53. 'osfamily' => 'Debian'
  54. }
  55. end
  56. it { should contain_apt__source('backports').with({
  57. 'location' => 'http://backports.debian.org/debian-backports',
  58. 'release' => 'squeeze-backports',
  59. 'repos' => 'main contrib non-free',
  60. 'key' => '46925553',
  61. 'key_server' => 'pgp.mit.edu',
  62. 'pin' => 200,
  63. })
  64. }
  65. end
  66. describe "when turning on backports for linux mint debian edition" do
  67. let :facts do
  68. {
  69. 'lsbdistcodename' => 'debian',
  70. 'lsbdistid' => 'LinuxMint',
  71. 'osfamily' => 'Debian'
  72. }
  73. end
  74. it { should contain_apt__source('backports').with({
  75. 'location' => 'http://ftp.debian.org/debian/',
  76. 'release' => 'wheezy-backports',
  77. 'repos' => 'main contrib non-free',
  78. 'key' => '46925553',
  79. 'key_server' => 'pgp.mit.edu',
  80. 'pin' => 200,
  81. })
  82. }
  83. end
  84. describe "when turning on backports for linux mint 17 (ubuntu-based)" do
  85. let :facts do
  86. {
  87. 'lsbdistcodename' => 'qiana',
  88. 'lsbdistid' => 'LinuxMint',
  89. 'osfamily' => 'Debian'
  90. }
  91. end
  92. it { should contain_apt__source('backports').with({
  93. 'location' => 'http://us.archive.ubuntu.com/ubuntu',
  94. 'release' => 'trusty-backports',
  95. 'repos' => 'main universe multiverse restricted',
  96. 'key' => '437D05B5',
  97. 'key_server' => 'pgp.mit.edu',
  98. 'pin' => 200,
  99. })
  100. }
  101. end
  102. describe "when turning on backports for debian squeeze but using your own mirror" do
  103. let :facts do
  104. {
  105. 'lsbdistcodename' => 'Squeeze',
  106. 'lsbdistid' => 'Debian',
  107. 'osfamily' => 'Debian'
  108. }
  109. end
  110. let :location do
  111. 'http://mirrors.example.com/debian-backports'
  112. end
  113. let :params do
  114. { 'location' => location }
  115. end
  116. it { should contain_apt__source('backports').with({
  117. 'location' => location,
  118. 'release' => 'squeeze-backports',
  119. 'repos' => 'main contrib non-free',
  120. 'key' => '46925553',
  121. 'key_server' => 'pgp.mit.edu',
  122. 'pin' => 200,
  123. })
  124. }
  125. end
  126. end