Skip to content
This repository
Newer
Older
100644 59 lines (49 sloc) 2.402 kb
08913b75 »
2012-09-12 First commit of Open Source release
1 Feature: Ript Setup
2
3 @sudo @timeout-10
4 Scenario: Partition chain is set up
5 Given I have no iptables rules loaded
6 When I run `ript rules diff examples/basic.rb`
7 Then the output should match:
8 """
9 iptables --table filter --new-chain partition-a
10 iptables --table filter --insert INPUT 1 --jump partition-a
11 iptables --table filter --insert OUTPUT 1 --jump partition-a
12 iptables --table filter --insert FORWARD 1 --jump partition-a
13 iptables --table nat --new-chain partition-d
14 iptables --table nat --insert PREROUTING 1 --jump partition-d
15 iptables --table nat --new-chain partition-s
16 iptables --table nat --insert POSTROUTING 1 --jump partition-s
17
18
19 # basic-\w+
20 iptables --table nat --new-chain basic-d\w+
21 iptables --table nat --new-chain basic-s\w+
22 iptables --table filter --new-chain basic-a\w+
23 """
24 Then the created chain name in all tables should match
25
26 @sudo @timeout-10
27 Scenario: Partition chain is only added once
28 Given I have no iptables rules loaded
29 When I run `ript rules apply examples/basic.rb`
30 Then the output from "ript rules apply examples/basic.rb" should match:
31 """
32 iptables --table filter --new-chain partition-a
33 iptables --table filter --insert INPUT 1 --jump partition-a
34 iptables --table filter --insert OUTPUT 1 --jump partition-a
35 iptables --table filter --insert FORWARD 1 --jump partition-a
36 iptables --table nat --new-chain partition-d
37 iptables --table nat --insert PREROUTING 1 --jump partition-d
38 iptables --table nat --new-chain partition-s
39 iptables --table nat --insert POSTROUTING 1 --jump partition-s
40
41
42 # basic-\w+
43 iptables --table nat --new-chain basic-d\w+
44 iptables --table nat --new-chain basic-s\w+
45 iptables --table filter --new-chain basic-a\w+
46 """
47 When I run `ript rules apply examples/partition-name-exactly-20-characters.rb`
48 Then the output from "ript rules apply examples/partition-name-exactly-20-characters.rb" should contain exactly:
49 """
50 # name_exactly_20_char-f9964b
51 iptables --table nat --new-chain name_exactly_20_char-df9964b
52 iptables --table nat --new-chain name_exactly_20_char-sf9964b
53 iptables --table filter --new-chain name_exactly_20_char-af9964b
54
55
56
57 """
58 Then the created chain name in all tables should match
Something went wrong with that request. Please try again.