summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/chains/0016delete_handle_0
diff options
context:
space:
mode:
Diffstat (limited to 'tests/shell/testcases/chains/0016delete_handle_0')
-rwxr-xr-xtests/shell/testcases/chains/0016delete_handle_020
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/shell/testcases/chains/0016delete_handle_0 b/tests/shell/testcases/chains/0016delete_handle_0
index 677fba37..4633d771 100755
--- a/tests/shell/testcases/chains/0016delete_handle_0
+++ b/tests/shell/testcases/chains/0016delete_handle_0
@@ -2,12 +2,16 @@
set -e
$NFT add table test-ip
-$NFT add chain test-ip x # should have handle 1
-$NFT add chain test-ip y # should have handle 2
-$NFT add chain test-ip z # should have handle 3
+$NFT add chain test-ip x
+$NFT add chain test-ip y
+$NFT add chain test-ip z
$NFT add table ip6 test-ip6
-$NFT add chain ip6 test-ip6 x # should have handle 1
-$NFT add chain ip6 test-ip6 y # should have handle 2
-$NFT add chain ip6 test-ip6 z # should have handle 3
-$NFT delete chain test-ip handle 2
-$NFT delete chain ip6 test-ip6 handle 3
+$NFT add chain ip6 test-ip6 x
+$NFT add chain ip6 test-ip6 y
+$NFT add chain ip6 test-ip6 z
+
+chain_y_handle=$($NFT list ruleset -a | awk -v n=1 '/chain y/ && !--n {print $NF; exit}');
+chain_z_handle=$($NFT list ruleset -a | awk -v n=2 '/chain z/ && !--n {print $NF; exit}');
+
+$NFT delete chain test-ip handle $chain_y_handle
+$NFT delete chain ip6 test-ip6 handle $chain_z_handle