Skip to content

Commit

Permalink
Grok processor ignore case test (#48909)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
henningandersen committed Nov 7, 2019
1 parent bdc7057 commit 8835142
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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("(?<a>(?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<>());
Expand Down

0 comments on commit 8835142

Please sign in to comment.