Skip to content

Commit c702eb9

Browse files
authored
Re-instate watch count check with busy/wait (elastic#123979)
1 parent d266f58 commit c702eb9

File tree

1 file changed

+5
-0
lines changed
  • x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/integration

1 file changed

+5
-0
lines changed

x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/integration/WatchAckTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchRequestBuilder;
2525
import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchResponse;
2626
import org.elasticsearch.xpack.core.watcher.transport.actions.put.PutWatchRequestBuilder;
27+
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsRequestBuilder;
2728
import org.elasticsearch.xpack.core.watcher.watch.Watch;
2829
import org.elasticsearch.xpack.watcher.condition.CompareCondition;
2930
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
@@ -75,6 +76,8 @@ public void testAckSingleAction() throws Exception {
7576

7677
assertThat(putWatchResponse.isCreated(), is(true));
7778

79+
assertBusy(() -> assertThat(new WatcherStatsRequestBuilder(client()).get().getWatchesCount(), is(1L)));
80+
7881
timeWarp().trigger("_id", 4, TimeValue.timeValueSeconds(5));
7982
AckWatchResponse ackResponse = new AckWatchRequestBuilder(client(), "_id").setActionIds("_a1").get();
8083
assertThat(ackResponse.getStatus().actionStatus("_a1").ackStatus().state(), is(ActionStatus.AckStatus.State.ACKED));
@@ -146,6 +149,7 @@ public void testAckAllActions() throws Exception {
146149
.get();
147150

148151
assertThat(putWatchResponse.isCreated(), is(true));
152+
assertBusy(() -> assertThat(new WatcherStatsRequestBuilder(client()).get().getWatchesCount(), is(1L)));
149153

150154
timeWarp().trigger("_id", 4, TimeValue.timeValueSeconds(5));
151155

@@ -223,6 +227,7 @@ public void testAckWithRestart() throws Exception {
223227
)
224228
.get();
225229
assertThat(putWatchResponse.isCreated(), is(true));
230+
assertBusy(() -> assertThat(new WatcherStatsRequestBuilder(client()).get().getWatchesCount(), is(1L)));
226231

227232
timeWarp().trigger("_name", 4, TimeValue.timeValueSeconds(5));
228233
restartWatcherRandomly();

0 commit comments

Comments
 (0)