From: Alexandre Knecht Date: Tue, 20 Jan 2026 19:53:03 +0000 (+0100) Subject: tests: shell: add JSON test for handle-based rule positioning X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e7c152fc87da9982efde03c810fef23fc419fe0;p=thirdparty%2Fnftables.git tests: shell: add JSON test for handle-based rule positioning 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 Signed-off-by: Phil Sutter --- 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 - <