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

use rspec-puppet-facts for match_spec

This commit is contained in:
Max Wilhelm 2017-08-17 13:33:54 +02:00
parent 258a37ff11
commit 5f213da8b3

View File

@ -1,72 +1,71 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::match' do describe 'fluentd::match' 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 'basic match' do let(:pre_condition) { 'include fluentd' }
let(:title) { 'test' }
let(:params) do describe 'basic match' do
{ let(:title) { 'test' }
priority: '30', let(:params) do
pattern: '*.test', {
config: { priority: '30',
'flush_interval' => '30s', pattern: '*.test',
'type' => 'secure_forward', config: {
'secure' => 'yes', 'flush_interval' => '30s',
'shared_key' => 'my_shared_key', 'type' => 'secure_forward',
'self_hostname' => 'instance.test.com', 'secure' => 'yes',
'ca_cert_path' => '/path/to/ca.cert', 'shared_key' => 'my_shared_key',
'server' => [ 'self_hostname' => 'instance.test.com',
{ 'ca_cert_path' => '/path/to/ca.cert',
'host' => 'test.server.com', 'server' => [
} {
] 'host' => 'test.server.com',
}
]
}
} }
} end
end
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_secure_forward.conf'))) with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_secure_forward.conf')))
end end
end end
context 'multiple store' do describe 'multiple store' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
priority: '30', priority: '30',
pattern: '*.test', pattern: '*.test',
config: { config: {
'type' => 'copy', 'type' => 'copy',
'store' => [ 'store' => [
{ {
'type' => 'elasticsearch', 'type' => 'elasticsearch',
'logstashformat' => true, 'logstashformat' => true,
'hosts' => '172.20.10.17:9200', 'hosts' => '172.20.10.17:9200',
'flush_interval' => '30s', 'flush_interval' => '30s',
}, },
{ {
'type' => 'file', 'type' => 'file',
'path' => '/tmp/td-agent-debug.log', 'path' => '/tmp/td-agent-debug.log',
} }
] ]
}
} }
} end
end
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_copy.conf'))) with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_copy.conf')))
end
end
end end
end end
end end