From 57f76b520e85f072fcc6fc12f39ece1fb21ba995 Mon Sep 17 00:00:00 2001 From: Babis Chalios Date: Wed, 17 Sep 2025 13:23:42 +0200 Subject: [PATCH] fix: test_failing_filter intermittent issue We intermittently get failures in this test while destroying the microVM object given to us by the fixture. That code checks that the microVM was not killed due to a signal and in this case, it clearly has (that's the intention of the test). The test itself is marking the microVM as killed so the cleanup logic should never reach that check. The only way that kill() fails in this case is when test_microvm.mark_killed() (the last command in this test) is never called, meaning that the test errors out before that. I believe that the only point in the code that can cause the test to exit earlier is this: ``` try: test_microvm.start() except requests.exceptions.ConnectionError: pass ``` We are expecting test_microvm.start() to fail due to seccomp violations, however we are only catching the ConnectionError exception. If any other exception is raised the test will fail pre-maturely without setting test_microvm.mark_killed(). In fact, looking at the backtrace from intermittent failures it looks like the code is actually raising a ConnectionResetError. Change the test to catch any error, rather than just ConnectionError. Signed-off-by: Babis Chalios --- tests/integration_tests/security/test_custom_seccomp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/integration_tests/security/test_custom_seccomp.py b/tests/integration_tests/security/test_custom_seccomp.py index ffcedbbd653..1c7bec98337 100644 --- a/tests/integration_tests/security/test_custom_seccomp.py +++ b/tests/integration_tests/security/test_custom_seccomp.py @@ -6,8 +6,6 @@ import time from pathlib import Path -import requests - from framework import utils @@ -76,9 +74,10 @@ def test_failing_filter(uvm_plain, seccompiler): test_microvm.basic_config(vcpu_count=1) # Try to start the VM with error checking off, because it will fail. + # pylint: disable=bare-except try: test_microvm.start() - except requests.exceptions.ConnectionError: + except: pass # Give time for the process to get killed