summaryrefslogtreecommitdiff
path: root/spec/classes/munin_client_spec.rb
blob: 9a92cefd497ca4ad88ab8bb819616c281b7e7d99 (plain)
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
require 'spec_helper'

describe 'munin::client' do
  shared_examples 'debian-client' do |os, codename|
    let(:facts) {{
      :operatingsystem => os,
      :osfamily => 'Debian',
      :lsbdistcodename => codename,
    }}
    it { should contain_package('munin-node') }
    it { should contain_package('iproute') }
    it { should contain_file('/etc/munin/munin-node.conf') }
    it { should include_class('munin::client::debian') }
  end

  shared_examples 'redhat-client' do |os, codename|
    let(:facts) {{
      :operatingsystem => os,
      :osfamily        => 'RedHat',
      :lsbdistcodename => codename,
    }}
    it { should contain_package('munin-node') }
    it { should contain_file('/etc/munin/munin-node.conf') }
  end

  context 'on debian-like system' do
    it_behaves_like 'debian-client', 'Debian', 'squeeze'
    it_behaves_like 'debian-client', 'Debian', 'wheezy'
    it_behaves_like 'debian-client', 'Ubuntu', 'precise'
  end

  context 'on redhat-like system' do
    it_behaves_like 'redhat-client', 'CentOS', '6'
    # not supported yet
    # it_behaves_like 'redhat', 'RedHat', '6'
  end

  context 'gentoo' do
    let(:facts) {{
      :operatingsystem => 'Gentoo',
      :osfamily        => 'Gentoo',
      :lsbdistcodename => '',
      :interfaces      => 'lo,eth0',
    }}
    it { should contain_package('munin-node') }
    it { should contain_file('/etc/munin/munin-node.conf') }
    it { should include_class('munin::client::gentoo') }
  end

end