From f6cc747991758801e4c3eb25bb06840870963cc2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 1 Aug 2023 13:35:27 +0200 Subject: tests: shell: Review test-cases for destroy command Having separate files for successful destroy of existing and non-existing objects is a bit too much, just combine them into one. While being at it: * No bashisms, using /bin/sh is fine * Append '-e' to shebang itself instead of calling 'set' * Use 'nft -a -e' instead of assuming the created rule's handle value * Shellcheck warned about curly braces, quote them Signed-off-by: Phil Sutter --- tests/shell/testcases/flowtable/0015destroy_0 | 9 ++++++--- tests/shell/testcases/flowtable/0016destroy_0 | 6 ------ tests/shell/testcases/flowtable/dumps/0016destroy_0.nft | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) delete mode 100755 tests/shell/testcases/flowtable/0016destroy_0 delete mode 100644 tests/shell/testcases/flowtable/dumps/0016destroy_0.nft (limited to 'tests/shell/testcases/flowtable') diff --git a/tests/shell/testcases/flowtable/0015destroy_0 b/tests/shell/testcases/flowtable/0015destroy_0 index 4828d818..66fce499 100755 --- a/tests/shell/testcases/flowtable/0015destroy_0 +++ b/tests/shell/testcases/flowtable/0015destroy_0 @@ -1,7 +1,10 @@ -#!/bin/bash +#!/bin/sh -e -set -e $NFT add table t -$NFT add flowtable t f { hook ingress priority 10 \; devices = { lo }\; } +# pass for non-existent flowtable +$NFT destroy flowtable t f + +# successfully delete existing flowtable +$NFT add flowtable t f '{ hook ingress priority 10; devices = { lo }; }' $NFT destroy flowtable t f diff --git a/tests/shell/testcases/flowtable/0016destroy_0 b/tests/shell/testcases/flowtable/0016destroy_0 deleted file mode 100755 index ce23c753..00000000 --- a/tests/shell/testcases/flowtable/0016destroy_0 +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e -$NFT add table t - -$NFT destroy flowtable t f diff --git a/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft b/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft deleted file mode 100644 index 985768ba..00000000 --- a/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft +++ /dev/null @@ -1,2 +0,0 @@ -table ip t { -} -- cgit v1.2.3