Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented May 13, 2025

Currently, creating and killing openssl process was part of the test. In result, if the test case failed for whatever reason, the openssl process would remain open, causing disruptions in consecutive test executions.

Fix that by defining openssl server instance as a pytest fixture. That way, openssl process will be terminated regardless of the test result.

Currently, creating and killing openssl process was part of the test. In
result, if the test case failed for whatever reason, the openssl process
would remain open, causing disruptions in consecutive test executions.

Fix that by defining openssl server instance as a pytest fixture. That
way, openssl process will be terminated regardless of the test
result.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos
Copy link
Contributor Author

rlubos commented May 13, 2025

For additional context - this has been observed from time to time in CI, where it could be seen that openssl failed to initialize due to corresponding TCP port being already open:
https://github.com/zephyrproject-rtos/zephyr/actions/runs/14989510350/job/42109974066?pr=89609

ERROR test_app_vs_openssl:test_app_vs_openssl.py:65 b'40A7AAF1FE7E0000:error:80000062:system library:BIO_bind:Address already in use:../crypto/bio/bio_sock2.c:178:calling bind()\n'
ERROR test_app_vs_openssl:test_app_vs_openssl.py:65 b'40A7AAF1FE7E0000:error:10000075:BIO routines:BIO_bind:unable to bind socket:../crypto/bio/bio_sock2.c:180:\n'

Before this change, if the test failed, openssl instance would not be killed:

DEBUG: #: [00:00:00.010,002] tls_configuration_sample: Test FAILED
ERROR: Read from device timeout occurred
FAILED
------------------------------ live log teardown -------------------------------
DEBUG: Running subprocess finished with return code 0

openssl process was still running after that

By using fixture, the process is killed regardless of the test result:

DEBUG: #: [00:00:00.010,002] tls_configuration_sample: Test FAILED
ERROR: Read from device timeout occurred
FAILED
------------------------------ live log teardown -------------------------------
INFO: Kill server
DEBUG: Running subprocess finished with return code 0

@rlubos rlubos requested a review from valeriosetti May 13, 2025 11:47
@sonarqubecloud
Copy link

@kartben kartben merged commit 4512cbf into zephyrproject-rtos:main May 15, 2025
22 checks passed
@valeriosetti
Copy link
Contributor

@rlubos sorry for the late reply, but I was in vacation last week. Thanks for fixing this!

@rlubos rlubos deleted the tests/tls-configurations-openssl-as-fixture branch May 19, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants