Wrap triggering of a watch inside an assertBusy(...) invocation
This test replaces the watch index after watcher got started. This triggers watches being reloaded and while this happens the trigger engine is paused, which disallows watches from being triggered. At this time there are no watches in the .watches index and I think this is just unlucky timing. Reloading of watches happens in the background and the watch state can be started when that happens. For normal schedule trigger engines this is not an issue, because watches that are meant to be triggered are triggered when the engine triggers the next time. However for the mock scheduled trigger engine this is different, because watches are triggered programatically and there is no retry in this test. I think just adding `timeWarp().trigger("mywatch");` inside a `assertBusy(...)`` is the right fix here. If it fails because the mock schedule trigger engine is paused then the test will try again. In the mean time the the watches can be reloaded, which then resumes the mock scheduled trigger engine. Closes #50658
This commit is contained in:
parent
d2189b9d80
commit
f75d99149b
|
@ -43,7 +43,7 @@ public class WatcherConcreteIndexTests extends AbstractWatcherIntegrationTestCas
|
||||||
assertTrue(putWatchResponse.isCreated());
|
assertTrue(putWatchResponse.isCreated());
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
timeWarp().trigger("mywatch");
|
assertBusy(() -> timeWarp().trigger("mywatch"));
|
||||||
|
|
||||||
assertBusy(() -> {
|
assertBusy(() -> {
|
||||||
SearchResponse searchResult = client().prepareSearch(watchResultsIndex).setTrackTotalHits(true).get();
|
SearchResponse searchResult = client().prepareSearch(watchResultsIndex).setTrackTotalHits(true).get();
|
||||||
|
|
Loading…
Reference in New Issue