From df6c698931c36329729d75dba24f233e20f45909 Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Fri, 4 Dec 2015 13:11:08 +0100 Subject: [PATCH] added source_spec --- spec/defines/source_spec.rb | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 spec/defines/source_spec.rb diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb new file mode 100644 index 0000000..b09f776 --- /dev/null +++ b/spec/defines/source_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe 'fluentd::source' do + let(:facts) { + { + :osfamily => 'Debian', + :lsbdistid => 'Ubuntu', + :operatingsystem => 'Ubuntu', + :lsbdistcodename => 'precise', + } + } + let(:pre_condition) { 'include fluentd' } + + context 'basic source' do + let(:title) { 'test' } + let(:params) do + { + priority: '10', + config: { + 'type' => 'tail', + 'format' => 'json', + 'path' => '/var/log/test-application/*.json', + 'tag' => 'application.test' + } + } + end + + it do + is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf'). + with_content(//). + with_content(/type tail/). + with_content(/format json/). + with_content(/path \/var\/log\/test-application\/\*.json/). + with_content(/tag application.test/). + with_content(/<\/source>/) + end + end +end \ No newline at end of file