From 057658ba93e2562c596dfa5607836679631be916 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 22:49:02 +0200 Subject: Unify OS specific munin-conf.conf In essence all munin-node.conf files contained the same template, besides a few values. By moving all to a single template, maintenance burden is reduced. To ensure all values are still present in the templates, tests are added. --- spec/classes/munin_client_base_spec.rb | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 spec/classes/munin_client_base_spec.rb (limited to 'spec') diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb new file mode 100644 index 0000000..1b3d936 --- /dev/null +++ b/spec/classes/munin_client_base_spec.rb @@ -0,0 +1,86 @@ +require 'spec_helper' + +describe 'munin::client::base' do + let :default_facts do + { + :fqdn => 'munin-node.example.org', + } + end + + let :pre_condition do + 'include munin::client' + end + + context 'on Debian' do + let :facts do + { :operatingsystem => 'Debian' }.merge(default_facts) + end + + it 'should compile' do + should include_class('munin::client::base') + end + + it 'should set up munin-node' do + should contain_service('munin-node').with({ + :ensure => 'running', + :enable => true, + :hasstatus => true, + :hasrestart => true, + }) + + should contain_file('/etc/munin').with({ + :ensure => 'directory', + :mode => '0755', + :owner => 'root', + :group => 0, + }) + + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^host_name munin-node.example.org$/). + with_content(/^allow \^127\\\.0\\\.0\\\.1\$$/). + with_content(/^host \*$/). + with_content(/^port 4949$/) + + should contain_munin__register('munin-node.example.org').with({ + :host => 'munin-node.example.org', + :port => '4949', + :use_ssh => false, + :config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + :export_tag => 'munin', + }) + + should contain_class('munin::plugins::base') + end + + it 'should contain the Debian specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin\/munin-node.log$/). + with_content(/^group root$/) + end + end + + context 'on CentOS' do + let :facts do + { :operatingsystem => 'CentOS' }.merge(default_facts) + end + + it 'should contain the CentOS specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/). + with_content(/^group root$/) + end + end + + # Disabled because the required openbsd module is not in the requirements + context 'on OpenBSD', :if => false do + let :facts do + { :operatingsystem => 'OpenBSD' }.merge(default_facts) + end + + it 'should contain the config OpenBSD specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/). + with_content(/^group 0$/) + end + end +end -- cgit v1.2.3