summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/cache
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-05-12 16:19:56 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2021-05-12 16:31:05 +0200
commit78f57fda439d942a02b658539fbdd9e119c1187b (patch)
tree3e59b1c723018c43babf5887b36ff02721ca770d /tests/shell/testcases/cache
parentfa1d5b344a9b30d9071909e1d4cc3343ba45fc97 (diff)
tests: shell: don't assume fixed handle value in cache/0008_delete_by_handle_0
This test is occasionally reporting warning in one of my test boxes. Update this test to extract the handle from ruleset listing, use rudimentary invocation of the cut command to work around this. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/cache')
-rwxr-xr-xtests/shell/testcases/cache/0008_delete_by_handle_015
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/shell/testcases/cache/0008_delete_by_handle_0 b/tests/shell/testcases/cache/0008_delete_by_handle_0
index 24b2607b..529d6b85 100755
--- a/tests/shell/testcases/cache/0008_delete_by_handle_0
+++ b/tests/shell/testcases/cache/0008_delete_by_handle_0
@@ -3,18 +3,23 @@
set -e
$NFT add table t
-$NFT delete table handle 1
+HANDLE=`$NFT -a list ruleset | grep "table.*handle" | cut -d' ' -f7`
+$NFT delete table handle $HANDLE
$NFT add table t
$NFT add chain t c
-$NFT delete chain t handle 1
+HANDLE=`$NFT -a list ruleset | grep "chain.*handle" | cut -d' ' -f6`
+$NFT delete chain t handle $HANDLE
$NFT add set t s { type ipv4_addr\; }
-$NFT delete set t handle 2
+HANDLE=`$NFT -a list ruleset | grep "set.*handle" | cut -d' ' -f6`
+$NFT delete set t handle $HANDLE
$NFT add flowtable t f { hook ingress priority 0\; }
-$NFT delete flowtable t handle 4
+HANDLE=`$NFT -a list ruleset | grep "flowtable.*handle" | cut -d' ' -f6`
+$NFT delete flowtable t handle $HANDLE
$NFT add counter t x
-$NFT delete counter t handle 5
+HANDLE=`$NFT -a list ruleset | grep "counter.*handle" | cut -d' ' -f6`
+$NFT delete counter t handle $HANDLE