Add rspecs and travis integration

This commit is contained in:
Javier Bértoli
2013-04-27 15:04:40 -03:00
parent a269760a8b
commit 9a1a8a188a
7 changed files with 69 additions and 89 deletions
@@ -18,56 +18,50 @@ describe 'fail2ban' do
it { should contain_package('fail2ban').with_ensure('1.0.42') }
end
describe 'Test standard installation with monitoring and firewalling' do
let(:params) { {:monitor => true , :firewall => true, :port => '42', :protocol => 'tcp' } }
describe 'Test standard installation with monitoring' do
let(:params) { {:monitor => true } }
it { should contain_package('fail2ban').with_ensure('present') }
it { should contain_service('fail2ban').with_ensure('running') }
it { should contain_service('fail2ban').with_enable('true') }
it { should contain_file('fail2ban.conf').with_ensure('present') }
it { should contain_monitor__process('fail2ban_process').with_enable('true') }
it { should contain_firewall('fail2ban_tcp_42').with_enable('true') }
end
describe 'Test decommissioning - absent' do
let(:params) { {:absent => true, :monitor => true , :firewall => true, :port => '42', :protocol => 'tcp'} }
let(:params) { {:absent => true, :monitor => true } }
it 'should remove Package[fail2ban]' do should contain_package('fail2ban').with_ensure('absent') end
it 'should stop Service[fail2ban]' do should contain_service('fail2ban').with_ensure('stopped') end
it 'should not enable at boot Service[fail2ban]' do should contain_service('fail2ban').with_enable('false') end
it 'should remove fail2ban configuration file' do should contain_file('fail2ban.conf').with_ensure('absent') end
it { should contain_monitor__process('fail2ban_process').with_enable('false') }
it { should contain_firewall('fail2ban_tcp_42').with_enable('false') }
end
describe 'Test decommissioning - disable' do
let(:params) { {:disable => true, :monitor => true , :firewall => true, :port => '42', :protocol => 'tcp'} }
let(:params) { {:disable => true, :monitor => true } }
it { should contain_package('fail2ban').with_ensure('present') }
it 'should stop Service[fail2ban]' do should contain_service('fail2ban').with_ensure('stopped') end
it 'should not enable at boot Service[fail2ban]' do should contain_service('fail2ban').with_enable('false') end
it { should contain_file('fail2ban.conf').with_ensure('present') }
it { should contain_monitor__process('fail2ban_process').with_enable('false') }
it { should contain_firewall('fail2ban_tcp_42').with_enable('false') }
end
describe 'Test decommissioning - disableboot' do
let(:params) { {:disableboot => true, :monitor => true , :firewall => true, :port => '42', :protocol => 'tcp'} }
let(:params) { {:disableboot => true, :monitor => true } }
it { should contain_package('fail2ban').with_ensure('present') }
it { should_not contain_service('fail2ban').with_ensure('present') }
it { should_not contain_service('fail2ban').with_ensure('absent') }
it 'should not enable at boot Service[fail2ban]' do should contain_service('fail2ban').with_enable('false') end
it { should contain_file('fail2ban.conf').with_ensure('present') }
it { should contain_monitor__process('fail2ban_process').with_enable('false') }
it { should contain_firewall('fail2ban_tcp_42').with_enable('true') }
end
describe 'Test noops mode' do
let(:params) { {:noops => true, :monitor => true , :firewall => true, :port => '42', :protocol => 'tcp'} }
let(:params) { {:noops => true, :monitor => true } }
it { should contain_package('fail2ban').with_noop('true') }
it { should contain_service('fail2ban').with_noop('true') }
it { should contain_file('fail2ban.conf').with_noop('true') }
it { should contain_monitor__process('fail2ban_process').with_noop('true') }
it { should contain_monitor__process('fail2ban_process').with_noop('true') }
it { should contain_monitor__port('fail2ban_tcp_42').with_noop('true') }
it { should contain_firewall('fail2ban_tcp_42').with_noop('true') }
end
describe 'Test customizations - template' do
@@ -117,39 +111,30 @@ describe 'fail2ban' do
it { should contain_monitor__process('fail2ban_process').with_tool('puppi') }
end
describe 'Test Firewall Tools Integration' do
let(:params) { {:firewall => true, :firewall_tool => "iptables" , :protocol => "tcp" , :port => "42" } }
it { should contain_firewall('fail2ban_tcp_42').with_tool('iptables') }
end
describe 'Test OldGen Module Set Integration' do
let(:params) { {:monitor => "yes" , :monitor_tool => "puppi" , :firewall => "yes" , :firewall_tool => "iptables" , :puppi => "yes" , :port => "42" , :protocol => 'tcp' } }
let(:params) { {:monitor => "yes" , :monitor_tool => "puppi", :puppi => "yes" } }
it { should contain_monitor__process('fail2ban_process').with_tool('puppi') }
it { should contain_firewall('fail2ban_tcp_42').with_tool('iptables') }
it { should contain_puppi__ze('fail2ban').with_ensure('present') }
end
describe 'Test params lookup' do
let(:facts) { { :monitor => true , :ipaddress => '10.42.42.42' } }
let(:params) { { :port => '42' } }
it 'should honour top scope global vars' do should contain_monitor__process('fail2ban_process').with_enable('true') end
end
describe 'Test params lookup' do
let(:facts) { { :fail2ban_monitor => true , :ipaddress => '10.42.42.42' } }
let(:params) { { :port => '42' } }
it 'should honour module specific vars' do should contain_monitor__process('fail2ban_process').with_enable('true') end
end
describe 'Test params lookup' do
let(:facts) { { :monitor => false , :fail2ban_monitor => true , :ipaddress => '10.42.42.42' } }
let(:params) { { :port => '42' } }
it 'should honour top scope module specific over global vars' do should contain_monitor__process('fail2ban_process').with_enable('true') end
end
describe 'Test params lookup' do
let(:facts) { { :monitor => false , :ipaddress => '10.42.42.42' } }
let(:params) { { :monitor => true , :firewall => true, :port => '42' } }
let(:params) { { :monitor => true } }
it 'should honour passed params over global vars' do should contain_monitor__process('fail2ban_process').with_enable('true') end
end