summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorduritong <peter.meier+github@immerda.ch>2013-08-25 04:01:08 -0700
committerduritong <peter.meier+github@immerda.ch>2013-08-25 04:01:08 -0700
commit9a98e96366ed2986fcce2b9a6298580583ab62c7 (patch)
treeb2dd2f25149b0752486d7c28092c468a5926663e /spec
parentf79c556357cdd4e0a06596b32661e3f156e2fc4f (diff)
parent42488b04b47ec3fd87f1d45ec3fa90b588545ca1 (diff)
Merge pull request #12 from oxilion/linting
lintify
Diffstat (limited to 'spec')
-rw-r--r--spec/classes/munin_client_spec.rb14
-rw-r--r--spec/classes/munin_host_spec.rb14
-rw-r--r--spec/classes/munin_plugins_interfaces_spec.rb44
-rw-r--r--spec/spec.opts1
-rw-r--r--spec/spec_helper.rb9
5 files changed, 82 insertions, 0 deletions
diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb
new file mode 100644
index 0000000..5438b20
--- /dev/null
+++ b/spec/classes/munin_client_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe 'munin::client' do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :interfaces => 'lo,eth0',
+ }
+ end
+
+ it 'should compile' do
+ should include_class('munin::client')
+ end
+end
diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb
new file mode 100644
index 0000000..2216cc5
--- /dev/null
+++ b/spec/classes/munin_host_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe 'munin::host' do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :interfaces => 'lo,eth0',
+ }
+ end
+
+ it 'should compile' do
+ should include_class('munin::host')
+ end
+end
diff --git a/spec/classes/munin_plugins_interfaces_spec.rb b/spec/classes/munin_plugins_interfaces_spec.rb
new file mode 100644
index 0000000..95aa785
--- /dev/null
+++ b/spec/classes/munin_plugins_interfaces_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe 'munin::plugins::interfaces' do
+ context 'on CentOS' do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :interfaces => 'lo,eth0,sit0',
+ }
+ end
+
+ it 'should compile' do
+ should include_class('munin::plugins::interfaces')
+ end
+
+ it 'should create plugins for each interface' do
+ # lo
+ should contain_munin__plugin('if_lo').with_ensure('if_')
+ should contain_munin__plugin('if_err_lo').with_ensure('if_err_')
+
+ # eth0
+ should contain_munin__plugin('if_eth0').with_ensure('if_')
+ should contain_munin__plugin('if_err_eth0').with_ensure('if_err_')
+ end
+
+ it 'should not create plugins for sit0' do
+ should_not contain_munin__plugin('if_sit0')
+ should_not contain_munin__plugin('if_err_sit0')
+ end
+ end
+
+ context 'on OpenBSD' do
+ let :facts do
+ {
+ :operatingsystem => 'OpenBSD',
+ :interfaces => 'eth0',
+ }
+ end
+
+ it 'should use if_errcoll_ instead of if_err_' do
+ should contain_munin__plugin('if_errcoll_eth0').with_ensure('if_errcoll_')
+ end
+ end
+end
diff --git a/spec/spec.opts b/spec/spec.opts
new file mode 100644
index 0000000..d1bd681
--- /dev/null
+++ b/spec/spec.opts
@@ -0,0 +1 @@
+--format documentation --colour --backtrace
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..cffe80c
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,9 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
+
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
+
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_path, 'modules')
+ c.manifest_dir = File.join(fixture_path, 'manifests')
+ c.mock_with :mocha
+end