Skip to content

Commit

Permalink
remove duplicate test
Browse files Browse the repository at this point in the history
  • Loading branch information
alextheimer committed Feb 2, 2024
1 parent 1d655f5 commit 0b0a9b9
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions prometheus/src/test/scala/filodb/prometheus/parse/ParserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -991,37 +991,6 @@ class ParserSpec extends AnyFunSpec with Matchers {
}
}

it ("should correctly enforce filter length limit for EqualsRegex") {
val lim = Parser.REGEX_MAX_LEN

// true -> should not throw an exception; else false
val succeedQueryPairs = Seq(
(true, s"""foo{job=~"${"a".repeat(lim)}"}"""),
(true, s"""foo{job=~"${".".repeat(lim)}"}"""),
// May want to enforce this (no regex chars, but length limit exceeded).
(true, s"""foo{job=~"${"a".repeat(lim + 1)}"}"""),
(true, s"""foo{job=~"${"a".repeat(lim + 1).split("").mkString("|")}"}"""),
(true, s"""foo{job=~"${"a|".repeat(10) + "a".repeat(lim)}"}"""),
// May want to enforce this (single "|"-joined value exceeds limit).
(true, s"""foo{job=~"${"a|".repeat(10) + "a".repeat(lim + 1)}"}"""),

(false, s"""foo{job=~"${".".repeat(lim + 1)}"}"""),
(false, s"""foo{job=~"${".".repeat(lim + 1).split("").mkString("|")}"}"""),
(false, s"""foo{job=~"${"a".repeat(lim + 1)}.*"}"""),
(false, s"""foo{job=~"${"a".repeat(lim + 1).split("").mkString("|")}.*"}"""),
)
for ((shouldSucceed, query) <- succeedQueryPairs) {
val materialize = () => {
Parser.queryToLogicalPlan(query, 1000, 1000)
}
if (shouldSucceed) {
materialize.apply()
} else {
intercept[IllegalArgumentException] {materialize.apply()}
}
}
}

private def printBinaryJoin( lp: LogicalPlan, level: Int = 0) : scala.Unit = {
if (!lp.isInstanceOf[BinaryJoin]) {
info(s"${" "*level}" + lp.toString)
Expand Down

0 comments on commit 0b0a9b9

Please sign in to comment.