summaryrefslogtreecommitdiffstats
path: root/tests/shell
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-08-24 16:45:07 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-08-25 14:22:32 +0200
commit83bc02b9c03a71559b3c47a0bf971a558c9ee56b (patch)
tree71412280ca4a09e3c6bce0c0b07a4fdc747d9c70 /tests/shell
parentfd33d964a94063d7af6f1713350df980cf440503 (diff)
tests: shell: cover add and create set command
This patch validates that creation of an already existing element bails out with EEXIST. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell')
-rwxr-xr-xtests/shell/testcases/sets/0007create_element_015
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/0007create_element_0 b/tests/shell/testcases/sets/0007create_element_0
new file mode 100755
index 00000000..47b3559c
--- /dev/null
+++ b/tests/shell/testcases/sets/0007create_element_0
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# This testcase checks for add and create element commands.
+
+set -e
+$NFT add table t
+$NFT add set t s { type ipv4_addr \; }
+$NFT add element t s { 1.1.1.1 }
+if $NFT create element t s { 1.1.1.1 } 2>/dev/null ; then
+ echo "E: accepted element creation that already exists" >&2
+ exit 1
+fi
+$NFT add element t s { 1.1.1.1 }
+
+exit 0