diff options
author | Dave Simons <dave@inuits.eu> | 2013-07-12 10:52:06 +0200 |
---|---|---|
committer | Dave Simons <dave@inuits.eu> | 2013-07-12 14:04:12 +0200 |
commit | ca913f8a265ea78ca4acae484ff2e817c668d14c (patch) | |
tree | eee0120ac5a7dbead1e8dc2b43f44a45a6e9e6ae /spec | |
parent | 07e7ca64d92c2b6376287232cd9bde687c0e9be9 (diff) |
fixup spec tests for Archlinux
Signed-off-by: Dave Simons <dave@inuits.eu>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/classes/ntp_config_spec.rb | 44 | ||||
-rw-r--r-- | spec/classes/ntp_install_spec.rb | 22 | ||||
-rw-r--r-- | spec/classes/ntp_service_spec.rb | 6 |
3 files changed, 24 insertions, 48 deletions
diff --git a/spec/classes/ntp_config_spec.rb b/spec/classes/ntp_config_spec.rb index 80bee42..eec939f 100644 --- a/spec/classes/ntp_config_spec.rb +++ b/spec/classes/ntp_config_spec.rb @@ -78,6 +78,21 @@ describe 'ntp::config' do (content.split("\n") & expected_lines).should == expected_lines end + describe "for operating system family Archlinux" do + + let(:params) {{}} + let(:facts) {{ :osfamily => 'Archlinux' }} + + it 'should use the NTP pool servers by default' do + content = param_value(subject, 'file', '/etc/ntp.conf', 'content') + expected_lines = [ + "server 0.pool.ntp.org", + "server 1.pool.ntp.org", + "server 2.pool.ntp.org"] + (content.split("\n") & expected_lines).should == expected_lines + end + end + describe "for operating system family unsupported" do let(:facts) {{ :osfamily => 'unsupported', @@ -93,9 +108,8 @@ describe 'ntp::config' do describe 'for virtual machines' do let(:params) {{}} - let(:facts) {{ :operatingsystem => 'Archlinux', - :osfamily => 'Linux', - :is_virtual => true }} + let(:facts) {{ :osfamily => 'Archlinux', + :is_virtual => true }} it 'should not use local clock as a time source' do content = param_value(subject, 'file', '/etc/ntp.conf', 'content') @@ -116,9 +130,8 @@ describe 'ntp::config' do describe 'for physical machines' do let(:params) {{}} - let(:facts) {{ :operatingsystem => 'Archlinux', - :osfamily => 'Linux', - :is_virtual => false }} + let(:facts) {{ :osfamily => 'Archlinux', + :is_virtual => false }} it 'disallows large clock skews' do content = param_value(subject, 'file', '/etc/ntp.conf', 'content') @@ -128,23 +141,6 @@ describe 'ntp::config' do end - describe "for operating system Archlinux" do - - let(:params) {{}} - let(:facts) {{ :operatingsystem => 'Archlinux', - :osfamily => 'Linux' }} - - - it 'should use the NTP pool servers by default' do - content = param_value(subject, 'file', '/etc/ntp.conf', 'content') - expected_lines = [ - "server 0.pool.ntp.org", - "server 1.pool.ntp.org", - "server 2.pool.ntp.org"] - (content.split("\n") & expected_lines).should == expected_lines - end - end - describe "for operating system Gentoo" do let(:params) {{}} @@ -163,7 +159,7 @@ describe 'ntp::config' do end end - ['Debian', 'RedHat','SuSE', 'FreeBSD'].each do |osfamily| + ['Debian', 'RedHat','SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily| describe "for operating system family #{osfamily}" do let(:facts) {{ :osfamily => osfamily }} diff --git a/spec/classes/ntp_install_spec.rb b/spec/classes/ntp_install_spec.rb index 2102878..4ed263e 100644 --- a/spec/classes/ntp_install_spec.rb +++ b/spec/classes/ntp_install_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'ntp::install' do - ['Debian', 'RedHat', 'SuSE', 'FreeBSD'].each do |osfamily| + ['Debian', 'RedHat', 'SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily| describe "for osfamily #{osfamily}" do let(:facts) {{ :osfamily => osfamily }} @@ -49,24 +49,4 @@ describe 'ntp::install' do end - describe "for distribution archlinux" do - - let(:facts) {{ :osfamily => 'Linux', :operatingsystem => 'ArchLinux' }} - let(:params) {{ - :package_ensure => 'present', - :package_name => 'ntp', - }} - - it { should contain_package('ntp').with( - :ensure => 'present', - :name => 'ntp' - )} - - it 'should allow package ensure to be overridden' do - params[:package_ensure] = 'latest' - subject.should contain_package('ntp').with_ensure('latest') - end - - end - end diff --git a/spec/classes/ntp_service_spec.rb b/spec/classes/ntp_service_spec.rb index 7ce1717..bbf9dd1 100644 --- a/spec/classes/ntp_service_spec.rb +++ b/spec/classes/ntp_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'ntp::service' do - ['Debian', 'RedHat', 'SuSE', 'FreeBSD'].each do |osfamily| + ['Debian', 'RedHat', 'SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily| describe "for osfamily #{osfamily}" do let(:facts) {{ :osfamily => osfamily }} @@ -10,7 +10,7 @@ describe 'ntp::service' do :service_manage => true, :service_enable => true, :service_ensure => 'running', - :service_name => 'ntp' + :service_name => 'ntp' }} it { should contain_service('ntp').with( @@ -26,7 +26,7 @@ describe 'ntp::service' do end end - ['ArchLinux', 'Gentoo'].each do |operatingsystem| + ['Gentoo'].each do |operatingsystem| describe "for distribution #{operatingsystem}" do let(:facts) {{ :osfamily => 'Linux', :operatingsystem => operatingsystem }} |