forked from voxpupuli/puppet-splunk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplunk_forwarder_spec.rb
45 lines (39 loc) · 1.29 KB
/
splunk_forwarder_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
require 'spec_helper_acceptance'
describe 'splunk::forwarder class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'works idempotently with no errors' do
pp = <<-EOS
class { 'splunk::params':
}
class { 'splunk::forwarder':
splunkd_port => 8090,
}
splunkforwarder_output { 'tcpout:splunkcloud/sslPassword':
value => 'super_secure_password',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file('/opt/splunkforwarder/etc/system/local/outputs.conf') do
it { is_expected.to be_file }
its(:content) { is_expected.to match %r{^sslPassword} }
its(:content) { is_expected.to match %r{^sslPassword = \$7\$} }
end
describe package('splunkforwarder') do
it { is_expected.to be_installed }
end
init = shell('/bin/readlink /sbin/init', acceptable_exit_codes: [0, 1]).stdout
service_name = if init.include? 'systemd'
'SplunkForwarder'
else
'splunk'
end
describe service(service_name) do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
end
end