]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: skip stateful object updates if unsupported
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Nov 2023 19:29:55 +0000 (20:29 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Nov 2023 09:14:10 +0000 (10:14 +0100)
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/features/stateful_object_update.sh [new file with mode: 0755]
tests/shell/testcases/optionals/update_object_handles_0

diff --git a/tests/shell/features/stateful_object_update.sh b/tests/shell/features/stateful_object_update.sh
new file mode 100755 (executable)
index 0000000..62fbf7e
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# d62d0ba97b58 ("netfilter: nf_tables: Introduce stateful object update operation")
+# v5.4-rc1~131^2~59^2~2
+
+set -e
+$NFT add table test-ip
+$NFT add quota test-ip traffic-quota 25 mbytes
+$NFT add quota test-ip traffic-quota 50 mbytes
+
+EXPECTED="table ip test-ip {
+       quota traffic-quota {
+               50 mbytes
+       }
+}"
+
+GET="$($NFT list ruleset)"
+if [ "$EXPECTED" != "$GET" ] ; then
+       diff -u <(echo "$EXPECTED") <(echo "$GET")
+       exit 1
+fi
index 8b12b8c57cd8bb4f7b33f802cc0297e01ff71e83..ccd96779d9b331f409ac1ae723d34ef90089c524 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_stateful_object_update)
+
 set -e
 $NFT add table test-ip
 $NFT add counter test-ip traffic-counter