Skip to content

Commit ec074f8

Browse files
fix tests
1 parent c90ff1f commit ec074f8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,15 +1578,15 @@ protected void indexTimestampData(int shards) throws IOException {
15781578
}
15791579

15801580
private static void createLoadIndexWithFieldAndDocumentCounts(int fieldCount, int documentCount) throws IOException {
1581-
String settings = String.format("\"settings\":{\"index.mapping.total_fields.limit\":%d}", fieldCount);
1582-
StringBuilder mappings = new StringBuilder();
1583-
mappings.append(String.format("\"mappings\": { \"properties\": {\"f%d\": {\"type\" : \"integer\"}", 1));
1581+
StringBuilder schema = new StringBuilder();
1582+
schema.append(String.format(Locale.ROOT, "{\"settings\":{\"index.mapping.total_fields.limit\":%d},", fieldCount));
1583+
schema.append(String.format(Locale.ROOT, "\"mappings\":{\"properties\":{\"f%d\":{\"type\":\"integer\"}", 1));
15841584
for (int i = 2; i <= fieldCount; i++) {
1585-
mappings.append(String.format(", \"f%d\":{\"type\" : \"integer\"}", i));
1585+
schema.append(String.format(Locale.ROOT, ",\"f%d\":{\"type\":\"integer\"}", i));
15861586
}
1587-
mappings.append("}}");
1587+
schema.append(String.format(Locale.ROOT, "}}}"));
15881588
Request request = new Request("PUT", "/" + testIndexName());
1589-
request.setJsonEntity("{" + settings + ", " + mappings + "}");
1589+
request.setJsonEntity(schema.toString());
15901590
assertEquals(200, client().performRequest(request).getStatusLine().getStatusCode());
15911591

15921592
if (documentCount > 0) {
@@ -1595,12 +1595,16 @@ private static void createLoadIndexWithFieldAndDocumentCounts(int fieldCount, in
15951595

15961596
StringBuilder bulk = new StringBuilder();
15971597
for (int i = 1; i <= documentCount; i++) {
1598-
bulk.append("{\"index\":{}}\n");
1599-
bulk.append(String.format("{\"f%d\":%d", 1, 1));
1598+
bulk.append(String.format(Locale.ROOT, """
1599+
{"index":{}}
1600+
"""));
1601+
bulk.append(String.format(Locale.ROOT, "{\"f%d\":%d", 1, 1));
16001602
for (int j = 2; j <= fieldCount; j++) {
1601-
bulk.append(String.format(",\"f%d\":%d", j, j));
1603+
bulk.append(String.format(Locale.ROOT, ",\"f%d\":%d", j, j));
16021604
}
1603-
bulk.append("}\n");
1605+
bulk.append(String.format(Locale.ROOT, """
1606+
}
1607+
"""));
16041608
}
16051609
request.setJsonEntity(bulk.toString());
16061610
assertEquals(200, client().performRequest(request).getStatusLine().getStatusCode());

0 commit comments

Comments
 (0)