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