Saltstack Official Logrotate 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.

72 lines
2.8KB

  1. # frozen_string_literal: true
  2. title 'Test logrotate jobs configuration'
  3. describe file('/etc/logrotate.d/error') do
  4. it { should be_file }
  5. it { should be_owned_by 'root' }
  6. it { should be_grouped_into 'root' }
  7. its('mode') { should cmp '0644' }
  8. its('content') { should include '/tmp/var/log/mysql/error' }
  9. its('content') { should include 'weekly' }
  10. its('content') { should include 'missingok' }
  11. its('content') { should include 'rotate 52' }
  12. its('content') { should include 'compress' }
  13. its('content') { should include 'delaycompress' }
  14. its('content') { should include 'notifempty' }
  15. its('content') { should include 'create 640 root adm' }
  16. its('content') { should include 'sharedscripts' }
  17. end
  18. describe file('/etc/logrotate.d/mysql') do
  19. it { should be_file }
  20. it { should be_owned_by 'root' }
  21. it { should be_grouped_into 'root' }
  22. its('mode') { should cmp '0644' }
  23. its('content') { should include '/tmp/var/log/mysql/*.log' }
  24. its('content') { should include 'weekly' }
  25. its('content') { should include 'missingok' }
  26. its('content') { should include 'rotate 52' }
  27. its('content') { should include 'compress' }
  28. its('content') { should include 'delaycompress' }
  29. its('content') { should include 'notifempty' }
  30. its('content') { should include 'create 640 root adm' }
  31. its('content') { should include 'sharedscripts' }
  32. end
  33. describe file('/etc/logrotate.d/syslog') do
  34. it { should be_file }
  35. it { should be_owned_by 'root' }
  36. it { should be_grouped_into 'root' }
  37. its('mode') { should cmp '0644' }
  38. its('content') { should include '/var/log/cron' }
  39. its('content') { should include '/var/log/maillog' }
  40. its('content') { should include '/var/log/messages' }
  41. its('content') { should include '/var/log/secure' }
  42. its('content') { should include '/var/log/spooler' }
  43. its('content') { should include '/var/log/slapd.log' }
  44. its('content') { should include 'sharedscripts' }
  45. its('content') { should include 'postrotate' }
  46. its('content') { should include 'sharedscripts' }
  47. end
  48. describe file('/etc/logrotate.d/nginx') do
  49. it { should be_file }
  50. it { should be_owned_by 'root' }
  51. it { should be_grouped_into 'root' }
  52. its('mode') { should cmp '0644' }
  53. its('content') { should include '/var/log/nginx/*.log' }
  54. its('content') { should include 'weekly' }
  55. its('content') { should include 'missingok' }
  56. its('content') { should include 'compress' }
  57. its('content') { should include 'delaycompress' }
  58. its('content') { should include 'prerotate' }
  59. its('content') do
  60. should include 'if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\'
  61. end
  62. its('content') { should include ' run-parts /etc/logrotate.d/httpd-prerotate; \\' }
  63. its('content') { should include ' fi \\' }
  64. its('content') { should include 'postrotate' }
  65. its('content') { should include ' invoke-rc.d nginx rotate >/dev/null 2>&1' }
  66. end