Saltstack Official Apt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.6KB

  1. # frozen_string_literal: true
  2. control 'Apt preferences' do
  3. title 'should be configured'
  4. describe file('/etc/apt/preferences') do
  5. it { should exist }
  6. its(:size) { should eq 0 }
  7. end
  8. describe file('/etc/apt/preferences.d') do
  9. it { should be_directory }
  10. it { should be_owned_by 'root' }
  11. it { should be_grouped_into 'root' }
  12. its('mode') { should cmp '0755' }
  13. end
  14. describe file('/etc/apt/preferences.d/00-rspamd') do
  15. it { should exist }
  16. it { should be_owned_by 'root' }
  17. it { should be_grouped_into 'root' }
  18. its('mode') { should cmp '0644' }
  19. its(:content) do
  20. should match(
  21. "Package: rspamd\nPin: origin rspamd.com\nPin-Priority: 650\n"
  22. )
  23. end
  24. end
  25. describe file('/etc/apt/preferences.d/01-all') do
  26. it { should exist }
  27. it { should be_owned_by 'root' }
  28. it { should be_grouped_into 'root' }
  29. its('mode') { should cmp '0644' }
  30. its(:content) do
  31. should match(
  32. "Package: *\nPin: release stable\nPin-Priority: 610\n"
  33. )
  34. end
  35. end
  36. describe file('/etc/apt/preferences.d/02-all') do
  37. it { should exist }
  38. it { should be_owned_by 'root' }
  39. it { should be_grouped_into 'root' }
  40. its('mode') { should cmp '0644' }
  41. its(:content) do
  42. should match(
  43. "Package: *\nPin: release testing\nPin-Priority: 600\n"
  44. )
  45. end
  46. end
  47. describe file('/etc/apt/preferences.d/03-all') do
  48. it { should exist }
  49. it { should be_owned_by 'root' }
  50. it { should be_grouped_into 'root' }
  51. its('mode') { should cmp '0644' }
  52. its(:content) do
  53. should match(
  54. "Package: *\nPin: release unstable\nPin-Priority: 50\n"
  55. )
  56. end
  57. end
  58. end