diff --git a/testing/trino-tests/src/test/java/io/trino/execution/EventsCollector.java b/testing/trino-tests/src/test/java/io/trino/execution/EventsCollector.java index 98c7ba9d36ec..647fdcf6d1b3 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/EventsCollector.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/EventsCollector.java @@ -139,7 +139,12 @@ public void waitForQueryCompletion(Duration timeout) boolean finished = latch.await(timeout.toMillis(), MILLISECONDS); if (!finished) { - throw new TimeoutException("Query did not complete in " + timeout); + synchronized (this) { + TimeoutException exception = new TimeoutException("Query did not complete in %s. Currently, queryCreatedEvent=%s queryCompletedEvent=%s queryCompleteLatch=%s" + .formatted(timeout, queryCreatedEvent, queryCompletedEvent, queryCompleteLatch)); + failures.forEach(exception::addSuppressed); + throw exception; + } } }