From 8835142ac9060038f2b7a3400b6d22e3ee3a66df Mon Sep 17 00:00:00 2001 From: Henning Andersen <33268011+henningandersen@users.noreply.github.com> Date: Fri, 8 Nov 2019 00:04:00 +0100 Subject: [PATCH] Grok processor ignore case test (#48909) 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 #43334 --- .../ingest/common/GrokProcessorTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java index 159115f4e38b5..faabeacd94058 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java @@ -45,6 +45,16 @@ public void testMatch() throws Exception { assertThat(doc.getFieldValue("one", String.class), equalTo("1")); } + public void testIgnoreCase() throws Exception { + String fieldName = RandomDocumentPicks.randomFieldName(random()); + IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); + doc.setFieldValue(fieldName, "A"); + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.emptyMap(), + Collections.singletonList("(?(?i)A)"), fieldName, false, false, MatcherWatchdog.noop()); + processor.execute(doc); + assertThat(doc.getFieldValue("a", String.class), equalTo("A")); + } + public void testNoMatch() { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());