From d57e1a238978484780b0610cbc588490a7338319 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Fri, 28 Jun 2019 19:17:19 -0500 Subject: [PATCH 1/2] SmokeTestWatcherWithSecurityIT: Retry if failures searching .watcher-history Catch exceptions and fail (which allows the assertBusy to retry) if an error happens from the search against .watcher-history. Related: #42409 Related: #39169 --- .../smoketest/SmokeTestWatcherWithSecurityIT.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java index d2f688889a95f..33497078378d8 100644 --- a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java +++ b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java @@ -8,6 +8,7 @@ import org.apache.http.util.EntityUtils; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; +import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; @@ -330,6 +331,10 @@ private ObjectPath getWatchHistoryEntry(String watchId, String state) throws Exc String watchid = objectPath.evaluate("hits.hits.0._source.watch_id"); assertThat(watchid, is(watchId)); objectPathReference.set(objectPath); + } catch (ResponseException e) { + final String err = "Failed to perform search of watcher history - " + e; + logger.info(err); + fail(err); } }); return objectPathReference.get(); From e448050afabf469ae422ebdd11920a163f0c0573 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 1 Jul 2019 12:06:53 -0500 Subject: [PATCH 2/2] preserve stack trace on search history failure --- .../smoketest/SmokeTestWatcherWithSecurityIT.java | 4 ++-- .../elasticsearch/smoketest/SmokeTestWatcherTestSuiteIT.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java index 33497078378d8..20fd53b72e416 100644 --- a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java +++ b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java @@ -332,8 +332,8 @@ private ObjectPath getWatchHistoryEntry(String watchId, String state) throws Exc assertThat(watchid, is(watchId)); objectPathReference.set(objectPath); } catch (ResponseException e) { - final String err = "Failed to perform search of watcher history - " + e; - logger.info(err); + final String err = "Failed to perform search of watcher history"; + logger.info(err, e); fail(err); } }); diff --git a/x-pack/qa/smoke-test-watcher/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherTestSuiteIT.java b/x-pack/qa/smoke-test-watcher/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherTestSuiteIT.java index ec5015345fcb2..60866661617f8 100644 --- a/x-pack/qa/smoke-test-watcher/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherTestSuiteIT.java +++ b/x-pack/qa/smoke-test-watcher/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherTestSuiteIT.java @@ -216,8 +216,8 @@ private ObjectPath getWatchHistoryEntry(String watchId) throws Exception { assertThat("watch_id for hit 0 in watcher history", foundWatchId, is(watchId)); objectPathReference.set(objectPath); } catch (ResponseException e) { - final String err = "Failed to perform search of watcher history - " + e; - logger.info(err); + final String err = "Failed to perform search of watcher history"; + logger.info(err, e); fail(err); } });