Skip to content

Commit ee435b1

Browse files
committed
ESQL: Shore up test (#130217)
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 2554120 commit ee435b1

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
@@ -195,6 +195,15 @@ public void buildIndex() throws IOException {
195195
bulk.setJsonEntity(b.toString());
196196
Response bulkResponse = client().performRequest(bulk);
197197
assertThat(entityToMap(bulkResponse.getEntity(), XContentType.JSON), matchesMap().entry("errors", false).extraOk());
198+
199+
// Forcemerge to one segment to get more consistent results.
200+
Request forcemerge = new Request("POST", "/_forcemerge");
201+
forcemerge.addParameter("max_num_segments", "1");
202+
Response forcemergeResponse = client().performRequest(forcemerge);
203+
assertThat(
204+
entityToMap(forcemergeResponse.getEntity(), XContentType.JSON),
205+
matchesMap().entry("_shards", matchesMap().entry("failed", 0).entry("successful", greaterThanOrEqualTo(1)).extraOk()).extraOk()
206+
);
198207
}
199208

200209
@Override

0 commit comments

Comments
 (0)