From b8b98460287999cbdf6823bbcc17c0e324bf1c9b Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 16 Jan 2020 09:16:52 +0100 Subject: [PATCH] Unmute SmokeTestWatcherTestSuiteIT suite (#50973) Also adds `assertWatchCount(0)` snippet inside assertBusy(...) based on the findings in: https://github.com/elastic/elasticsearch/issues/32299#issuecomment-466305686 Relates to #32299 --- .../smoketest/SmokeTestWatcherTestSuiteIT.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 2b509a348e901..c7fcf719d5594 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 @@ -109,7 +109,6 @@ protected Settings restAdminSettings() { return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", token).build(); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32299") public void testMonitorClusterHealth() throws Exception { String watchId = "cluster_health_watch"; @@ -125,7 +124,7 @@ public void testMonitorClusterHealth() throws Exception { assertThat(address, is(notNullValue())); String[] splitAddress = address.split(":", 2); String host = splitAddress[0]; - int port = Integer.valueOf(splitAddress[1]); + int port = Integer.parseInt(splitAddress[1]); // put watch try (XContentBuilder builder = jsonBuilder()) { @@ -161,7 +160,12 @@ public void testMonitorClusterHealth() throws Exception { assertThat(conditionMet, is(true)); deleteWatch(watchId); - assertWatchCount(0); + // Wrap inside an assertBusy(...), because watch may execute just after being deleted, + // This tries to re-add the watch which fails, because of version conflict, + // but for a moment the watch count from watcher stats api may be incorrect. + // (via WatcherIndexingListener#preIndex) + // The WatcherIndexingListener#postIndex() detects this version conflict and corrects the watch count. + assertBusy(() -> assertWatchCount(0)); } private void indexWatch(String watchId, XContentBuilder builder) throws Exception {