From 00945b3da85171064e7ca83815960070f0d039ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=9Alizak?= Date: Thu, 18 Feb 2021 12:46:33 +0100 Subject: [PATCH] Match regex for query retries just like Flaky annotation processor does --- .../src/main/java/io/trino/tests/hive/HiveProductTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/hive/HiveProductTest.java b/testing/trino-product-tests/src/main/java/io/trino/tests/hive/HiveProductTest.java index 5294c6c57527..8a17505b44d4 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/hive/HiveProductTest.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/hive/HiveProductTest.java @@ -23,6 +23,7 @@ import javax.inject.Inject; import java.time.temporal.ChronoUnit; +import java.util.regex.Pattern; public class HiveProductTest extends ProductTest @@ -43,8 +44,9 @@ public class HiveProductTest private static boolean isErrorCommittingToHive(Throwable throwable) { - return Throwables.getCausalChain(throwable).stream() - .anyMatch(exception -> exception.getMessage().matches(ERROR_COMMITTING_WRITE_TO_HIVE_MATCH)); + return Pattern.compile(ERROR_COMMITTING_WRITE_TO_HIVE_MATCH) + .matcher(Throwables.getStackTraceAsString(throwable)) + .find(); } @Inject