]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add stateful object update operation test
authorFernando Fernandez Mancera <ffmancera@riseup.net>
Sat, 2 Nov 2019 21:00:25 +0000 (22:00 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 15 Nov 2019 23:03:06 +0000 (00:03 +0100)
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/optionals/update_object_handles_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/optionals/update_object_handles_0 b/tests/shell/testcases/optionals/update_object_handles_0
new file mode 100755 (executable)
index 0000000..17c0c86
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+$NFT add table test-ip
+$NFT add counter test-ip traffic-counter
+$NFT add counter test-ip traffic-counter
+$NFT add quota test-ip traffic-quota 25 mbytes
+$NFT add quota test-ip traffic-quota 50 mbytes
+
+EXPECTED="table ip test-ip {
+       counter traffic-counter {
+               packets 0 bytes 0
+       }
+
+       quota traffic-quota {
+               50 mbytes
+       }
+}"
+
+GET="$($NFT list ruleset)"
+if [ "$EXPECTED" != "$GET" ] ; then
+       DIFF="$(which diff)"
+       [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+       exit 1
+fi