Add specs
This commit is contained in:
@@ -28,8 +28,8 @@ describe 'fail2ban' do
|
||||
let(:facts) { {:operatingsystem => 'Debian' } }
|
||||
let(:params) { {:jails_config => 'file', :jails_template => 'fail2ban/jail.local.erb', :jails => 'ssh' } }
|
||||
it { should contain_file('jail.local').without_source }
|
||||
it { should contain_file('jail.local').with_content(/"*ssh-iptables]
|
||||
enabled = true*/) }
|
||||
it { should contain_file('jail.local').with_content(/ssh-iptables\]
|
||||
enabled = true/) }
|
||||
end
|
||||
|
||||
describe 'Test jails managed throuh file - custom template' do
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
|
||||
|
||||
describe 'fail2ban::jail' do
|
||||
|
||||
let(:title) { 'fail2ban::jail' }
|
||||
let(:node) { 'rspec.example42.com' }
|
||||
let(:facts) { { :ipaddress => '10.42.42.42', :jails_file => '/etc/fail2ban/jail.local', :concat_basedir => '/var/lib/puppet/concat'} }
|
||||
|
||||
describe 'Test basic jail.local is created' do
|
||||
let(:params) { { :name => 'sample1',
|
||||
:port => '42',
|
||||
:logpath => '/path/to/somelog',
|
||||
:enable => true, } }
|
||||
|
||||
it { should include_class('concat::setup') }
|
||||
# it { should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content(/*port = 42
|
||||
#logpath = \/path\/to\/somelog*/) }
|
||||
it { should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content("##################\n[fail2ban::jail]\nenabled = true\nfilter = fail2ban::jail\nport = 42\nlogpath = /path/to/somelog\n\n") }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user