This repository has been archived by the owner on Jul 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
fluentd_match_spec.rb
71 lines (59 loc) · 2.45 KB
/
fluentd_match_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env rspec
require 'spec_helper'
describe 'fluentd::match' do
let(:title) {'bar'}
let (:facts) {{
:osfamily => 'Debian',
:lsbdistid => 'Debian',
}}
context "when no servers or out_copy" do
let(:params) {{
:pattern => 'baz',
:config => {
'type' => 'file',
'time_slice_wait' => '10m',
'compress' => 'gzip',
}
}}
it "should create matcher single segment" do
should contain_fluentd__configfile('match-bar').with_content(/<match baz>.*type.*file.*time_slice_wait.*10m.*compress.*gzip.*<\/match>/m)
should_not contain_fluentd__configfile('match-bar').with_content(/server/)
should_not contain_fluentd__configfile('match-bar').with_content(/store/)
end
end
context "when servers but no out_copy" do
let(:params) {{
:pattern => 'baz',
:config => {
'servers' => [{ 'host' => 'kelis', 'port' => '24224'}, { 'host' => 'bossy', 'port' => '24224'}],
'type' => 'file',
'time_slice_wait' => '10m',
'compress' => 'gzip',
}
}}
it "should create matcher with server" do
should contain_fluentd__configfile('match-bar').with_content(/<match baz>.*<server>.*host kelis.*port.*24224.*<\/server>.*<server>.*host.*bossy.*port.*24224.*<\/server>.*type.*file.*time_slice_wait.*10m.*compress.*gzip.*<\/match>/m)
should contain_fluentd__configfile('match-bar').with_content(/server/)
should_not contain_fluentd__configfile('match-bar').with_content(/store/)
end
end
context "when out_copy" do
let(:params) {{
:pattern => 'baz',
:config => [
{
'type' => 'file',
'compress' => 'gzip',
'servers' => [{ 'host' => 'kelis', 'port' => '24224'}, { 'host' => 'bossy', 'port' => '24224'}],
},
{
'type' => 'mongo',
'database' => 'dummy',
}
]
}}
it "should create matcher with server" do
should contain_fluentd__configfile('match-bar').with_content(/<match baz>.*type.*copy.*<store>.*type.*file.*compress.*gzip.*<server>.*host.*kelis.*port.*24224.*<\/server>.*<server>.*host.*bossy.*port.*24224.*<\/server>.*<\/store>.*<store>.*type.*mongo.*database.*dummy.*<\/store>.*<\/match>/m)
end
end
end