fluentd 0.10.53 → 0.10.54

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

@@ -1,97 +0,0 @@
1
- require 'fluent/config/section'
2
-
3
- describe Fluent::Config::Section do
4
- context 'class' do
5
- describe '.name' do
6
- it 'returns its full module name as String' do
7
- expect(Fluent::Config::Section.name).to eql('Fluent::Config::Section')
8
- end
9
- end
10
- end
11
-
12
- context 'instance object' do
13
- describe '#initialize' do
14
- it 'creates blank object without argument' do
15
- s = Fluent::Config::Section.new
16
- expect(s.instance_eval{ @params }).to eql({})
17
- end
18
-
19
- it 'creates object which contains specified hash object itself' do
20
- hash = {
21
- name: 'tagomoris',
22
- age: 34,
23
- send: 'email',
24
- class: 'normal',
25
- keys: 5,
26
- }
27
- s1 = Fluent::Config::Section.new(hash)
28
- expect(s1.instance_eval{ @params }).to eq(hash)
29
- expect(s1[:name]).to eql("tagomoris")
30
- expect(s1[:age]).to eql(34)
31
- expect(s1[:send]).to eql("email")
32
- expect(s1[:class]).to eql("normal")
33
- expect(s1[:keys]).to eql(5)
34
-
35
- expect(s1.name).to eql("tagomoris")
36
- expect(s1.age).to eql(34)
37
- expect(s1.send).to eql("email")
38
- expect(s1.class).to eql("normal")
39
- expect(s1.keys).to eql(5)
40
-
41
- expect{ s1.dup }.to raise_error(NoMethodError)
42
- end
43
- end
44
-
45
- describe '#to_h' do
46
- it 'returns internal hash itself' do
47
- hash = {
48
- name: 'tagomoris',
49
- age: 34,
50
- send: 'email',
51
- class: 'normal',
52
- keys: 5,
53
- }
54
- s = Fluent::Config::Section.new(hash)
55
- expect(s.to_h).to eq(hash)
56
- expect(s.to_h.class).to eq(Hash)
57
- end
58
- end
59
-
60
- describe '#instance_of?' do
61
- it 'can judge whether it is a Section object or not' do
62
- s = Fluent::Config::Section.new
63
- expect(s.instance_of?(Fluent::Config::Section)).to be true
64
- expect(s.instance_of?(BasicObject)).to be false
65
- end
66
- end
67
-
68
- describe '#is_a?' do
69
- it 'can judge whether it belongs to or not' do
70
- s = Fluent::Config::Section.new
71
- expect(s.is_a?(Fluent::Config::Section)).to be true
72
- expect(s.kind_of?(Fluent::Config::Section)).to be true
73
- expect(s.is_a?(BasicObject)).to be true
74
- end
75
- end
76
-
77
- describe '#+' do
78
- it 'can merge 2 sections: argument side is primary, internal hash is newly created' do
79
- h1 = {name: "s1", num: 10, class: "A"}
80
- s1 = Fluent::Config::Section.new(h1)
81
-
82
- h2 = {name: "s2", class: "A", num2: "5", num3: "8"}
83
- s2 = Fluent::Config::Section.new(h2)
84
- s = s1 + s2
85
-
86
- expect(s.to_h.object_id).not_to eq(h1.object_id)
87
- expect(s.to_h.object_id).not_to eq(h2.object_id)
88
-
89
- expect(s.name).to eql("s2")
90
- expect(s.num).to eql(10)
91
- expect(s.class).to eql("A")
92
- expect(s.num2).to eql("5")
93
- expect(s.num3).to eql("8")
94
- end
95
- end
96
- end
97
- end
@@ -1,49 +0,0 @@
1
- require 'fluent/configurable'
2
- require 'fluent/config/element'
3
- require 'fluent/config/section'
4
- require 'fluent/supervisor'
5
-
6
- describe Fluent::Supervisor::SystemConfig do
7
- def parse_text(text)
8
- basepath = File.expand_path(File.dirname(__FILE__) + '/../../')
9
- Fluent::Config.parse(text, '(test)', basepath, true).elements.find { |e| e.name == 'system' }
10
- end
11
-
12
- it 'should not override default configurations when no parameters' do
13
- conf = parse_text(<<EOS)
14
- <system>
15
- </system>
16
- EOS
17
- sc = Fluent::Supervisor::SystemConfig.new(conf)
18
- expect(sc.log_level).to be_nil
19
- expect(sc.suppress_repeated_stacktrace).to be_nil
20
- expect(sc.emit_error_log_interval).to be_nil
21
- expect(sc.suppress_config_dump).to be_nil
22
- expect(sc.without_source).to be_nil
23
- expect(sc.to_opt).to eql({})
24
- end
25
-
26
- {'log_level' => 'error', 'suppress_repeated_stacktrace' => true, 'emit_error_log_interval' => 60, 'suppress_config_dump' => true, 'without_source' => true}.each { |k, v|
27
- it "accepts #{k} parameter" do
28
- conf = parse_text(<<EOS)
29
- <system>
30
- #{k} #{v}
31
- </system>
32
- EOS
33
- sc = Fluent::Supervisor::SystemConfig.new(conf)
34
- expect(sc.instance_variable_get("@#{k}")).not_to be_nil
35
- if k == 'emit_error_log_interval'
36
- expect(sc.to_opt).to include(:suppress_interval)
37
- else
38
- expect(sc.to_opt).to include(k.to_sym)
39
- end
40
- end
41
- }
42
-
43
- {'foo' => 'bar', 'hoge' => 'fuga'}.each { |k, v|
44
- it "should not affect settable parameters with unknown #{k} parameter" do
45
- sc = Fluent::Supervisor::SystemConfig.new({k => v})
46
- expect(sc.to_opt).to be_empty
47
- end
48
- }
49
- end