Skip to content

Commit

Permalink
Fix failing URLDecodeProcessorTests::testProcessor test (elastic#78690)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann committed Jan 6, 2022
1 parent 7e4f632 commit afd0ef2
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ protected Class<?> expectedResultType() {

public void testProcessor() throws Exception {
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
String fieldValue = RandomDocumentPicks.randomString(random());
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, modifyInput(fieldValue));
String fieldValue;
String fieldName;
String modifiedFieldValue;
do {
fieldValue = RandomDocumentPicks.randomString(random());
modifiedFieldValue = modifyInput(fieldValue);
fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, modifiedFieldValue);
} while (isSupportedValue(modifiedFieldValue) == false);
Processor processor = newProcessor(fieldName, randomBoolean(), fieldName);
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue(fieldName, expectedResultType()), equalTo(expectedResult(fieldValue)));
Expand All @@ -48,8 +54,13 @@ public void testProcessor() throws Exception {
List<String> fieldValueList = new ArrayList<>();
List<T> expectedList = new ArrayList<>();
for (int i = 0; i < numItems; i++) {
String randomString = RandomDocumentPicks.randomString(random());
fieldValueList.add(modifyInput(randomString));
String randomString;
String modifiedRandomString;
do {
randomString = RandomDocumentPicks.randomString(random());
modifiedRandomString = modifyInput(randomString);
} while (isSupportedValue(modifiedRandomString) == false);
fieldValueList.add(modifiedRandomString);
expectedList.add(expectedResult(randomString));
}
String multiValueFieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValueList);
Expand Down

0 comments on commit afd0ef2

Please sign in to comment.