mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-09-07 23:09:30 +00:00
allow repeating keys in match rules
extends the match template, yes, its not pretty readable, to support array definitions for defining multiple server or stores.
This commit is contained in:
@@ -24,9 +24,11 @@ describe 'fluentd::match' do
|
||||
'shared_key' => 'my_shared_key',
|
||||
'self_hostname' => 'instance.test.com',
|
||||
'ca_cert_path' => '/path/to/ca.cert',
|
||||
'servers' => {
|
||||
'host' => 'test.server.com'
|
||||
}
|
||||
'server' => [
|
||||
{
|
||||
'host' => 'test.server.com',
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
end
|
||||
@@ -40,10 +42,52 @@ describe 'fluentd::match' do
|
||||
with_content(/shared_key my_shared_key/).
|
||||
with_content(/self_hostname instance.test.com/).
|
||||
with_content(/ca_cert_path \/path\/to\/ca.cert/).
|
||||
with_content(/<servers>/).
|
||||
with_content(/<server>/).
|
||||
with_content(/host test.server.com/).
|
||||
with_content(/<\/servers>/).
|
||||
with_content(/<\/server>/).
|
||||
with_content(/<\/match>/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'multiple store' do
|
||||
let(:title) { 'test' }
|
||||
let(:params) do
|
||||
{
|
||||
priority: '30',
|
||||
pattern: '*.test',
|
||||
config: {
|
||||
'type' => 'copy',
|
||||
'store' => [
|
||||
{
|
||||
'type' => 'elasticsearch',
|
||||
'logstashformat' => true,
|
||||
'hosts' => '172.20.10.17:9200',
|
||||
'flush_interval' => '30s',
|
||||
},
|
||||
{
|
||||
'type' => 'file',
|
||||
'path' => '/tmp/td-agent-debug.log',
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
|
||||
with_content(/<match \*.test>/).
|
||||
with_content(/type copy/).
|
||||
with_content(/<store>/).
|
||||
with_content(/type elasticsearch/).
|
||||
with_content(/logstashformat true/).
|
||||
with_content(/hosts 172.20.10.17:9200/).
|
||||
with_content(/flush_interval 30s/).
|
||||
with_content(/<\/store>/).
|
||||
with_content(/<store>/).
|
||||
with_content(/type file/).
|
||||
with_content(/path \/tmp\/td-agent-debug.log/).
|
||||
with_content(/<\/store>/).
|
||||
with_content(/<\/match>/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user