From 42488b04b47ec3fd87f1d45ec3fa90b588545ca1 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 19:22:35 +0200 Subject: Add basic testing infrastructure --- spec/classes/munin_host_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 spec/classes/munin_host_spec.rb (limited to 'spec/classes/munin_host_spec.rb') 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 -- cgit v1.2.3 From 342ea7aa15a54c33ec4a12cf10b7b1a0c9811dba Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:14:45 +0200 Subject: extended tests, first group should pass --- spec/classes/munin_host_spec.rb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'spec/classes/munin_host_spec.rb') diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index 2216cc5..ccfcee6 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -1,14 +1,21 @@ require 'spec_helper' describe 'munin::host' do - let :facts do - { - :operatingsystem => 'CentOS', - :interfaces => 'lo,eth0', - } + shared_examples 'debian-host' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'Debian', + :lsbdistcodename => codename, + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } end - it 'should compile' do - should include_class('munin::host') - end +# context 'on debian-like system' do +# it_behaves_like 'debian-host', 'Debian', 'squeeze' +# it_behaves_like 'debian', 'Debian', 'wheezy' +# it_behaves_like 'debian', 'Ubuntu', 'precise' +# end + end -- cgit v1.2.3 From 7be20b4d90918dce2404d5957fc6a2b77e082caf Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:30:33 +0200 Subject: munin host specs --- spec/classes/munin_host_spec.rb | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'spec/classes/munin_host_spec.rb') diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index ccfcee6..461ced5 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -10,12 +10,28 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } + it { should include_class('munin::host') } end -# context 'on debian-like system' do -# it_behaves_like 'debian-host', 'Debian', 'squeeze' -# it_behaves_like 'debian', 'Debian', 'wheezy' -# it_behaves_like 'debian', 'Ubuntu', 'precise' -# end + shared_examples 'redhat-host' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'RedHat', + :lsbdistcodename => codename, + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } + it { should include_class('munin::host') } + end + context 'on debian-like system' do + it_behaves_like 'debian-host', 'Debian', 'squeeze' + it_behaves_like 'debian-host', 'Debian', 'wheezy' + it_behaves_like 'debian-host', 'Ubuntu', 'precise' + end + + context 'on redhat-like system' do + it_behaves_like 'redhat-host', 'CentOS', '6' + end end -- cgit v1.2.3 From b4a5d72198df331e8cc62d309d14a989fa4c311c Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 13:15:26 +0200 Subject: migrate tests to new format --- spec/classes/munin_host_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/classes/munin_host_spec.rb') diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index 461ced5..b707b5d 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -10,7 +10,7 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } - it { should include_class('munin::host') } + it { should contain_class('munin::host') } end shared_examples 'redhat-host' do |os, codename| @@ -22,7 +22,7 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } - it { should include_class('munin::host') } + it { should contain_class('munin::host') } end context 'on debian-like system' do -- cgit v1.2.3 From 90796d31dd9ab7e4f183f99d0fe7237a7f42ddfc Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:52 +0200 Subject: Add some simple gentoo specific tests --- spec/classes/munin_host_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/classes/munin_host_spec.rb') diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index b707b5d..df002ce 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -34,4 +34,14 @@ describe 'munin::host' do context 'on redhat-like system' do it_behaves_like 'redhat-host', 'CentOS', '6' end + + context 'on Gentoo' do + let(:facts) {{ + :osfamily => 'Gentoo', + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } + it { should contain_class('munin::host') } + end end -- cgit v1.2.3