1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-12-16 13:20:35 +00:00

use rspec-puppet-facts for plugin_spec

This commit is contained in:
Max Wilhelm 2017-08-17 13:34:03 +02:00
parent 5f213da8b3
commit 613a28ccaf

View File

@ -1,52 +1,51 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::plugin' do describe 'fluentd::plugin' do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' }
context 'gem plugin' do let(:pre_condition) { 'include fluentd' }
let(:title) { 'fluent-plugin-elasticsearch' }
let(:params) do
{
type: 'gem'
}
end
it do describe 'gem plugin' do
should contain_package('fluent-plugin-elasticsearch').with({ let(:title) { 'fluent-plugin-elasticsearch' }
'ensure' => 'present', let(:params) do
'provider' => 'fluentd_gem', {
'notify' => 'Class[Fluentd::Service]' type: 'gem'
}) }
end end
end
context 'file plugin' do it do
let(:title) { 'fluent-plugin-test' } should contain_package('fluent-plugin-elasticsearch').with({
let(:params) do 'ensure' => 'present',
{ 'provider' => 'fluentd_gem',
type: 'file', 'notify' => 'Class[Fluentd::Service]'
source: 'puppet:///path/to/source' })
} end
end end
it do describe 'file plugin' do
should contain_file('/etc/td-agent/plugin/fluent-plugin-test').with({ let(:title) { 'fluent-plugin-test' }
'ensure' => 'present', let(:params) do
'owner' => 'td-agent', {
'group' => 'td-agent', type: 'file',
'mode' => '0640', source: 'puppet:///path/to/source'
'source' => 'puppet:///path/to/source', }
'notify' => 'Class[Fluentd::Service]' 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 end
end end
end end