diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2018-01-15 17:21:33 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-03-05 16:41:07 +0100 |
commit | 72af184f146829a8bf8d0c9d68f990e9e030ec0f (patch) | |
tree | d531ec1c04087482582a4b40197b88e81acef7c4 /tests/shell/testcases/sets/0028delete_handle_0 | |
parent | 226aee27c209f52ea947473f5b4b9980596e2fc6 (diff) |
tests/shell: add tests for deletion of sets via set handle
Delete set with given unique set handle.
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/sets/0028delete_handle_0')
-rwxr-xr-x | tests/shell/testcases/sets/0028delete_handle_0 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/0028delete_handle_0 b/tests/shell/testcases/sets/0028delete_handle_0 new file mode 100755 index 00000000..215323ce --- /dev/null +++ b/tests/shell/testcases/sets/0028delete_handle_0 @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e +$NFT add table test-ip +$NFT add set test-ip x { type ipv4_addr\; } # should have handle 1 +$NFT add set test-ip y { type inet_service \; timeout 3h45s \;} # should have handle 2 +$NFT add set test-ip z { type ipv4_addr\; flags constant , interval\;} # should have handle 3 +$NFT add set test-ip c {type ipv4_addr \; flags timeout \; elements={192.168.1.1 timeout 10s, 192.168.1.2 timeout 30s} \;} #should have handle 4 +$NFT delete set test-ip handle 4 + +EXPECTED="table ip test-ip { + set x { + type ipv4_addr + } + + set y { + type inet_service + timeout 3h45s + } + + set z { + type ipv4_addr + flags constant,interval + } +}" + +GET="$($NFT list ruleset)" + +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi |