From 03faa54f1c7ea9836556447158b143f5fd17e1f1 Mon Sep 17 00:00:00 2001 From: Eric Garver Date: Tue, 10 Sep 2019 09:43:27 -0400 Subject: tests: shell: add huge JSON transaction Expand the test case to also check for returned rule handles in the JSON output. Signed-off-by: Eric Garver Signed-off-by: Phil Sutter --- 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 27912495..f029ee3c 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 -- cgit v1.2.3