diff options
author | varac <varacanero@zeromail.org> | 2016-03-16 22:03:36 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2016-03-16 22:03:36 +0100 |
commit | 6c633f8606e04aad29f40a3fc0fcfdcb4b293715 (patch) | |
tree | 63d7c8a54a643cc628b9b4f7a3b941d9f508c4ad /spec/defines/munin_plugin_spec.rb | |
parent | 503e9296860e4d844a1ee391331996db87e0bfa6 (diff) | |
parent | 87dc315597e8ed27c2e0907615ede8a3f1521b7a (diff) |
Diffstat (limited to 'spec/defines/munin_plugin_spec.rb')
-rw-r--r-- | spec/defines/munin_plugin_spec.rb | 57 |
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 |