use of io.trino.spi.eventlistener.QueryFailureInfo in project trino by trinodb.
the class TestEventListenerBasic method assertFailedQuery.
private void assertFailedQuery(Session session, @Language("SQL") String sql, String expectedFailure) throws Exception {
queries.runQueryAndWaitForEvents(sql, 2, session, Optional.of(expectedFailure));
QueryCompletedEvent queryCompletedEvent = getOnlyElement(generatedEvents.getQueryCompletedEvents());
assertEquals(queryCompletedEvent.getMetadata().getQuery(), sql);
QueryFailureInfo failureInfo = queryCompletedEvent.getFailureInfo().orElseThrow(() -> new AssertionError("Expected query event to be failed"));
assertEquals(expectedFailure, failureInfo.getFailureMessage().orElse(null));
}
Aggregations