From 43cfae779768af137af98ce6812f62c8443c84b8 Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Fri, 4 Dec 2015 13:28:06 +0100 Subject: [PATCH] plugin_spec --- spec/defines/plugin_spec.rb | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 spec/defines/plugin_spec.rb diff --git a/spec/defines/plugin_spec.rb b/spec/defines/plugin_spec.rb new file mode 100644 index 0000000..498d5f6 --- /dev/null +++ b/spec/defines/plugin_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe 'fluentd::plugin' do + let(:facts) { + { + :osfamily => 'Debian', + :lsbdistid => 'Ubuntu', + :operatingsystem => 'Ubuntu', + :lsbdistcodename => 'precise', + } + } + let(:pre_condition) { 'include fluentd' } + + context 'gem plugin' do + let(:title) { 'fluent-plugin-elasticsearch' } + let(:params) do + { + type: 'gem' + } + end + + it do + should contain_package('fluent-plugin-elasticsearch').with({ + 'ensure' => 'present', + 'provider' => 'fluentd_gem', + 'notify' => 'Class[Fluentd::Service]' + }) + end + end + + context 'file plugin' do + let(:title) { 'fluent-plugin-test' } + let(:params) do + { + type: 'file', + source: 'puppet:///path/to/source' + } + end + + it do + should contain_file('/etc/td-agent/plugin/fluent-plugin-test').with({ + 'ensure' => 'present', + 'owner' => 'td-agent', + 'group' => 'td-agent', + 'mode' => '0640', + 'source' => 'puppet:///path/to/source', + 'notify' => 'Class[Fluentd::Service]' + }) + end + end +end \ No newline at end of file