-
Notifications
You must be signed in to change notification settings - Fork 4
/
fluentd_spec.rb
97 lines (74 loc) · 2.3 KB
/
fluentd_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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
require 'rspec'
require 'yaml'
require 'bosh/template/test'
describe 'fluentd job' do
let(:release_dir) { File.join(File.dirname(__FILE__), '..') }
let(:release) { Bosh::Template::Test::ReleaseDir.new(release_dir) }
let(:job) { release.job('fluentd') }
describe 'bpm.yml' do
let(:template) {job.template('config/bpm.yml')}
it 'defaults to using --no-supervisor' do
process = YAML::load(template.render({}))['processes'][0]
expect(process['args']).to match(['--no-supervisor'])
end
it 'users user-defined args when supplied' do
args = ['--foo', 'bar']
process = YAML::load(template.render({'command_line_args' => args}))['processes'][0]
expect(process['args']).to match(['--foo', 'bar'])
end
end
describe 'ca.crt' do
let(:template) {job.template('certs/ca.crt')}
it 'has correctly processed the ca certificate template' do
expected = "helloworld"
properties = {
'cert' => {
'ca' => "helloworld"
}
}
actual = template.render(properties)
expect(actual).to match(expected)
end
it 'has correctly processed with no properties' do
expected = ""
actual = template.render({})
expect(actual).to match(expected)
end
end
describe 'cert.crt' do
let(:template) {job.template('certs/cert.crt')}
it 'has correctly processed the ca certificate template' do
expected = "helloworld"
properties = {
'cert' => {
'crt' => "helloworld"
}
}
actual = template.render(properties)
expect(actual).to match(expected)
end
it 'has correctly processed with no properties' do
expected = ""
actual = template.render({})
expect(actual).to match(expected)
end
end
describe 'cert.key' do
let(:template) {job.template('certs/cert.key')}
it 'has correctly processed the ca certificate template' do
expected = "helloworld"
properties = {
'cert' => {
'key' => "helloworld"
}
}
actual = template.render(properties)
expect(actual).to match(expected)
end
it 'has correctly processed with no properties' do
expected = ""
actual = template.render({})
expect(actual).to match(expected)
end
end
end