backports_spec.rb 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. })
  20. }
  21. it { should contain_apt__pin('backports').with({
  22. 'release' => 'karmic-backports',
  23. 'priority' => 500,
  24. })
  25. }
  26. end
  27. context 'invalid priority' do
  28. let :params do { :pin_priority => 'banana' } end
  29. it 'should fail' do
  30. expect { subject }.to raise_error(/must be an integer/)
  31. end
  32. end
  33. end
  34. describe 'when turning on backports for ubuntu karmic' do
  35. let :facts do
  36. {
  37. 'lsbdistcodename' => 'Karmic',
  38. 'lsbdistid' => 'Ubuntu',
  39. 'osfamily' => 'Debian'
  40. }
  41. end
  42. it { should contain_apt__source('backports').with({
  43. 'location' => 'http://old-releases.ubuntu.com/ubuntu',
  44. 'release' => 'karmic-backports',
  45. 'repos' => 'main universe multiverse restricted',
  46. 'key' => '437D05B5',
  47. 'key_server' => 'pgp.mit.edu',
  48. })
  49. }
  50. it { should contain_apt__pin('backports').with({
  51. 'release' => 'karmic-backports',
  52. 'priority' => 200,
  53. })
  54. }
  55. end
  56. describe "when turning on backports for debian squeeze" do
  57. let :facts do
  58. {
  59. 'lsbdistcodename' => 'Squeeze',
  60. 'lsbdistid' => 'Debian',
  61. 'osfamily' => 'Debian'
  62. }
  63. end
  64. it { should contain_apt__source('backports').with({
  65. 'location' => 'http://backports.debian.org/debian-backports',
  66. 'release' => 'squeeze-backports',
  67. 'repos' => 'main contrib non-free',
  68. 'key' => '46925553',
  69. 'key_server' => 'pgp.mit.edu',
  70. })
  71. }
  72. it { should contain_apt__pin('backports').with({
  73. 'release' => 'squeeze-backports',
  74. 'priority' => 200,
  75. })
  76. }
  77. end
  78. describe "when turning on backports for linux mint debian edition" do
  79. let :facts do
  80. {
  81. 'lsbdistcodename' => 'debian',
  82. 'lsbdistid' => 'LinuxMint',
  83. 'osfamily' => 'Debian'
  84. }
  85. end
  86. it { should contain_apt__source('backports').with({
  87. 'location' => 'http://ftp.debian.org/debian/',
  88. 'release' => 'wheezy-backports',
  89. 'repos' => 'main contrib non-free',
  90. 'key' => '46925553',
  91. 'key_server' => 'pgp.mit.edu',
  92. })
  93. }
  94. it { should contain_apt__pin('backports').with({
  95. 'release' => 'wheezy-backports',
  96. 'priority' => 200,
  97. })
  98. }
  99. end
  100. describe "when turning on backports for linux mint 17 (ubuntu-based)" do
  101. let :facts do
  102. {
  103. 'lsbdistcodename' => 'qiana',
  104. 'lsbdistid' => 'LinuxMint',
  105. 'osfamily' => 'Debian'
  106. }
  107. end
  108. it { should contain_apt__source('backports').with({
  109. 'location' => 'http://us.archive.ubuntu.com/ubuntu',
  110. 'release' => 'trusty-backports',
  111. 'repos' => 'main universe multiverse restricted',
  112. 'key' => '437D05B5',
  113. 'key_server' => 'pgp.mit.edu',
  114. })
  115. }
  116. it { should contain_apt__pin('backports').with({
  117. 'release' => 'trusty-backports',
  118. 'priority' => 200,
  119. })
  120. }
  121. end
  122. describe "when turning on backports for debian squeeze but using your own mirror" do
  123. let :facts do
  124. {
  125. 'lsbdistcodename' => 'Squeeze',
  126. 'lsbdistid' => 'Debian',
  127. 'osfamily' => 'Debian'
  128. }
  129. end
  130. let :location do
  131. 'http://mirrors.example.com/debian-backports'
  132. end
  133. let :params do
  134. { 'location' => location }
  135. end
  136. it { should contain_apt__source('backports').with({
  137. 'location' => location,
  138. 'release' => 'squeeze-backports',
  139. 'repos' => 'main contrib non-free',
  140. 'key' => '46925553',
  141. 'key_server' => 'pgp.mit.edu',
  142. })
  143. }
  144. it { should contain_apt__pin('backports').with({
  145. 'release' => 'squeeze-backports',
  146. 'priority' => 200,
  147. })
  148. }
  149. end
  150. end