Saltstack Official Logrotate Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

64 lines
1.3KB

  1. # frozen_string_literal: true
  2. title 'Test logrotate installation'
  3. control 'logrotate-pkg.pkg.installed' do
  4. title 'The required package should be installed'
  5. pkg =
  6. case platform[:family]
  7. when 'redhat', 'fedora'
  8. 'cronie'
  9. else
  10. 'logrotate'
  11. end
  12. describe package(pkg) do
  13. it { should be_installed }
  14. end
  15. end
  16. control 'logrotate-config.file.managed' do
  17. title 'Verify the configuration file'
  18. describe file('/etc/logrotate.conf') do
  19. it { should exist }
  20. it { should be_owned_by 'root' }
  21. it { should be_grouped_into 'root' }
  22. its('mode') { should cmp '0644' }
  23. end
  24. end
  25. control 'logrotate-directory.file.directory' do
  26. title 'Verify the `.d` directory'
  27. describe file('/etc/logrotate.d') do
  28. it { should be_directory }
  29. it { should be_owned_by 'root' }
  30. it { should be_grouped_into 'root' }
  31. its('mode') { should cmp '0755' }
  32. end
  33. end
  34. control 'logrotate.service.running' do
  35. title 'The service should be installed, enabled and running'
  36. only_if('Disabled on Arch Linux') do
  37. !%w[arch].include?(platform[:name])
  38. end
  39. service =
  40. case platform[:family]
  41. when 'redhat', 'fedora'
  42. 'crond'
  43. else
  44. 'cron'
  45. end
  46. describe service(service) do
  47. it { should be_installed }
  48. it { should be_enabled }
  49. it { should be_running }
  50. end
  51. end