From 1b38518c6373a16daae8c4b1081591770dfab51e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 19 Oct 2025 17:45:44 -1000 Subject: [PATCH] [tests] Fix flaky test_noise_corrupt_encrypted_frame integration test (#11405) --- tests/integration/test_oversized_payloads.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_oversized_payloads.py b/tests/integration/test_oversized_payloads.py index ba18e3d348..8bf890261a 100644 --- a/tests/integration/test_oversized_payloads.py +++ b/tests/integration/test_oversized_payloads.py @@ -281,8 +281,12 @@ async def test_noise_corrupt_encrypted_frame( # Check for signs that the process exited/crashed if "Segmentation fault" in line or "core dumped" in line: process_exited = True - # Check for the expected warning about decryption failure + # Check for the expected log about decryption failure + # This can appear as either a VV-level log from noise or a W-level log from connection if ( + "[VV][api.noise" in line + and "noise_cipherstate_decrypt failed: MAC_FAILURE" in line + ) or ( "[W][api.connection" in line and "Reading failed CIPHERSTATE_DECRYPT_FAILED" in line ): @@ -322,9 +326,9 @@ async def test_noise_corrupt_encrypted_frame( assert not process_exited, ( "ESPHome process should not crash on corrupt encrypted frames" ) - # Verify we saw the expected warning message + # Verify we saw the expected log message about decryption failure assert cipherstate_failed, ( - "Expected to see warning about CIPHERSTATE_DECRYPT_FAILED" + "Expected to see log about noise_cipherstate_decrypt failure or CIPHERSTATE_DECRYPT_FAILED" ) # Verify we can still reconnect after handling the corrupt frame