From fc0f3fdf8863ac0023cd779c5de6249d1fbc4451 Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Thu, 17 Aug 2017 13:34:13 +0200 Subject: [PATCH] use rspec-puppet-facts for source_spec --- spec/defines/source_spec.rb | 49 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index c06feda..47d63e5 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -1,34 +1,33 @@ require 'spec_helper' describe 'fluentd::source' 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 source' do - let(:title) { 'test' } - let(:params) do - { - priority: '10', - config: { - 'type' => 'tail', - 'format' => 'json', - 'path' => '/var/log/test-application/*.json', - 'tag' => 'application.test' + let(:pre_condition) { 'include fluentd' } + + describe '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 + end - it do - is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf'). - with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/source_tail.conf'))) + it do + is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf'). + with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/source_tail.conf'))) + end + end end end end