Skip to content

Commit 9c982b1

Browse files
seanzatzdevszybia
authored andcommitted
Fix function which generates test field names (elastic#136717)
* fix function which generates test field names * include non-alphanumeric chars * Update test/framework/src/main/java/org/elasticsearch/ingest/RandomDocumentPicks.java Co-authored-by: Szymon Bialkowski <[email protected]> * minimize changes --------- Co-authored-by: Szymon Bialkowski <[email protected]>
1 parent ffbc38b commit 9c982b1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/framework/src/main/java/org/elasticsearch/ingest/RandomDocumentPicks.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ public static String randomFieldName(Random random) {
4040
if (i > 0) {
4141
fieldName.append('.');
4242
}
43-
fieldName.append(randomString(random));
43+
String pathSegment;
44+
// can't contain a dot since might lead to invalid empty segment, e.g. `one..two.three`
45+
do {
46+
pathSegment = randomString(random);
47+
} while (pathSegment.contains("."));
48+
fieldName.append(pathSegment);
4449
}
4550
if (numLevels > 1) {
4651
fieldName.append('.');

0 commit comments

Comments
 (0)