Skip to content

Commit

Permalink
Watcher remove assertion that is susceptible to a race conditi… (#47670)
Browse files Browse the repository at this point in the history
When deactivating a watch, there is a chance that it is fully deactivated
and reporting as not running but the history is not fully written yet.
There is not a tight coupling between the associated watcher history
index and the deactivation. This test assumes that once a watch is
deactivated that all history is fully written in a very short time period.
If the Watch is deactivated, but the history is slow to write it can result
in a failing test.

This change removes an assertion that assumes that the deactivation of a watch
ensured the all of the watch history was written. There is still a minor race
condition with respect to the remaining history assertions. However, if the
history is slow to be written, it will allow the test to still passing.

fixes #47503
  • Loading branch information
jakelandis authored Oct 8, 2019
1 parent 324f876 commit 79a787f
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ protected boolean timeWarped() {
return false;
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30699")
public void testDeactivateAndActivate() throws Exception {
PutWatchResponse putWatchResponse = watcherClient().preparePutWatch()
.setId("_id")
Expand Down Expand Up @@ -84,17 +83,11 @@ public void testDeactivateAndActivate() throws Exception {
assertThat(sum, is(0));
});

logger.info("Ensured no more watches are being executed");
refresh();
long count1 = docCount(".watcher-history*", "doc", matchAllQuery());


logger.info("Sleeping for 5 seconds, watch history count [{}]", count1);
Thread.sleep(5000);

refresh();
long count2 = docCount(".watcher-history*", "doc", matchAllQuery());

assertThat(count2, is(count1));

// lets activate it again
logger.info("Activating watch again");
Expand Down

0 comments on commit 79a787f

Please sign in to comment.