]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/py: fix error message
authorFlorian Westphal <fw@strlen.de>
Wed, 2 Jun 2021 13:28:50 +0000 (15:28 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 2 Jun 2021 13:29:16 +0000 (15:29 +0200)
This should say "should have failed" only if the set add operation
was supposed to fail, not when its supposed to work.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/nft-test.py

index 18e9c67fa26beaf09c389d506f1485a3b4e98a67..15e74d8b2c174144da2138e63f92b85bf4e53e9c 100755 (executable)
@@ -407,7 +407,11 @@ def set_add_elements(set_element, set_name, state, filename, lineno):
         ret = execute_cmd(cmd, filename, lineno)
 
         if (state == "fail" and ret == 0) or (state == "ok" and ret != 0):
-            test_state = "This rule should have failed."
+            if state == "fail":
+                    test_state = "This rule should have failed."
+            else:
+                    test_state = "This rule should not have failed."
+
             reason = cmd + ": " + test_state
             print_error(reason, filename, lineno)
             return -1