Allow empty matchers
This commit is contained in:
parent
d63c25a855
commit
1c9034282c
|
@ -212,7 +212,7 @@ stringContents separator =
|
|||
|= keepOne (\char -> True)
|
||||
, Parser.keep Parser.oneOrMore (\char -> char /= separator && char /= '\\')
|
||||
]
|
||||
|> Parser.repeat Parser.oneOrMore
|
||||
|> Parser.repeat Parser.zeroOrMore
|
||||
|> Parser.map (String.join "")
|
||||
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ parseEndsAt startsAt endsAt =
|
|||
validateMatcherForm : MatcherForm -> MatcherForm
|
||||
validateMatcherForm { name, value, isRegex } =
|
||||
{ name = validate stringNotEmpty name
|
||||
, value = validate stringNotEmpty value
|
||||
, value = value
|
||||
, isRegex = isRegex
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ parseMatcher =
|
|||
[ test "should parse empty matcher string" <|
|
||||
\() ->
|
||||
Expect.equal Nothing (Utils.Filter.parseMatcher "")
|
||||
, test "should parse empty matcher value" <|
|
||||
\() ->
|
||||
Expect.equal (Just (Matcher "alertname" Eq "")) (Utils.Filter.parseMatcher "alertname=\"\"")
|
||||
, fuzz (tuple ( string, string )) "should parse random matcher string" <|
|
||||
\( key, value ) ->
|
||||
if List.map isNotEmptyTrimmedAlphabetWord [ key, value ] /= [ True, True ] then
|
||||
|
|
Loading…
Reference in New Issue