summaryrefslogtreecommitdiff
path: root/spec/classes/munin_client_base_spec.rb
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-03-16 22:03:36 +0100
committervarac <varacanero@zeromail.org>2016-03-16 22:03:36 +0100
commit6c633f8606e04aad29f40a3fc0fcfdcb4b293715 (patch)
tree63d7c8a54a643cc628b9b4f7a3b941d9f508c4ad /spec/classes/munin_client_base_spec.rb
parent503e9296860e4d844a1ee391331996db87e0bfa6 (diff)
parent87dc315597e8ed27c2e0907615ede8a3f1521b7a (diff)
Merge remote-tracking branch 'shared/master' into leap_masterHEADmaster
Diffstat (limited to 'spec/classes/munin_client_base_spec.rb')
-rw-r--r--spec/classes/munin_client_base_spec.rb86
1 files changed, 86 insertions, 0 deletions
diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb
new file mode 100644
index 0000000..fdf1403
--- /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
+ { :osfamily => 'Debian' }.merge(default_facts)
+ end
+
+ it 'should compile' do
+ should contain_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
+ { :osfamily => '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
+ { :osfamily => '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