-
-
Notifications
You must be signed in to change notification settings - Fork 269
/
collectd_plugin_mcelog_spec.rb
79 lines (66 loc) · 2.54 KB
/
collectd_plugin_mcelog_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
# frozen_string_literal: true
require 'spec_helper'
describe 'collectd::plugin::mcelog', type: :class do
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let :pre_condition do
'include collectd'
end
it { is_expected.to compile.with_all_deps }
options = os_specific_options(facts)
context ':ensure => present, default params' do
it "Will create #{options[:plugin_conf_dir]}/10-mcelog.conf" do
is_expected.to contain_file('mcelog.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/10-mcelog.conf"
)
end
it { is_expected.to contain_file('mcelog.load').with(content: %r{<Memory>}) }
it { is_expected.to contain_file('mcelog.load').with(content: %r{McelogClientSocket "/var/run/mcelog-client"}) }
it { is_expected.to contain_file('mcelog.load').with(content: %r{PersistentNotification false}) }
end
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it { is_expected.to contain_package('collectd-mcelog').with(ensure: 'present') }
end
end
context ':ensure => :mceloglogfile => true' do
let :params do
{
mceloglogfile: '/var/log/mcelog'
}
end
it "Will create #{options[:plugin_conf_dir]}/10-mcelog.conf" do
is_expected.to contain_file('mcelog.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/10-mcelog.conf"
)
end
it { is_expected.to contain_file('mcelog.load').with(content: %r{McelogLogfile "/var/log/mcelog"}) }
end
context ':ensure => :memory => true' do
let :params do
{
memory: {
'mcelogclientsocket' => '/var/run/mcelog-client',
'persistentnotification' => true
}
}
end
it "Will create #{options[:plugin_conf_dir]}/10-mcelog.conf" do
is_expected.to contain_file('mcelog.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/10-mcelog.conf"
)
end
it { is_expected.to contain_file('mcelog.load').with(content: %r{<Memory>}) }
it { is_expected.to contain_file('mcelog.load').with(content: %r{McelogClientSocket "/var/run/mcelog-client"}) }
it { is_expected.to contain_file('mcelog.load').with(content: %r{PersistentNotification true}) }
end
end
end
end