Rename processor test fix (#43035)
If the source field name is a prefix of the target field name, the source field still exists after rename processor has run. Adjusted test case to handle that case.
This commit is contained in:
parent
76a92b49a8
commit
437d2d6d9f
|
@ -132,7 +132,11 @@ public class RenameProcessorTests extends ESTestCase {
|
|||
String newFieldName = randomValueOtherThanMany(ingestDocument::hasField, () -> RandomDocumentPicks.randomFieldName(random()));
|
||||
Processor processor = createRenameProcessor(fieldName, newFieldName, false);
|
||||
processor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.hasField(fieldName), equalTo(false));
|
||||
if (newFieldName.startsWith(fieldName + '.')) {
|
||||
assertThat(ingestDocument.getFieldValue(fieldName, Object.class), instanceOf(Map.class));
|
||||
} else {
|
||||
assertThat(ingestDocument.hasField(fieldName), equalTo(false));
|
||||
}
|
||||
assertThat(ingestDocument.hasField(newFieldName), equalTo(true));
|
||||
assertThat(ingestDocument.getFieldValue(newFieldName, Object.class), nullValue());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue