test_default.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Verify that redis, rabbitmq-server, sensu-{api,client}, and Uchiwa
  2. # are all listening as expected
  3. # frozen_string_literal: true
  4. # Redis
  5. describe port(6379) do
  6. it { should be_listening }
  7. its('protocols') { should include 'tcp' }
  8. its('addresses') { should be_in ['0.0.0.0'] }
  9. end
  10. # RabbitMQ Server
  11. describe port(5671) do
  12. it { should be_listening }
  13. its('protocols') { should include 'tcp' }
  14. its('addresses') { should be_in ['0.0.0.0'] }
  15. end
  16. # Sensu API
  17. describe port(4567) do
  18. it { should be_listening }
  19. its('protocols') { should include 'tcp' }
  20. its('addresses') { should be_in ['0.0.0.0'] }
  21. end
  22. # Sensu Client TCP/UDP Socket
  23. describe port(3030) do
  24. it { should be_listening }
  25. its('protocols') { should include 'tcp' }
  26. # Broken on 14.04 - its('protocols') { should include 'udp' }
  27. its('addresses') { should include '127.0.0.1' }
  28. end
  29. # Sensu Client HTTP Socket
  30. describe port(3031) do
  31. it { should be_listening }
  32. its('protocols') { should include 'tcp' }
  33. its('addresses') { should include '127.0.0.1' }
  34. end
  35. # Uchiwa
  36. describe port(3000) do
  37. it { should be_listening }
  38. its('protocols') { should include 'tcp' }
  39. its('addresses') { should be_in ['0.0.0.0'] }
  40. end
  41. # Ensure Sensu API has one consumer
  42. describe http('http://127.0.0.1:4567/health',
  43. auth: { user: 'admin', pass: 'secret' },
  44. params: { consumers: 1 }) do
  45. its('status') { should eq 204 }
  46. end
  47. # Ensure disk check exists
  48. describe json('/etc/sensu/conf.d/sensu_masters/check_disk_usage.json') do
  49. its(%w[checks check_disk_usage command]) \
  50. { should eq 'check-disk-usage.rb' }
  51. its(%w[checks check_disk_usage interval]) { should eq 120 }
  52. end
  53. # Ensure disk metrics exists
  54. describe json('/etc/sensu/conf.d/sensu_checks/metrics_disk_usage.json') do
  55. its(%w[checks metrics_disk_usage command]) \
  56. { should eq 'metrics-disk-usage.rb' }
  57. its(%w[checks metrics_disk_usage interval]) { should eq 60 }
  58. end
  59. # Ensure not_used does not exist
  60. describe file('/etc/sensu/conf.d/not_used/not_a_check.json') do
  61. it { should_not exist }
  62. end