summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVarsha Rao <rvarsha016@gmail.com>2017-10-05 13:36:46 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2017-10-06 14:34:50 +0200
commit411ddf7a41049496eab4139a6fc9fc916268860c (patch)
tree084d4b7049ba219412d4518bb3e641cfe1fb44e1 /tests
parent6b99679798576f159d7160312cf474cb15b8d2a4 (diff)
tests: shell: Add tests for chain rename.
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>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/shell/testcases/chains/0013rename_08
-rwxr-xr-xtests/shell/testcases/chains/0014rename_114
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/shell/testcases/chains/0013rename_0 b/tests/shell/testcases/chains/0013rename_0
new file mode 100755
index 00000000..b9fe11ad
--- /dev/null
+++ b/tests/shell/testcases/chains/0013rename_0
@@ -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
index 00000000..e29e7889
--- /dev/null
+++ b/tests/shell/testcases/chains/0014rename_1
@@ -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