Skip to content

Commit

Permalink
Merge pull request puppetlabs#186 from kbarber/log_level
Browse files Browse the repository at this point in the history
Add extra tests for logging parameters
  • Loading branch information
kbarber committed May 23, 2013
2 parents 7d37d6a + 53faae9 commit ef975da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-system-puppet', '~>1.0.0'
gem 'rspec-system-puppet', '~>1.1', '>=1.1.0'
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
33 changes: 28 additions & 5 deletions spec/system/params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

describe "param based tests:" do
def pp(params)
name = params.delete('name') || '100 test'
pm = <<-EOS
firewall { '100 test':
firewall { '#{name}':
EOS

params.each do |k,v|
Expand All @@ -18,20 +19,21 @@ def pp(params)
pm
end

it 'test socket param' do
it 'test various params' do
facts = system_node.facts

unless (facts['operatingsystem'] == 'CentOS') && \
facts['operatingsystemrelease'] =~ /^5\./ then

iptables_flush_all_tables

param = {
ppm = pp({
'table' => "'raw'",
'socket' => 'true',
'chain' => "'PREROUTING'",
}
ppm = pp(param)
'jump' => 'LOG',
'log_level' => 'debug',
})
puppet_apply(ppm) do |r|
r[:stderr].should == ''
r[:exit_code].should == 2
Expand All @@ -45,4 +47,25 @@ def pp(params)
end
end

it 'test log rule' do
iptables_flush_all_tables

ppm = pp({
'name' => '998 log all',
'proto' => 'all',
'jump' => 'LOG',
'log_level' => 'debug',
})
puppet_apply(ppm) do |r|
r.stderr.should == ''
r.exit_code.should == 2
end

# check idempotency
puppet_apply(ppm) do |r|
r.stderr.should == ''
r.exit_code.should == 0
end
end

end

0 comments on commit ef975da

Please sign in to comment.