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
This commit is contained in:
Przemko Robakowski 2019-12-17 01:15:15 +01:00 committed by GitHub
parent 8391b974c5
commit 0efb241b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -209,6 +209,7 @@ public class CsvProcessorTests extends ESTestCase {
private IngestDocument processDocument(String[] headers, String csv, boolean trim) throws Exception {
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
Arrays.stream(headers).filter(ingestDocument::hasField).forEach(ingestDocument::removeField);
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, csv);
char quoteChar = quote.isEmpty() ? '"' : quote.charAt(0);