Fuel plugin to collect Logging Monitoring and Alerting metrics
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.

lma_collector_heka_spec.rb 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright 2016 Mirantis, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. require 'spec_helper'
  15. describe 'lma_collector::heka' do
  16. let(:facts) do
  17. {:kernel => 'Linux', :operatingsystem => 'Ubuntu',
  18. :osfamily => 'Debian'}
  19. end
  20. describe 'log_collector with default' do
  21. let(:title) { :log_collector}
  22. it {
  23. should contain_heka('log_collector').with(
  24. 'user' => 'heka',
  25. 'poolsize' => 100,
  26. )
  27. should contain_heka__output__tcp('metric')
  28. should contain_heka__filter__sandbox('heka_monitoring_log_collector')
  29. should contain_heka__output__dashboard('dashboard_log_collector' )
  30. }
  31. end
  32. describe 'metric_collector with default' do
  33. let(:title) { :metric_collector}
  34. it {
  35. should contain_heka('metric_collector').with(
  36. 'user' => 'heka',
  37. 'poolsize' => 100,
  38. )
  39. should contain_heka__input__tcp('metric')
  40. should contain_heka__decoder__sandbox('metric' )
  41. should contain_heka__filter__sandbox('heka_monitoring_metric_collector')
  42. should contain_heka__output__dashboard('dashboard_metric_collector' )
  43. }
  44. end
  45. describe 'with an invalid title' do
  46. let(:title) { :invalidname}
  47. it do
  48. expect {
  49. is_expected.to compile
  50. }.to raise_error(/title must be either/)
  51. end
  52. end
  53. describe 'metric_collector with no self-monitoring and poolsize' do
  54. let(:title) { :metric_collector}
  55. let(:params) do
  56. { :heka_monitoring => false,
  57. :poolsize => 42,
  58. :user => 'foo',
  59. }
  60. end
  61. it {
  62. should contain_heka('metric_collector').with(
  63. 'user' => 'foo',
  64. 'poolsize' => 42,
  65. )
  66. should contain_heka__input__tcp('metric')
  67. should contain_heka__decoder__sandbox('metric' )
  68. is_expected.to_not contain_heka__filter__sandbox('heka_monitoring_metric_collector')
  69. is_expected.to_not contain_heka__output__dashboard('dashboard_metric_collector' )
  70. }
  71. end
  72. end