Skip to content

Commit 8d78a70

Browse files
committed
1 parent f5611f9 commit 8d78a70

File tree

5 files changed

+46
-38
lines changed

5 files changed

+46
-38
lines changed

.kitchen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ provisioner:
77
data_path: test/shared
88

99
platforms:
10-
- name: centos-6.5
10+
- name: ubuntu-16.04
1111

1212
suites:
1313
- name: default
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
require_relative '../../../kitchen/data/spec_helper'
1+
require "serverspec"
2+
3+
set :backend, :exec
24

35
describe iptables do
46
it { should have_rule('-A INPUT -j simple_rule') }
5-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
6-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
7-
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
7+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
8+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
9+
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -m comment --comment rule_in_forward_chain -j ACCEPT') }
810
it { should have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
9-
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
10-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
11-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
11+
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -m comment --comment jump_with_rule -j ACCEPT') }
12+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
13+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
1214
it { should have_rule('-A INPUT -j array_of_rules') }
13-
end
15+
end
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
require_relative '../../../kitchen/data/spec_helper'
1+
require 'serverspec'
2+
3+
set :backend, :exec
24

35
describe iptables do
46
it { should have_rule('-A INPUT -j simple_rule') }
5-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
6-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
7-
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
7+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
8+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
9+
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -m comment --comment rule_in_forward_chain -j ACCEPT') }
10+
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -m comment --comment jump_with_rule -j ACCEPT') }
11+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
12+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
813
it { should have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
9-
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
10-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
11-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
1214
it { should have_rule('-A INPUT -j array_of_rules') }
1315
end
1416

1517
describe ip6tables do
1618
it { should have_rule('-A INPUT -j simple_rule') }
17-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
18-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
19+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
20+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
1921
it { should_not have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
2022
it { should_not have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
2123
it { should_not have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
22-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
23-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
24+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
25+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
2426
it { should have_rule('-A INPUT -j array_of_rules') }
2527
end

test/integration/ipv6_list_of_tables/serverspec/list_of_tables_spec.rb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
require_relative '../../../kitchen/data/spec_helper'
1+
require 'serverspec'
2+
3+
set :backend, :exec
24

35
describe iptables do
46
it { should have_rule('-A INPUT -j simple_rule') }
5-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
6-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
7-
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
7+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
8+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
9+
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -m comment --comment rule_in_forward_chain -j ACCEPT') }
810
it { should have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
9-
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
10-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
11-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
11+
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -m comment --comment jump_with_rule -j ACCEPT') }
12+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
13+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
1214
it { should have_rule('-A INPUT -j array_of_rules') }
1315
it { should_not have_rule('*nat') }
1416
it { should have_rule('*mangle') }
@@ -18,13 +20,13 @@
1820

1921
describe ip6tables do
2022
it { should have_rule('-A INPUT -j simple_rule') }
21-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
22-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
23+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
24+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
2325
it { should_not have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
2426
it { should_not have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
2527
it { should_not have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
26-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
27-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
28+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
29+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
2830
it { should have_rule('-A INPUT -j array_of_rules') }
2931
it { should_not have_rule('*nat') }
3032
it { should have_rule('*mangle') }

test/integration/list_of_tables/serverspec/list_of_tables_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
require_relative '../../../kitchen/data/spec_helper'
1+
require 'serverspec'
2+
3+
set :backend, :exec
24

35
describe iptables do
46
it { should have_rule('-A INPUT -j simple_rule') }
5-
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -j ACCEPT') }
6-
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -j ACCEPT') }
7-
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -j ACCEPT') }
7+
it { should have_rule('-A simple_rule -p tcp -m tcp --dport 80 -m comment --comment simple_rule -j ACCEPT') }
8+
it { should have_rule('-A INPUT -p tcp -m tcp --dport 81 -m comment --comment rule_in_input_chain -j ACCEPT') }
9+
it { should have_rule('-A FORWARD -p tcp -m tcp --dport 82 -m comment --comment rule_in_forward_chain -j ACCEPT') }
810
it { should have_rule('-A INPUT -m state --state NEW -j jump_with_rule') }
9-
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -j ACCEPT') }
10-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -j ACCEPT') }
11-
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -j ACCEPT') }
11+
it { should have_rule('-A jump_with_rule -p tcp -m tcp --dport 83 -m comment --comment jump_with_rule -j ACCEPT') }
12+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 84 -m comment --comment array_of_rules -j ACCEPT') }
13+
it { should have_rule('-A array_of_rules -p tcp -m tcp --dport 85 -m comment --comment array_of_rules -j ACCEPT') }
1214
it { should have_rule('-A INPUT -j array_of_rules') }
1315
it { should_not have_rule('*nat') }
1416
it { should have_rule('*mangle') }

0 commit comments

Comments
 (0)