Skip to content

Commit

Permalink
Unmute SmokeTestWatcherTestSuiteIT suite (elastic#50973)
Browse files Browse the repository at this point in the history
Also adds `assertWatchCount(0)` snippet inside assertBusy(...) based on
the findings in: elastic#32299 (comment)

Relates to elastic#32299
  • Loading branch information
martijnvg authored and SivagurunathanV committed Jan 21, 2020
1 parent 70d3973 commit b8b9846
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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()) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b8b9846

Please sign in to comment.