Skip to content

Commit 0efb241

Browse files
authored
Fix flakiness in CsvProcessorTests (#50254) (#50256)
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 #50209
1 parent 8391b97 commit 0efb241

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)