Skip to content

Commit 04aaea0

Browse files
authored
ESQL: Shore up test (#130217) (#131117)
Adds a `_forcemerge` to a test to try and avoid spurious failures. The tests expect everything in one segment and the bulk mostly does that- but `_forcemerge` should *double* force it. Closes #129975
1 parent 87601ef commit 04aaea0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/StoredFieldsSequentialIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ public void buildIndex() throws IOException {
194194
bulk.setJsonEntity(b.toString());
195195
Response bulkResponse = client().performRequest(bulk);
196196
assertThat(entityToMap(bulkResponse.getEntity(), XContentType.JSON), matchesMap().entry("errors", false).extraOk());
197+
198+
// Forcemerge to one segment to get more consistent results.
199+
Request forcemerge = new Request("POST", "/_forcemerge");
200+
forcemerge.addParameter("max_num_segments", "1");
201+
Response forcemergeResponse = client().performRequest(forcemerge);
202+
assertThat(
203+
entityToMap(forcemergeResponse.getEntity(), XContentType.JSON),
204+
matchesMap().entry("_shards", matchesMap().entry("failed", 0).entry("successful", greaterThanOrEqualTo(1)).extraOk()).extraOk()
205+
);
197206
}
198207

199208
@Override

0 commit comments

Comments
 (0)