diff options
author | Eric Garver <eric@garver.life> | 2019-09-10 09:43:27 -0400 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2019-09-10 18:10:20 +0200 |
commit | 03faa54f1c7ea9836556447158b143f5fd17e1f1 (patch) | |
tree | f5d4a259c9f00f6515c67b9a2146a3fa5e419457 /tests | |
parent | 4266e8f3edcc65d64d4bf6182b6154ecb71c840e (diff) |
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 <eric@garver.life>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/testcases/transactions/0049huge_0 | 16 |
1 files changed, 16 insertions, 0 deletions
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 |