Hi, On Thu, Jun 23, 2022 at 02:31:44PM +0530, Chander Govindarajan wrote: > Hi Pablo, > > Would it be possible to share your changes to tests/py? Would > like to see how bad it is. > > I would like to still go with the plain (non-json) approach if > possible at all. I'm attaching the patch... it's from 2017. It does not apply, rule_add() in tests/py/nft-tests.py has changed quite a bit, since there are tests for the netlink payload, json and so on. I was basically checking if removing the rule that was possible to make sure there is symmetry between add and delete. I'm afraid you'll have to dig into tests/py file to update this.
>From 32e7cfa5dd683db33e757b46b4944c18a0f2826c Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> Date: Sun, 8 Jan 2017 19:55:20 +0100 Subject: [PATCH] tests: py: test deletion from rule definition This patch checks that rule deletion works fine. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- tests/py/nft-test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 7bb5437805d5..1c1b430cc1fa 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -661,6 +661,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): return [-1, warning, error, unit_tests] payload_expected = [] + delete_error = False for table in table_list: try: @@ -770,6 +771,19 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): if not force_all_family_option: return [ret, warning, error, unit_tests] + if delete_error == True: + continue + + cmd = NFT_BIN + " delete rule " + table_info + \ + chain.name + " " + rule[0] + ret = execute_cmd(cmd, filename, lineno) + if ret != 0: + reason = "Cannot delete rule: " + cmd + print_error(reason, filename, lineno) + ret = -1 + error += 1 + delete_error = True + return [ret, warning, error, unit_tests] -- 2.30.2