]> git.ipfire.org Git - thirdparty/nftables.git/commit
tests: shell: add JSON test for handle-based rule positioning
authorAlexandre Knecht <knecht.alexandre@gmail.com>
Tue, 20 Jan 2026 19:53:03 +0000 (20:53 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 20 Jan 2026 22:53:49 +0000 (23:53 +0100)
commit7e7c152fc87da9982efde03c810fef23fc419fe0
treed3c2e76ef629bbaadffd4a258841f65ee3b44713
parent72db5e53f386b018b94ca45d1b311ae17a9586d8
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 <knecht.alexandre@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
tests/shell/testcases/json/0008rule_position_handle_0 [new file with mode: 0755]
tests/shell/testcases/json/dumps/0008rule_position_handle_0.json-nft [new file with mode: 0644]
tests/shell/testcases/json/dumps/0008rule_position_handle_0.nft [new file with mode: 0644]