From b729e3903ded13e07501fc9b55766d21de206ae8 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sat, 12 Oct 2013 18:29:11 +0200 Subject: basic munin::client specs --- .rspec | 3 +++ Puppetfile | 1 + Puppetfile.lock | 2 ++ spec/classes/munin_client_spec.rb | 47 ++++++++++++++++++++++++++++++++++----- spec/spec.opts | 1 - spec/spec_helper_system.rb | 1 + 6 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .rspec delete mode 100644 spec/spec.opts diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..e0b06e8 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +#--backtrace diff --git a/Puppetfile b/Puppetfile index 03b0752..60d1d14 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,3 +1,4 @@ forge 'http://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=0.1.6' +mod 'puppetlabs/concat' \ No newline at end of file diff --git a/Puppetfile.lock b/Puppetfile.lock index d949104..0689d41 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -1,8 +1,10 @@ FORGE remote: http://forge.puppetlabs.com specs: + puppetlabs/concat (1.0.0-rc1) puppetlabs/stdlib (4.1.0) DEPENDENCIES + puppetlabs/concat (>= 0) puppetlabs/stdlib (>= 0.1.6) diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index 5438b20..a5539b3 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -1,14 +1,49 @@ require 'spec_helper' describe 'munin::client' do - let :facts do - { - :operatingsystem => 'CentOS', + shared_examples 'debian' 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') } + end + + shared_examples 'redhat' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'RedHat', + :lsbdistcodename => codename, :interfaces => 'lo,eth0', - } + }} + 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', 'Debian', 'squeeze' + it_behaves_like 'debian', 'Debian', 'wheezy' + it_behaves_like 'debian', 'Ubuntu', 'precise' end - it 'should compile' do - should include_class('munin::client') + context 'on redhat-like system' do + it_behaves_like 'redhat', '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') } + end + end diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index d1bd681..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1 +0,0 @@ ---format documentation --colour --backtrace diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb index 462d2a1..9adfea9 100644 --- a/spec/spec_helper_system.rb +++ b/spec/spec_helper_system.rb @@ -22,5 +22,6 @@ RSpec.configure do |c| # Install modules and dependencies puppet_module_install(:source => proj_root, :module_name => 'munin') shell('puppet module install puppetlabs-stdlib') + shell('puppet module install puppetlabs-concat') end end -- cgit v1.2.3