Skip to content

Commit f657029

Browse files
committed
Kitchen test fixup
1 parent 4c6de92 commit f657029

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

test/cookbooks/test/recipes/rule-line-number.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
end
2525

2626
# This should be the first rule now
27-
iptables_rule 'Allow from loopback interface' do
27+
iptables_rule 'Allow from ethernet interface' do
2828
table :filter
2929
chain :INPUT
3030
ip_version 'ipv4'

test/cookbooks/test/recipes/rules.rb

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
action :enable
99
delayed_action :start
1010

11+
cookbook 'test'
12+
sensitive false
13+
1114
subscribes :restart, 'template[/etc/sysconfig/iptables]', :delayed
1215
subscribes :restart, 'template[/etc/iptables/rules.v4]', :delayed
1316
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Chef Infra Client
2+
# Do NOT modify this file by hand.
3+
#
4+
# I'm from the test cookbook
5+
#
6+
7+
<% unless nil_or_empty?(@iptables) -%>
8+
<% @iptables.each do |table, data| -%>
9+
<% next if nil_or_empty?(data) -%>
10+
*<%= table %>
11+
<% unless nil_or_empty?(data[:chains]) -%>
12+
<% data[:chains].each do |chain, value| -%>
13+
:<%= chain %> <%= value %>
14+
<% end -%>
15+
<% end -%>
16+
<% unless nil_or_empty?(data[:rules]) -%>
17+
<% data[:rules].each do |rule| -%>
18+
<%= rule %>
19+
<% end -%>
20+
<% end -%>
21+
COMMIT
22+
23+
<% end -%>
24+
<% end -%>

test/integration/rules/rules.rb

+4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
when 'debian', 'ubuntu'
33
describe file('/etc/iptables/rules.v4') do
44
it { should exist }
5+
its(:content) { should match /# I'm from the test cookbook/ }
56
end
67
describe service('netfilter-persistent') do
78
it { should be_installed }
89
it { should be_running }
910
it { should be_enabled }
1011
end
1112
when 'redhat', 'fedora'
13+
describe file('/etc/sysconfig/iptables') do
14+
its(:content) { should match /# I'm from the test cookbook/ }
15+
end
1216
describe file('/etc/sysconfig/iptables-config') do
1317
its(:content) { should match /IPTABLES_STATUS_VERBOSE="no"/ }
1418
end

0 commit comments

Comments
 (0)