From 5b39be567c23685d87aa424c4ca58392843d7b9f Mon Sep 17 00:00:00 2001 From: Jack Shirazi Date: Fri, 19 Dec 2025 12:44:36 +0000 Subject: [PATCH] less flaky with await --- .../contrib/inferredspans/internal/SamplingProfilerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java b/inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java index 6471cb684..1cf5ab466 100644 --- a/inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java +++ b/inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java @@ -177,7 +177,8 @@ void testProfileTransaction() throws Exception { try (Scope scope = tx.makeCurrent()) { // makes sure that the rest will be captured by another profiling session // this tests that restoring which threads to profile works - Thread.sleep(600); + int currentSession = setup.profiler.getProfilingSessions(); + await().until(() -> setup.profiler.getProfilingSessions() > currentSession); profilingActiveOnThread = setup.profiler.isProfilingActiveOnThread(Thread.currentThread()); aInferred(tracer); } finally {