Skip to content

Commit ab7f15e

Browse files
committed
test(tracing): name the registration deadline and surface worker errors
Store the 5 s join deadline as REGISTRATION_DEADLINE_SECONDS, and re-raise an exception from the registration thread after the join so a failing registration reports its own error instead of a later list assertion.
1 parent 4abb776 commit ab7f15e

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎tests/lib/core/tracing/test_tracing_processor_manager.py‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,23 @@ def _manager() -> TracingProcessorManager:
2424
return manager
2525

2626

27-
def _finishes(target: Any, timeout: float = 5.0) -> bool:
28-
thread = threading.Thread(target=target, daemon=True)
27+
REGISTRATION_DEADLINE_SECONDS = 5.0
28+
29+
30+
def _finishes(target: Any, timeout: float = REGISTRATION_DEADLINE_SECONDS) -> bool:
31+
errors: list[BaseException] = []
32+
33+
def _run() -> None:
34+
try:
35+
target()
36+
except BaseException as exc:
37+
errors.append(exc)
38+
39+
thread = threading.Thread(target=_run, daemon=True)
2940
thread.start()
3041
thread.join(timeout)
42+
if errors:
43+
raise errors[0]
3144
return not thread.is_alive()
3245

3346

0 commit comments

Comments
 (0)