1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-11-09 20:50:34 +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'
describe 'fluentd::plugin' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context 'gem plugin' do
let(:title) { 'fluent-plugin-elasticsearch' }
let(:params) do
{
type: 'gem'
}
end
let(:pre_condition) { 'include fluentd' }
it do
should contain_package('fluent-plugin-elasticsearch').with({
'ensure' => 'present',
'provider' => 'fluentd_gem',
'notify' => 'Class[Fluentd::Service]'
})
describe '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
describe '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
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
end