From 4e8871fedcfa8bc74e3575b28c281273a1ca7638 Mon Sep 17 00:00:00 2001 From: Jonatan Ivanov Date: Wed, 4 Sep 2024 12:32:29 -0700 Subject: [PATCH] Throw exception if a latch times out --- .../tracing/brave/contextpropagation/ScopesTests.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/micrometer-tracing-bridges/micrometer-tracing-bridge-brave/src/test/java/io/micrometer/tracing/brave/contextpropagation/ScopesTests.java b/micrometer-tracing-bridges/micrometer-tracing-bridge-brave/src/test/java/io/micrometer/tracing/brave/contextpropagation/ScopesTests.java index a47c798f..0428d6d9 100644 --- a/micrometer-tracing-bridges/micrometer-tracing-bridge-brave/src/test/java/io/micrometer/tracing/brave/contextpropagation/ScopesTests.java +++ b/micrometer-tracing-bridges/micrometer-tracing-bridge-brave/src/test/java/io/micrometer/tracing/brave/contextpropagation/ScopesTests.java @@ -196,7 +196,9 @@ void should_open_and_close_scopes_with_reactor_multithreaded() { } else { try { - latch.await(1, TimeUnit.SECONDS); + if (!latch.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("Waiting for the latch timed out!"); + } } catch (InterruptedException e) { // ignore @@ -253,7 +255,9 @@ void should_open_and_close_scopes_with_reactor_multithreaded() { Observation obs4 = Observation.start("4", observationRegistry); try (Observation.Scope scope4 = obs4.openScope()) { logger.info("FRESH SPAN AFTER [{}]", tracer.currentSpan()); - cleanupLatch.await(1, TimeUnit.SECONDS); + if (!cleanupLatch.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("Waiting for the latch timed out!"); + } } catch (InterruptedException e) { // ignore