Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
afoucret committed May 30, 2024
1 parent 43a0e23 commit 5ba1e3c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@
- length: { tokens: 1 }
- match: { tokens.0.token: "replacedSample 6 sample1" }

---
"pattern_replace error handling (too complex pattern)":
- do:
catch: bad_request
indices.create:
index: test_too_complex_regex_pattern
body:
settings:
index:
analysis:
analyzer:
my_analyzer:
tokenizer: standard
char_filter:
- my_char_filter
char_filter:
my_char_filter:
type: "pattern_replace"
# This pattern intentionally uses special characters designed to throw an error.
# It's expected that the pattern may not render correctly.
pattern: "(\\d+)-(?=\\d\nͭͭͭͭͭͭͭͭͭͭͭͭͭͭͭ"
flags: CASE_INSENSITIVE|MULTILINE|DOTALL|UNICODE_CASE|CANON_EQ
replacement: "_$1"
- match: { status: 400 }
- match: { error.type: illegal_argument_exception }
- match: { error.reason: "Too complex regex pattern" }

---
"mapping":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,6 @@
- match: { tokens.0.token: sha }
- match: { tokens.1.token: hay }

---
"Too complex regex pattern":
- do:
catch: bad_request
indices.create:
index: test_too_complex_regex_pattern
body:
settings:
index:
analysis:
analyzer:
my_analyzer:
tokenizer: standard
char_filter:
- my_char_filter
char_filter:
my_char_filter:
type: "pattern_replace"
pattern: "(\\d+)-(?=\\d\nͭͭͭͭͭͭͭͭͭͭͭͭͭͭͭ"
flags: CASE_INSENSITIVE|MULTILINE|DOTALL|UNICODE_CASE|CANON_EQ
replacement: "_$1"
- match: { status: 400 }
- match: { error.type: illegal_argument_exception }
- match: { error.reason: "Too complex regex pattern" }


---
"Custom normalizer in request":
- do:
Expand Down

0 comments on commit 5ba1e3c

Please sign in to comment.