-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a
:contains
predicate filter for compatibility with internal lo…
…g queries. Not meant to be used for metrics as it executes a full scan. Bump Spectator to 1.3.8
- Loading branch information
Showing
7 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
atlas-core/src/test/scala/com/netflix/atlas/core/model/QueryVocabularySuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.netflix.atlas.core.model | ||
|
||
import com.netflix.atlas.core.model.Query.Regex | ||
import com.netflix.atlas.core.stacklang.Interpreter | ||
import munit.FunSuite | ||
|
||
class QueryVocabularySuite extends FunSuite { | ||
|
||
val interpreter = new Interpreter(QueryVocabulary.allWords) | ||
|
||
test("contains, escape") { | ||
var exp = interpreter.execute("a,^$.?*+[](){}\\#&!%,:contains").stack(0) | ||
assertEquals( | ||
exp.asInstanceOf[Regex].pattern.toString, | ||
".*\\^\\$\\.\\?\\*\\+\\[\\]\\(\\)\\{\\}\\\\#&!%" | ||
) | ||
exp = interpreter.execute("a,space and ~,:contains").stack(0) | ||
assertEquals( | ||
exp.asInstanceOf[Regex].pattern.toString, | ||
".*space\\u0020and\\u0020~" | ||
) | ||
} | ||
|
||
test("contains, matches escaped") { | ||
val q = interpreter | ||
.execute("foo,my $var. [work-in-progress],:contains") | ||
.stack(0) | ||
.asInstanceOf[Regex] | ||
assert(q.matches(Map("foo" -> "my $var. [work-in-progress]"))) | ||
assert(q.matches(Map("foo" -> "initialize my $var. [work-in-progress], not a range"))) | ||
assert(!q.matches(Map("foo" -> "my $var. [work-in progress]"))) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters