From 4359cb82833a6907f9ee9803be270db89ceaf758 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 2 Jun 2021 15:28:50 +0200 Subject: tests/py: fix error message 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 --- tests/py/nft-test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/py') diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 18e9c67f..15e74d8b 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -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 -- cgit v1.2.3