Skip to contentSkip to conversation

tests: add stateful object update operation test

PATCH New Fernando Fernandez Mancera 1 participant 1 message Nov 2, 2019 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: add stateful object update operation test

---
 .../optionals/update_object_handles_0         | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 tests/shell/testcases/optionals/update_object_handles_0
tests/shell/testcases/optionals/update_object_handles_0 new file +25 -0
new file mode 100755
index 0000000..17c0c86
@@ -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
Signature · 1 line
2.20.1