Skip to content

Commit fd5b885

Browse files
authored
Wait for pending tasks in TransportSearchFailuresIT (#44543)
The change in #44433 introduces a state in which the cluster has no relocating shards but still has a pending reroute task which might start a shard relocation. `TransportSearchFailuresIT` failed on a PR build seemingly because it did not wait for this pending task to complete too, reporting more active shards than expected: 2> java.lang.AssertionError: Expected: <9> but: was <10> at __randomizedtesting.SeedInfo.seed([4057CA4301FE95FA:207EC88573747235]:0) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18) at org.junit.Assert.assertThat(Assert.java:956) at org.junit.Assert.assertThat(Assert.java:923) at org.elasticsearch.search.basic.TransportSearchFailuresIT.testFailedSearchWithWrongQuery(TransportSearchFailuresIT.java:97) This commit addresses this failure by waiting until there are neither pending tasks nor shard relocations in progress.
1 parent 2819324 commit fd5b885

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testFailedSearchWithWrongQuery() throws Exception {
8686
ClusterHealthResponse clusterHealth = client()
8787
.admin()
8888
.cluster()
89-
.health(clusterHealthRequest("test").waitForYellowStatus().waitForNoRelocatingShards(true)
89+
.health(clusterHealthRequest("test").waitForYellowStatus().waitForNoRelocatingShards(true).waitForEvents(Priority.LANGUID)
9090
.waitForActiveShards(test.totalNumShards)).actionGet();
9191
logger.info("Done Cluster Health, status {}", clusterHealth.getStatus());
9292
assertThat(clusterHealth.isTimedOut(), equalTo(false));

0 commit comments

Comments
 (0)