summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases
diff options
context:
space:
mode:
authorEric Garver <eric@garver.life>2019-09-05 20:33:02 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2019-09-06 02:35:50 +0200
commit1e2aae7d73ce733650d78da452d45d6c5498cc33 (patch)
treee4cd2e04df6b5ba23789bbc91f741c96b5fb19bd /tests/shell/testcases
parent2e57d4ff79fa166f2dea3686ca4fe051b656a8d2 (diff)
tests: shell: check that rule add with index works with echo
Signed-off-by: Eric Garver <eric@garver.life> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases')
-rwxr-xr-xtests/shell/testcases/cache/0007_echo_cache_init_014
-rw-r--r--tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft7
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/shell/testcases/cache/0007_echo_cache_init_0 b/tests/shell/testcases/cache/0007_echo_cache_init_0
new file mode 100755
index 00000000..280a0d06
--- /dev/null
+++ b/tests/shell/testcases/cache/0007_echo_cache_init_0
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+$NFT -i >/dev/null <<EOF
+add table inet t
+add chain inet t c
+add rule inet t c accept comment "first"
+add rule inet t c accept comment "third"
+EOF
+
+# make sure the rule cache gets initialized when using echo option
+#
+$NFT --echo add rule inet t c index 0 accept comment '"second"' >/dev/null
diff --git a/tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft b/tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft
new file mode 100644
index 00000000..c774ee72
--- /dev/null
+++ b/tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft
@@ -0,0 +1,7 @@
+table inet t {
+ chain c {
+ accept comment "first"
+ accept comment "second"
+ accept comment "third"
+ }
+}