Lightweight composition layer for Puppet TripleO
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.
 
 
 
 
 

76 lines
1.9 KiB

  1. require 'spec_helper'
  2. foo_log_conf = <<-EOS
  3. # foobar_foo
  4. input(type="imfile"
  5. file="/path/to/foo.log"
  6. tag="foo"
  7. startmsg.regex="test"
  8. )
  9. EOS
  10. bar_log_conf = <<-EOS
  11. # foobar_bar
  12. input(type="imfile"
  13. file="/path/to/bar.log"
  14. tag="bar"
  15. startmsg.regex="baz"
  16. )
  17. EOS
  18. describe 'tripleo::profile::base::logging::rsyslog::file_input' do
  19. let(:title) { 'foobar' }
  20. let :pre_condition do
  21. 'include ::rsyslog::server'
  22. end
  23. shared_examples_for 'tripleo::profile::base::logging::rsyslog::file_input' do
  24. context 'with basic parameters to configure rsyslog file inputs' do
  25. let :params do {
  26. 'sources' => [
  27. {'file' => '/path/to/foo.log', 'tag' => 'foo'},
  28. {'file' => '/path/to/bar.log', 'tag' => 'bar', 'startmsg.regex' => 'baz'}
  29. ],
  30. 'default_startmsg' => 'test'
  31. }
  32. end
  33. it 'should configure the given file inputs' do
  34. should contain_concat__fragment('rsyslog::component::input::foobar_foo').with({
  35. :target => '/etc/rsyslog.d/50_rsyslog.conf',
  36. :content => foo_log_conf,
  37. })
  38. should contain_concat__fragment('rsyslog::component::input::foobar_bar').with({
  39. :target => '/etc/rsyslog.d/50_rsyslog.conf',
  40. :content => bar_log_conf,
  41. })
  42. end
  43. end
  44. context 'with non-array sources to configure rsyslog file input' do
  45. let :params do {
  46. 'sources' => {'file' => '/path/to/foo.log', 'tag' => 'foo'},
  47. 'default_startmsg' => 'test'
  48. }
  49. end
  50. it 'should configure the given file inputs' do
  51. should contain_concat__fragment('rsyslog::component::input::foobar_foo').with({
  52. :target => '/etc/rsyslog.d/50_rsyslog.conf',
  53. :content => foo_log_conf,
  54. })
  55. end
  56. end
  57. end
  58. on_supported_os.each do |os, facts|
  59. context "on #{os}" do
  60. let(:facts) do
  61. facts.merge({})
  62. end
  63. it_behaves_like 'tripleo::profile::base::logging::rsyslog::file_input'
  64. end
  65. end
  66. end