summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Barton <barton.tomas@gmail.com>2013-10-12 18:29:11 +0200
committerTomas Barton <barton.tomas@gmail.com>2013-10-12 18:29:11 +0200
commitb729e3903ded13e07501fc9b55766d21de206ae8 (patch)
treeb3a1d8b15171a4b217db1d827eb93813702fc570
parent9c2c7140876bbe20a9871543ba28b7522acdb213 (diff)
basic munin::client specs
-rw-r--r--.rspec3
-rw-r--r--Puppetfile1
-rw-r--r--Puppetfile.lock2
-rw-r--r--spec/classes/munin_client_spec.rb47
-rw-r--r--spec/spec.opts1
-rw-r--r--spec/spec_helper_system.rb1
6 files changed, 48 insertions, 7 deletions
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