From 35009bd5e3e9f0d71f3a402c1304f7db9da0a1ab Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Wed, 13 Feb 2019 07:12:09 -0800 Subject: [PATCH 1/3] Re-enable single node tests --- .../xpack/watcher/execution/ExecutionService.java | 14 +++++++++----- .../watcher/test/integration/SingleNodeTests.java | 1 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index 237da4ae6ae1e..f24e50f816ec7 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -380,11 +380,15 @@ private WatchRecord createWatchRecord(WatchRecord existingRecord, WatchExecution private void logWatchRecord(WatchExecutionContext ctx, Exception e) { // failed watches stack traces are only logged in debug, otherwise they should be checked out in the history - if (logger.isDebugEnabled()) { - logger.debug((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); - } else { - logger.warn("failed to execute watch [{}]", ctx.id().watchId()); - } + //if (logger.isDebugEnabled()) { + // logger.debug((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); + //} else { + // logger.warn("failed to execute watch [{}]", ctx.id().watchId()); + //} + + // TODO: allow this to show the warning message with the exception for debugging related to + // TODO: https://github.com/elastic/elasticsearch/issues/36782 + logger.warn((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); } /* diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java index b03d75af113af..28730e50255b6 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java @@ -28,7 +28,6 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; -@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/36782") @ClusterScope(scope = SUITE, numClientNodes = 0, transportClientRatio = 0, maxNumDataNodes = 1, supportsDedicatedMasters = false) public class SingleNodeTests extends AbstractWatcherIntegrationTestCase { From 8fad23ed96558b856800ab8c8c4a3e79488a0ae9 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Wed, 13 Feb 2019 07:38:36 -0800 Subject: [PATCH 2/3] Fix imports. --- .../xpack/watcher/test/integration/SingleNodeTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java index 28730e50255b6..6d2d63d4f4158 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.watcher.test.integration; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; From 3dcb8601b44414aa3c905cb14461234cf498ef55 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Fri, 15 Feb 2019 14:04:01 -0800 Subject: [PATCH 3/3] Add annotation instead for debugging. --- .../xpack/watcher/execution/ExecutionService.java | 14 +++++--------- .../watcher/test/integration/SingleNodeTests.java | 2 ++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index f24e50f816ec7..237da4ae6ae1e 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -380,15 +380,11 @@ private WatchRecord createWatchRecord(WatchRecord existingRecord, WatchExecution private void logWatchRecord(WatchExecutionContext ctx, Exception e) { // failed watches stack traces are only logged in debug, otherwise they should be checked out in the history - //if (logger.isDebugEnabled()) { - // logger.debug((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); - //} else { - // logger.warn("failed to execute watch [{}]", ctx.id().watchId()); - //} - - // TODO: allow this to show the warning message with the exception for debugging related to - // TODO: https://github.com/elastic/elasticsearch/issues/36782 - logger.warn((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); + if (logger.isDebugEnabled()) { + logger.debug((Supplier) () -> new ParameterizedMessage("failed to execute watch [{}]", ctx.id().watchId()), e); + } else { + logger.warn("failed to execute watch [{}]", ctx.id().watchId()); + } } /* diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java index 6d2d63d4f4158..6bd9da794cdfc 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SingleNodeTests.java @@ -10,6 +10,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; +import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.xpack.core.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; @@ -27,6 +28,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; +@TestLogging("org.elasticsearch.xpack.watcher.execution:DEBUG") @ClusterScope(scope = SUITE, numClientNodes = 0, transportClientRatio = 0, maxNumDataNodes = 1, supportsDedicatedMasters = false) public class SingleNodeTests extends AbstractWatcherIntegrationTestCase {