Skip to content

Commit b7b2c7c

Browse files
probakowskiSivagurunathanV
authored andcommitted
Fix flakiness in CsvProcessorTests (elastic#50254)
There's flakiness in CsvProcesorTests, where tests fail if random document generator add field that should not be present. This change cleans generated document from these problematic fields. Closes elastic#50209
1 parent 75e01af commit b7b2c7c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/CsvProcessorTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ private IngestDocument processDocument(String[] headers, String csv) throws Exce
209209

210210
private IngestDocument processDocument(String[] headers, String csv, boolean trim) throws Exception {
211211
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
212+
Arrays.stream(headers).filter(ingestDocument::hasField).forEach(ingestDocument::removeField);
212213

213214
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, csv);
214215
char quoteChar = quote.isEmpty() ? '"' : quote.charAt(0);

0 commit comments

Comments
 (0)