From a4dab4ecde114e0b3a6537a5cc7accd60dd25f17 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 9 May 2018 16:03:43 +0200 Subject: tests/shell: Extend rule_management/0001addposition_0 Combine it with 0002insertposition_0 due to the many similarities, extend it to test 'handle' and 'index' parameters as well and rename the testcase accordingly. Also add a new 0002addinsertlocation_1 which tests that wrong argument to all of the location parameters fails. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- .../rule_management/0002addinsertlocation_1 | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tests/shell/testcases/rule_management/0002addinsertlocation_1 (limited to 'tests/shell/testcases/rule_management/0002addinsertlocation_1') diff --git a/tests/shell/testcases/rule_management/0002addinsertlocation_1 b/tests/shell/testcases/rule_management/0002addinsertlocation_1 new file mode 100755 index 00000000..b48d3d66 --- /dev/null +++ b/tests/shell/testcases/rule_management/0002addinsertlocation_1 @@ -0,0 +1,23 @@ +#!/bin/bash + +# test rule adding with invalid position/handle/index value + +RULESET="flush ruleset +table ip t { + chain c { + accept + accept + } +}" + +$NFT -f - <<< "$RULESET" + +for cmd in add insert; do + for keyword in position handle index; do + $NFT $cmd rule t c $keyword 5 drop 2>/dev/null || continue + + echo "E: invalid $keyword value allowed in $cmd command" >&2 + exit 0 + done +done +exit 1 -- cgit v1.2.3