Expand the test case to also check for returned rule handles in the JSON
output.

Signed-off-by: Eric Garver <e...@garver.life>
---
 tests/shell/testcases/transactions/0049huge_0 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/shell/testcases/transactions/0049huge_0 
b/tests/shell/testcases/transactions/0049huge_0
index 2791249512b6..f029ee3c54d7 100755
--- a/tests/shell/testcases/transactions/0049huge_0
+++ b/tests/shell/testcases/transactions/0049huge_0
@@ -13,3 +13,19 @@ for ((i = 0; i < ${RULE_COUNT}; i++)); do
 done
 )
 test $($NFT -e -a -f - <<< "$RULESET" |grep "#[ ]\+handle[ ]\+[0-9]\+" |wc -l) 
-eq ${RULE_COUNT} || exit 1
+
+# same thing, but with JSON rules
+#
+$NFT flush ruleset
+$NFT add table inet test
+$NFT add chain inet test c
+
+RULESET=$(
+echo '{"nftables": ['
+for ((i = 0; i < $((${RULE_COUNT} - 1)); i++)); do
+       echo '{"add": {"rule": {"family": "inet", "table": "test", "chain": 
"c", "expr": [{"accept": null}], "comment": "rule'$i'"}}},'
+done
+       echo '{"add": {"rule": {"family": "inet", "table": "test", "chain": 
"c", "expr": [{"accept": null}], "comment": "rule'$((${RULE_COUNT} - 1))'"}}}'
+echo ']}'
+)
+test $($NFT -j -e -a -f - <<< "$RULESET" |sed 's/\({"add":\)/\n\1/g' |grep 
'"handle"' |wc -l) -eq ${RULE_COUNT} || exit 1
-- 
2.20.1

Reply via email to