Add comprehensive test for JSON handle-based rule positioning to verify the handle field correctly positions rules with explicit add/insert commands while being ignored in implicit format. Test coverage: 1. ADD with handle positions AFTER the specified handle 2. INSERT with handle positions BEFORE the specified handle 3. INSERT without handle positions at beginning 4. Multiple commands in single transaction (batch behavior) 5. Implicit format ignores handle field for portability The test uses sed for handle extraction and nft -f format for setup as suggested in code review. Final state is a table with two rules from the implicit format test. Signed-off-by: Alexandre Knecht --- .../testcases/json/0008rule_position_handle_0 | 162 ++++++++++++++++++ .../dumps/0008rule_position_handle_0.json-nft | 76 ++++++++ .../json/dumps/0008rule_position_handle_0.nft | 6 + 3 files changed, 244 insertions(+) create mode 100755 tests/shell/testcases/json/0008rule_position_handle_0 create mode 100644 tests/shell/testcases/json/dumps/0008rule_position_handle_0.json-nft create mode 100644 tests/shell/testcases/json/dumps/0008rule_position_handle_0.nft diff --git a/tests/shell/testcases/json/0008rule_position_handle_0 b/tests/shell/testcases/json/0008rule_position_handle_0 new file mode 100755 index 00000000..32a3752c --- /dev/null +++ b/tests/shell/testcases/json/0008rule_position_handle_0 @@ -0,0 +1,162 @@ +#!/bin/bash + +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_json) + +# Test JSON handle-based rule positioning +# Verifies explicit format uses handle for positioning while implicit format ignores it + +set -e + +$NFT flush ruleset + +echo "Test 1: ADD with handle positions AFTER" +$NFT -f - <