Skip to content

Commit 92f6cf2

Browse files
Grok processor ignore case test
Added test demonstrating that grok using ignore case works, since this does a minimal test that the `joni` and `jcodings` libraries are compatible. Forward-port of test from elastic#43334
1 parent d029e18 commit 92f6cf2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ public void testMatch() throws Exception {
4545
assertThat(doc.getFieldValue("one", String.class), equalTo("1"));
4646
}
4747

48+
public void testIgnoreCase() throws Exception {
49+
String fieldName = RandomDocumentPicks.randomFieldName(random());
50+
IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
51+
doc.setFieldValue(fieldName, "A");
52+
GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.emptyMap(),
53+
Collections.singletonList("(?<a>(?i)A)"), fieldName, false, false, MatcherWatchdog.noop());
54+
processor.execute(doc);
55+
assertThat(doc.getFieldValue("a", String.class), equalTo("A"));
56+
}
57+
4858
public void testNoMatch() {
4959
String fieldName = RandomDocumentPicks.randomFieldName(random());
5060
IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());

0 commit comments

Comments
 (0)