summaryrefslogtreecommitdiff
path: root/spec/defines/munin_plugin_spec.rb
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-01-20 18:40:04 +0000
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-01-20 18:40:04 +0000
commit23201220bf8b7b63da44747be142face0c98eb09 (patch)
treec1645f62976281a552963b1309307e0d0b6136f3 /spec/defines/munin_plugin_spec.rb
parent7e03247a9e219fe8e57d544957eb06e305e69fc1 (diff)
parenteaa092eb1a8f3ae19551e6e80f84d174211b5208 (diff)
Merge branch 'merge_immerda' into 'master'
This is my attempt at merging the huge backlog of commits from immerda. I've been pretty verbose about it in redmine so I won't repeat it all here. For details, see: https://labs.riseup.net/code/issues/4132
Diffstat (limited to 'spec/defines/munin_plugin_spec.rb')
-rw-r--r--spec/defines/munin_plugin_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb
new file mode 100644
index 0000000..0e7306a
--- /dev/null
+++ b/spec/defines/munin_plugin_spec.rb
@@ -0,0 +1,57 @@
+require 'spec_helper'
+
+describe 'munin::plugin' do
+ let(:title) { 'users' }
+ let(:facts) do
+ { :operatingsystem => 'CentOS' }
+ end
+ context 'present' do
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users'
+ ) }
+ it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
+ end
+
+ context 'present and config' do
+ let(:params) do
+ { :config => 'env.user root' }
+ end
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users',
+ :notify => 'Service[munin-node]'
+ ) }
+ it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with(
+ :content => "[users]\nenv.user root\n",
+ :owner => 'root',
+ :group => 0,
+ :mode => '0640'
+ ) }
+ end
+
+ context 'present and config as an array' do
+ let(:params) do
+ { :config => [ 'env.user root', 'env.group root' ] }
+ end
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users',
+ :notify => 'Service[munin-node]'
+ ) }
+ it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with(
+ :content => "[users]\nenv.user root\nenv.group root\n",
+ :owner => 'root',
+ :group => 0,
+ :mode => '0640'
+ ) }
+ end
+
+ context 'absent' do
+ let(:params) do
+ { :ensure => 'absent' }
+ end
+ it { should_not contain_file('/etc/munin/plugins/users') }
+ it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
+ end
+end