]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: Add tests for chain rename.
authorVarsha Rao <rvarsha016@gmail.com>
Thu, 5 Oct 2017 08:06:46 +0000 (13:36 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 6 Oct 2017 12:34:50 +0000 (14:34 +0200)
This patch adds test cases for renaming chain with existing and non
existing chains.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/chains/0013rename_0 [new file with mode: 0755]
tests/shell/testcases/chains/0014rename_1 [new file with mode: 0755]

diff --git a/tests/shell/testcases/chains/0013rename_0 b/tests/shell/testcases/chains/0013rename_0
new file mode 100755 (executable)
index 0000000..b9fe11a
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+$NFT add chain t c1
+# kernel should not return EEXIST
+$NFT rename chain t c1 c2
diff --git a/tests/shell/testcases/chains/0014rename_1 b/tests/shell/testcases/chains/0014rename_1
new file mode 100755 (executable)
index 0000000..e29e788
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+$NFT add chain t c1
+$NFT add chain t c2
+# kernel should return EEXIST
+$NFT rename chain t c1 c2
+
+if [ $? -eq 0 ] ; then
+       echo "E: Renamed with existing chain" >&2
+       exit 0
+fi