From 258a37ff11593d841d3b048a126f4c9152107650 Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Thu, 17 Aug 2017 13:33:43 +0200 Subject: [PATCH] use rspec-puppet-facts for filter_spec --- spec/defines/filter_spec.rb | 43 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/spec/defines/filter_spec.rb b/spec/defines/filter_spec.rb index 6365302..c360cff 100644 --- a/spec/defines/filter_spec.rb +++ b/spec/defines/filter_spec.rb @@ -1,35 +1,34 @@ require 'spec_helper' describe 'fluentd::filter' 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 'basic filter' do - let(:title) { 'test' } - let(:params) do - { - priority: '20', - pattern: '*.test', - config: { + let(:pre_condition) { 'include fluentd' } + + describe 'basic filter' do + let(:title) { 'test' } + let(:params) do + { + priority: '20', + pattern: '*.test', + config: { 'type' => 'record_transformer', 'record' => { 'hostname' => '${hostname}' } + } } - } - end + end - it do - is_expected.to contain_file('/etc/td-agent/conf.d/20-filter-test.conf'). - with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/filter_record_transformer.conf'))) + it do + is_expected.to contain_file('/etc/td-agent/conf.d/20-filter-test.conf'). + with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/filter_record_transformer.conf'))) + end + end end end end