Skip to content

Commit

Permalink
Merge pull request #455 from cmurphy/fix_tests
Browse files Browse the repository at this point in the history
Fix puppet resource acceptance tests
  • Loading branch information
Morgan Haskel committed Dec 30, 2014
2 parents 8b5a8ab + d0f4c84 commit 27c9d55
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions spec/acceptance/resource_cmd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
# existing ruleset scenarios. This will give the parsing capabilities of the
# code a good work out.
describe 'puppet resource firewall command:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
before(:all) do
# In order to properly check stderr for anomalies we need to fix the deprecation warnings from puppet.conf.
config = shell('puppet config print config').stdout
shell("sed -i -e \'s/^templatedir.*$//\' #{config}")
end

context 'make sure it returns no errors when executed on a clean machine' do
it do
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, some boxes come with rules, that is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand Down Expand Up @@ -38,7 +44,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -53,7 +59,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -70,7 +76,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -85,7 +91,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -103,7 +109,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -122,7 +128,7 @@
shell('puppet resource firewall') do |r|
r.exit_code.should be_zero
# don't check stdout, testing preexisting rules, output is normal
# don't check stderr, puppet throws deprecation warnings
r.stderr.should be_empty
end
end
end
Expand All @@ -132,8 +138,13 @@
if default['platform'] !~ /el-5/
context 'dport/sport with ip6tables' do
before :all do
if fact('osfamily') == 'Debian'
shell('echo "iptables-persistent iptables-persistent/autosave_v4 boolean false" | debconf-set-selections')
shell('echo "iptables-persistent iptables-persistent/autosave_v6 boolean false" | debconf-set-selections')
shell('apt-get install iptables-persistent -y')
end
ip6tables_flush_all_tables
shell('ip6tables -A INPUT -d fe80::/64 -p udp -m udp --dport 546 --sport 547 -j ACCEPT')
shell('ip6tables -A INPUT -d fe80::/64 -p tcp -m tcp --dport 546 --sport 547 -j ACCEPT -m comment --comment 000-foobar')
end
it do
shell('puppet resource firewall \'000-foobar\' provider=ip6tables') do |r|
Expand Down

0 comments on commit 27c9d55

Please sign in to comment.