test: make context-failure regressions deterministic and simplify alarm log handling
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
1ca9e60c98
commit
75406af970
@@ -17,7 +17,6 @@ where no broker connection exists. In that case publish_alarm() logs and skips.
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from trex_core.adapters.messaging.topology import alarm_routing_key
|
||||
@@ -91,11 +90,9 @@ class AlarmEmitter:
|
||||
code, title,
|
||||
)
|
||||
return False
|
||||
except Exception: # noqa: BLE001 — alarm must never crash the caller
|
||||
exc = sys.exc_info()[1]
|
||||
exc_name = type(exc).__name__ if exc is not None else "Exception"
|
||||
except Exception as exc: # noqa: BLE001 — alarm must never crash the caller
|
||||
_log.error(
|
||||
"alarm publish failed: code=%s title=%s error_type=%s",
|
||||
code, title, exc_name,
|
||||
code, title, type(exc).__name__,
|
||||
)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user