From e19e108698d0abae50cc41a56353116ffdd0b8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Thu, 19 Jun 2025 15:09:39 +0200 Subject: [PATCH] Ignore softhsm2 errors when deleting token in keyfromlabel test In some rare cases, the softhsm2 utility reports failure to delete the token directory, despite the token being found. Subsequent attempts to delete the token again indicate that the token was deleted. Ignore this cleanup error, as it doesn't prevent our tests from working properly. There is also an attempt to delete the token before the test starts which ensures a clean state before the test is executed, in case there's actually a leftover token. (cherry picked from commit e786a2e950411fb3ffe1aed140cc4520e4ffd74a) --- bin/tests/system/keyfromlabel/tests_keyfromlabel.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py index f531915442..428717d5a2 100644 --- a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py +++ b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py @@ -70,7 +70,7 @@ def token_init_and_cleanup(): isctest.run.cmd( token_cleanup_command, env=EMPTY_OPENSSL_CONF_ENV, - log_stderr=False, + log_stdout=True, raise_on_exception=False, ) @@ -82,7 +82,10 @@ def token_init_and_cleanup(): yield finally: output = isctest.run.cmd( - token_cleanup_command, env=EMPTY_OPENSSL_CONF_ENV, log_stdout=True + token_cleanup_command, + env=EMPTY_OPENSSL_CONF_ENV, + log_stdout=True, + raise_on_exception=False, ).stdout.decode("utf-8") assert re.search("Found token (.*) with matching token label", output) assert re.search("The token (.*) has been deleted", output)