test_default.rb 2.0 KB

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