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_client_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 spec/classes/munin_client_spec.rb (limited to 'spec/classes/munin_client_spec.rb') 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 -- cgit v1.2.3 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 --- spec/classes/munin_client_spec.rb | 47 ++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'spec/classes/munin_client_spec.rb') 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 -- 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_client_spec.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'spec/classes/munin_client_spec.rb') diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index a5539b3..ebf8d73 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'munin::client' do - shared_examples 'debian' do |os, codename| + shared_examples 'debian-client' do |os, codename| let(:facts) {{ :operatingsystem => os, :osfamily => 'Debian', @@ -10,9 +10,10 @@ describe 'munin::client' do 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' do |os, codename| + shared_examples 'redhat-client' do |os, codename| let(:facts) {{ :operatingsystem => os, :osfamily => 'RedHat', @@ -24,13 +25,13 @@ describe 'munin::client' do 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' + 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', 'CentOS', '6' + it_behaves_like 'redhat-client', 'CentOS', '6' # not supported yet # it_behaves_like 'redhat', 'RedHat', '6' end @@ -44,6 +45,7 @@ describe 'munin::client' do }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } + it { should include_class('munin::client::gentoo') } 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_client_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/classes/munin_client_spec.rb') diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index ebf8d73..9a92cef 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -18,7 +18,6 @@ describe 'munin::client' do :operatingsystem => os, :osfamily => 'RedHat', :lsbdistcodename => codename, - :interfaces => 'lo,eth0', }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } -- 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_client_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/classes/munin_client_spec.rb') diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index 9a92cef..f7fc5e9 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -10,7 +10,7 @@ describe 'munin::client' do 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') } + it { should contain_class('munin::client::debian') } end shared_examples 'redhat-client' do |os, codename| @@ -44,7 +44,7 @@ describe 'munin::client' do }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } - it { should include_class('munin::client::gentoo') } + it { should contain_class('munin::client::gentoo') } end end -- cgit v1.2.3